wext.c 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270
  1. /*
  2. * Copyright 2002-2005, Instant802 Networks, Inc.
  3. * Copyright 2005-2006, Devicescape Software, Inc.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #include <linux/module.h>
  10. #include <linux/init.h>
  11. #include <linux/netdevice.h>
  12. #include <linux/types.h>
  13. #include <linux/slab.h>
  14. #include <linux/skbuff.h>
  15. #include <linux/etherdevice.h>
  16. #include <linux/if_arp.h>
  17. #include <linux/wireless.h>
  18. #include <net/iw_handler.h>
  19. #include <asm/uaccess.h>
  20. #include <net/mac80211.h>
  21. #include "ieee80211_i.h"
  22. #include "led.h"
  23. #include "rate.h"
  24. #include "wpa.h"
  25. #include "aes_ccm.h"
  26. static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
  27. int idx, int alg, int remove,
  28. int set_tx_key, const u8 *_key,
  29. size_t key_len)
  30. {
  31. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  32. struct sta_info *sta;
  33. struct ieee80211_key *key;
  34. struct ieee80211_sub_if_data *sdata;
  35. int err;
  36. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  37. if (idx < 0 || idx >= NUM_DEFAULT_KEYS) {
  38. printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d\n",
  39. dev->name, idx);
  40. return -EINVAL;
  41. }
  42. if (remove) {
  43. rcu_read_lock();
  44. err = 0;
  45. if (is_broadcast_ether_addr(sta_addr)) {
  46. key = sdata->keys[idx];
  47. } else {
  48. sta = sta_info_get(local, sta_addr);
  49. if (!sta) {
  50. err = -ENOENT;
  51. goto out_unlock;
  52. }
  53. key = sta->key;
  54. }
  55. ieee80211_key_free(key);
  56. } else {
  57. key = ieee80211_key_alloc(alg, idx, key_len, _key);
  58. if (!key)
  59. return -ENOMEM;
  60. sta = NULL;
  61. err = 0;
  62. rcu_read_lock();
  63. if (!is_broadcast_ether_addr(sta_addr)) {
  64. set_tx_key = 0;
  65. /*
  66. * According to the standard, the key index of a
  67. * pairwise key must be zero. However, some AP are
  68. * broken when it comes to WEP key indices, so we
  69. * work around this.
  70. */
  71. if (idx != 0 && alg != ALG_WEP) {
  72. ieee80211_key_free(key);
  73. err = -EINVAL;
  74. goto out_unlock;
  75. }
  76. sta = sta_info_get(local, sta_addr);
  77. if (!sta) {
  78. ieee80211_key_free(key);
  79. err = -ENOENT;
  80. goto out_unlock;
  81. }
  82. }
  83. if (alg == ALG_WEP &&
  84. key_len != LEN_WEP40 && key_len != LEN_WEP104) {
  85. ieee80211_key_free(key);
  86. err = -EINVAL;
  87. goto out_unlock;
  88. }
  89. ieee80211_key_link(key, sdata, sta);
  90. if (set_tx_key || (!sta && !sdata->default_key && key))
  91. ieee80211_set_default_key(sdata, idx);
  92. }
  93. out_unlock:
  94. rcu_read_unlock();
  95. return err;
  96. }
  97. static int ieee80211_ioctl_siwgenie(struct net_device *dev,
  98. struct iw_request_info *info,
  99. struct iw_point *data, char *extra)
  100. {
  101. struct ieee80211_sub_if_data *sdata;
  102. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  103. if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME)
  104. return -EOPNOTSUPP;
  105. if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
  106. sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
  107. int ret = ieee80211_sta_set_extra_ie(dev, extra, data->length);
  108. if (ret)
  109. return ret;
  110. sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
  111. ieee80211_sta_req_auth(dev, &sdata->u.sta);
  112. return 0;
  113. }
  114. return -EOPNOTSUPP;
  115. }
  116. static int ieee80211_ioctl_giwname(struct net_device *dev,
  117. struct iw_request_info *info,
  118. char *name, char *extra)
  119. {
  120. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  121. struct ieee80211_supported_band *sband;
  122. u8 is_ht = 0, is_a = 0, is_b = 0, is_g = 0;
  123. sband = local->hw.wiphy->bands[IEEE80211_BAND_5GHZ];
  124. if (sband) {
  125. is_a = 1;
  126. is_ht |= sband->ht_info.ht_supported;
  127. }
  128. sband = local->hw.wiphy->bands[IEEE80211_BAND_2GHZ];
  129. if (sband) {
  130. int i;
  131. /* Check for mandatory rates */
  132. for (i = 0; i < sband->n_bitrates; i++) {
  133. if (sband->bitrates[i].bitrate == 10)
  134. is_b = 1;
  135. if (sband->bitrates[i].bitrate == 60)
  136. is_g = 1;
  137. }
  138. is_ht |= sband->ht_info.ht_supported;
  139. }
  140. strcpy(name, "IEEE 802.11");
  141. if (is_a)
  142. strcat(name, "a");
  143. if (is_b)
  144. strcat(name, "b");
  145. if (is_g)
  146. strcat(name, "g");
  147. if (is_ht)
  148. strcat(name, "n");
  149. return 0;
  150. }
  151. static int ieee80211_ioctl_giwrange(struct net_device *dev,
  152. struct iw_request_info *info,
  153. struct iw_point *data, char *extra)
  154. {
  155. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  156. struct iw_range *range = (struct iw_range *) extra;
  157. enum ieee80211_band band;
  158. int c = 0;
  159. data->length = sizeof(struct iw_range);
  160. memset(range, 0, sizeof(struct iw_range));
  161. range->we_version_compiled = WIRELESS_EXT;
  162. range->we_version_source = 21;
  163. range->retry_capa = IW_RETRY_LIMIT;
  164. range->retry_flags = IW_RETRY_LIMIT;
  165. range->min_retry = 0;
  166. range->max_retry = 255;
  167. range->min_rts = 0;
  168. range->max_rts = 2347;
  169. range->min_frag = 256;
  170. range->max_frag = 2346;
  171. range->encoding_size[0] = 5;
  172. range->encoding_size[1] = 13;
  173. range->num_encoding_sizes = 2;
  174. range->max_encoding_tokens = NUM_DEFAULT_KEYS;
  175. if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC ||
  176. local->hw.flags & IEEE80211_HW_SIGNAL_DB)
  177. range->max_qual.level = local->hw.max_signal;
  178. else if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
  179. range->max_qual.level = -110;
  180. else
  181. range->max_qual.level = 0;
  182. if (local->hw.flags & IEEE80211_HW_NOISE_DBM)
  183. range->max_qual.noise = -110;
  184. else
  185. range->max_qual.noise = 0;
  186. range->max_qual.qual = 100;
  187. range->max_qual.updated = local->wstats_flags;
  188. range->avg_qual.qual = 50;
  189. /* not always true but better than nothing */
  190. range->avg_qual.level = range->max_qual.level / 2;
  191. range->avg_qual.noise = range->max_qual.noise / 2;
  192. range->avg_qual.updated = local->wstats_flags;
  193. range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
  194. IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
  195. for (band = 0; band < IEEE80211_NUM_BANDS; band ++) {
  196. int i;
  197. struct ieee80211_supported_band *sband;
  198. sband = local->hw.wiphy->bands[band];
  199. if (!sband)
  200. continue;
  201. for (i = 0; i < sband->n_channels && c < IW_MAX_FREQUENCIES; i++) {
  202. struct ieee80211_channel *chan = &sband->channels[i];
  203. if (!(chan->flags & IEEE80211_CHAN_DISABLED)) {
  204. range->freq[c].i =
  205. ieee80211_frequency_to_channel(
  206. chan->center_freq);
  207. range->freq[c].m = chan->center_freq;
  208. range->freq[c].e = 6;
  209. c++;
  210. }
  211. }
  212. }
  213. range->num_channels = c;
  214. range->num_frequency = c;
  215. IW_EVENT_CAPA_SET_KERNEL(range->event_capa);
  216. IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP);
  217. IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN);
  218. range->scan_capa |= IW_SCAN_CAPA_ESSID;
  219. return 0;
  220. }
  221. static int ieee80211_ioctl_siwmode(struct net_device *dev,
  222. struct iw_request_info *info,
  223. __u32 *mode, char *extra)
  224. {
  225. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  226. int type;
  227. if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN)
  228. return -EOPNOTSUPP;
  229. switch (*mode) {
  230. case IW_MODE_INFRA:
  231. type = IEEE80211_IF_TYPE_STA;
  232. break;
  233. case IW_MODE_ADHOC:
  234. type = IEEE80211_IF_TYPE_IBSS;
  235. break;
  236. case IW_MODE_REPEAT:
  237. type = IEEE80211_IF_TYPE_WDS;
  238. break;
  239. case IW_MODE_MONITOR:
  240. type = IEEE80211_IF_TYPE_MNTR;
  241. break;
  242. default:
  243. return -EINVAL;
  244. }
  245. if (type == sdata->vif.type)
  246. return 0;
  247. if (netif_running(dev))
  248. return -EBUSY;
  249. ieee80211_if_reinit(dev);
  250. ieee80211_if_set_type(dev, type);
  251. return 0;
  252. }
  253. static int ieee80211_ioctl_giwmode(struct net_device *dev,
  254. struct iw_request_info *info,
  255. __u32 *mode, char *extra)
  256. {
  257. struct ieee80211_sub_if_data *sdata;
  258. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  259. switch (sdata->vif.type) {
  260. case IEEE80211_IF_TYPE_AP:
  261. *mode = IW_MODE_MASTER;
  262. break;
  263. case IEEE80211_IF_TYPE_STA:
  264. *mode = IW_MODE_INFRA;
  265. break;
  266. case IEEE80211_IF_TYPE_IBSS:
  267. *mode = IW_MODE_ADHOC;
  268. break;
  269. case IEEE80211_IF_TYPE_MNTR:
  270. *mode = IW_MODE_MONITOR;
  271. break;
  272. case IEEE80211_IF_TYPE_WDS:
  273. *mode = IW_MODE_REPEAT;
  274. break;
  275. case IEEE80211_IF_TYPE_VLAN:
  276. *mode = IW_MODE_SECOND; /* FIXME */
  277. break;
  278. default:
  279. *mode = IW_MODE_AUTO;
  280. break;
  281. }
  282. return 0;
  283. }
  284. int ieee80211_set_freq(struct net_device *dev, int freqMHz)
  285. {
  286. int ret = -EINVAL;
  287. struct ieee80211_channel *chan;
  288. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  289. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  290. chan = ieee80211_get_channel(local->hw.wiphy, freqMHz);
  291. if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
  292. if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS &&
  293. chan->flags & IEEE80211_CHAN_NO_IBSS) {
  294. printk(KERN_DEBUG "%s: IBSS not allowed on frequency "
  295. "%d MHz\n", dev->name, chan->center_freq);
  296. return ret;
  297. }
  298. local->oper_channel = chan;
  299. if (local->sta_sw_scanning || local->sta_hw_scanning)
  300. ret = 0;
  301. else
  302. ret = ieee80211_hw_config(local);
  303. rate_control_clear(local);
  304. }
  305. return ret;
  306. }
  307. static int ieee80211_ioctl_siwfreq(struct net_device *dev,
  308. struct iw_request_info *info,
  309. struct iw_freq *freq, char *extra)
  310. {
  311. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  312. if (sdata->vif.type == IEEE80211_IF_TYPE_STA)
  313. sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL;
  314. /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */
  315. if (freq->e == 0) {
  316. if (freq->m < 0) {
  317. if (sdata->vif.type == IEEE80211_IF_TYPE_STA)
  318. sdata->u.sta.flags |=
  319. IEEE80211_STA_AUTO_CHANNEL_SEL;
  320. return 0;
  321. } else
  322. return ieee80211_set_freq(dev,
  323. ieee80211_channel_to_frequency(freq->m));
  324. } else {
  325. int i, div = 1000000;
  326. for (i = 0; i < freq->e; i++)
  327. div /= 10;
  328. if (div > 0)
  329. return ieee80211_set_freq(dev, freq->m / div);
  330. else
  331. return -EINVAL;
  332. }
  333. }
  334. static int ieee80211_ioctl_giwfreq(struct net_device *dev,
  335. struct iw_request_info *info,
  336. struct iw_freq *freq, char *extra)
  337. {
  338. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  339. freq->m = local->hw.conf.channel->center_freq;
  340. freq->e = 6;
  341. return 0;
  342. }
  343. static int ieee80211_ioctl_siwessid(struct net_device *dev,
  344. struct iw_request_info *info,
  345. struct iw_point *data, char *ssid)
  346. {
  347. struct ieee80211_sub_if_data *sdata;
  348. size_t len = data->length;
  349. /* iwconfig uses nul termination in SSID.. */
  350. if (len > 0 && ssid[len - 1] == '\0')
  351. len--;
  352. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  353. if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
  354. sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
  355. int ret;
  356. if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) {
  357. if (len > IEEE80211_MAX_SSID_LEN)
  358. return -EINVAL;
  359. memcpy(sdata->u.sta.ssid, ssid, len);
  360. sdata->u.sta.ssid_len = len;
  361. return 0;
  362. }
  363. if (data->flags)
  364. sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_SSID_SEL;
  365. else
  366. sdata->u.sta.flags |= IEEE80211_STA_AUTO_SSID_SEL;
  367. ret = ieee80211_sta_set_ssid(dev, ssid, len);
  368. if (ret)
  369. return ret;
  370. ieee80211_sta_req_auth(dev, &sdata->u.sta);
  371. return 0;
  372. }
  373. if (sdata->vif.type == IEEE80211_IF_TYPE_AP) {
  374. memcpy(sdata->u.ap.ssid, ssid, len);
  375. memset(sdata->u.ap.ssid + len, 0,
  376. IEEE80211_MAX_SSID_LEN - len);
  377. sdata->u.ap.ssid_len = len;
  378. return ieee80211_if_config(dev);
  379. }
  380. return -EOPNOTSUPP;
  381. }
  382. static int ieee80211_ioctl_giwessid(struct net_device *dev,
  383. struct iw_request_info *info,
  384. struct iw_point *data, char *ssid)
  385. {
  386. size_t len;
  387. struct ieee80211_sub_if_data *sdata;
  388. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  389. if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
  390. sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
  391. int res = ieee80211_sta_get_ssid(dev, ssid, &len);
  392. if (res == 0) {
  393. data->length = len;
  394. data->flags = 1;
  395. } else
  396. data->flags = 0;
  397. return res;
  398. }
  399. if (sdata->vif.type == IEEE80211_IF_TYPE_AP) {
  400. len = sdata->u.ap.ssid_len;
  401. if (len > IW_ESSID_MAX_SIZE)
  402. len = IW_ESSID_MAX_SIZE;
  403. memcpy(ssid, sdata->u.ap.ssid, len);
  404. data->length = len;
  405. data->flags = 1;
  406. return 0;
  407. }
  408. return -EOPNOTSUPP;
  409. }
  410. static int ieee80211_ioctl_siwap(struct net_device *dev,
  411. struct iw_request_info *info,
  412. struct sockaddr *ap_addr, char *extra)
  413. {
  414. struct ieee80211_sub_if_data *sdata;
  415. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  416. if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
  417. sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
  418. int ret;
  419. if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) {
  420. memcpy(sdata->u.sta.bssid, (u8 *) &ap_addr->sa_data,
  421. ETH_ALEN);
  422. return 0;
  423. }
  424. if (is_zero_ether_addr((u8 *) &ap_addr->sa_data))
  425. sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL |
  426. IEEE80211_STA_AUTO_CHANNEL_SEL;
  427. else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data))
  428. sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL;
  429. else
  430. sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
  431. ret = ieee80211_sta_set_bssid(dev, (u8 *) &ap_addr->sa_data);
  432. if (ret)
  433. return ret;
  434. ieee80211_sta_req_auth(dev, &sdata->u.sta);
  435. return 0;
  436. } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) {
  437. /*
  438. * If it is necessary to update the WDS peer address
  439. * while the interface is running, then we need to do
  440. * more work here, namely if it is running we need to
  441. * add a new and remove the old STA entry, this is
  442. * normally handled by _open() and _stop().
  443. */
  444. if (netif_running(dev))
  445. return -EBUSY;
  446. memcpy(&sdata->u.wds.remote_addr, (u8 *) &ap_addr->sa_data,
  447. ETH_ALEN);
  448. return 0;
  449. }
  450. return -EOPNOTSUPP;
  451. }
  452. static int ieee80211_ioctl_giwap(struct net_device *dev,
  453. struct iw_request_info *info,
  454. struct sockaddr *ap_addr, char *extra)
  455. {
  456. struct ieee80211_sub_if_data *sdata;
  457. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  458. if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
  459. sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
  460. if (sdata->u.sta.state == IEEE80211_ASSOCIATED ||
  461. sdata->u.sta.state == IEEE80211_IBSS_JOINED) {
  462. ap_addr->sa_family = ARPHRD_ETHER;
  463. memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN);
  464. return 0;
  465. } else {
  466. memset(&ap_addr->sa_data, 0, ETH_ALEN);
  467. return 0;
  468. }
  469. } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) {
  470. ap_addr->sa_family = ARPHRD_ETHER;
  471. memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN);
  472. return 0;
  473. }
  474. return -EOPNOTSUPP;
  475. }
  476. static int ieee80211_ioctl_siwscan(struct net_device *dev,
  477. struct iw_request_info *info,
  478. union iwreq_data *wrqu, char *extra)
  479. {
  480. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  481. struct iw_scan_req *req = NULL;
  482. u8 *ssid = NULL;
  483. size_t ssid_len = 0;
  484. if (!netif_running(dev))
  485. return -ENETDOWN;
  486. if (sdata->vif.type != IEEE80211_IF_TYPE_STA &&
  487. sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
  488. sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT &&
  489. sdata->vif.type != IEEE80211_IF_TYPE_AP)
  490. return -EOPNOTSUPP;
  491. /* if SSID was specified explicitly then use that */
  492. if (wrqu->data.length == sizeof(struct iw_scan_req) &&
  493. wrqu->data.flags & IW_SCAN_THIS_ESSID) {
  494. req = (struct iw_scan_req *)extra;
  495. ssid = req->essid;
  496. ssid_len = req->essid_len;
  497. }
  498. return ieee80211_sta_req_scan(dev, ssid, ssid_len);
  499. }
  500. static int ieee80211_ioctl_giwscan(struct net_device *dev,
  501. struct iw_request_info *info,
  502. struct iw_point *data, char *extra)
  503. {
  504. int res;
  505. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  506. if (local->sta_sw_scanning || local->sta_hw_scanning)
  507. return -EAGAIN;
  508. res = ieee80211_sta_scan_results(dev, info, extra, data->length);
  509. if (res >= 0) {
  510. data->length = res;
  511. return 0;
  512. }
  513. data->length = 0;
  514. return res;
  515. }
  516. static int ieee80211_ioctl_siwrate(struct net_device *dev,
  517. struct iw_request_info *info,
  518. struct iw_param *rate, char *extra)
  519. {
  520. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  521. int i, err = -EINVAL;
  522. u32 target_rate = rate->value / 100000;
  523. struct ieee80211_sub_if_data *sdata;
  524. struct ieee80211_supported_band *sband;
  525. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  526. sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
  527. /* target_rate = -1, rate->fixed = 0 means auto only, so use all rates
  528. * target_rate = X, rate->fixed = 1 means only rate X
  529. * target_rate = X, rate->fixed = 0 means all rates <= X */
  530. sdata->max_ratectrl_rateidx = -1;
  531. sdata->force_unicast_rateidx = -1;
  532. if (rate->value < 0)
  533. return 0;
  534. for (i=0; i< sband->n_bitrates; i++) {
  535. struct ieee80211_rate *brate = &sband->bitrates[i];
  536. int this_rate = brate->bitrate;
  537. if (target_rate == this_rate) {
  538. sdata->max_ratectrl_rateidx = i;
  539. if (rate->fixed)
  540. sdata->force_unicast_rateidx = i;
  541. err = 0;
  542. break;
  543. }
  544. }
  545. return err;
  546. }
  547. static int ieee80211_ioctl_giwrate(struct net_device *dev,
  548. struct iw_request_info *info,
  549. struct iw_param *rate, char *extra)
  550. {
  551. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  552. struct sta_info *sta;
  553. struct ieee80211_sub_if_data *sdata;
  554. struct ieee80211_supported_band *sband;
  555. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  556. if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
  557. return -EOPNOTSUPP;
  558. sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
  559. rcu_read_lock();
  560. sta = sta_info_get(local, sdata->u.sta.bssid);
  561. if (sta && sta->txrate_idx < sband->n_bitrates)
  562. rate->value = sband->bitrates[sta->txrate_idx].bitrate;
  563. else
  564. rate->value = 0;
  565. rcu_read_unlock();
  566. if (!sta)
  567. return -ENODEV;
  568. rate->value *= 100000;
  569. return 0;
  570. }
  571. static int ieee80211_ioctl_siwtxpower(struct net_device *dev,
  572. struct iw_request_info *info,
  573. union iwreq_data *data, char *extra)
  574. {
  575. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  576. bool need_reconfig = 0;
  577. int new_power_level;
  578. if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM)
  579. return -EINVAL;
  580. if (data->txpower.flags & IW_TXPOW_RANGE)
  581. return -EINVAL;
  582. if (data->txpower.fixed) {
  583. new_power_level = data->txpower.value;
  584. } else {
  585. /*
  586. * Automatic power level. Use maximum power for the current
  587. * channel. Should be part of rate control.
  588. */
  589. struct ieee80211_channel* chan = local->hw.conf.channel;
  590. if (!chan)
  591. return -EINVAL;
  592. new_power_level = chan->max_power;
  593. }
  594. if (local->hw.conf.power_level != new_power_level) {
  595. local->hw.conf.power_level = new_power_level;
  596. need_reconfig = 1;
  597. }
  598. if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) {
  599. local->hw.conf.radio_enabled = !(data->txpower.disabled);
  600. need_reconfig = 1;
  601. ieee80211_led_radio(local, local->hw.conf.radio_enabled);
  602. }
  603. if (need_reconfig) {
  604. ieee80211_hw_config(local);
  605. /* The return value of hw_config is not of big interest here,
  606. * as it doesn't say that it failed because of _this_ config
  607. * change or something else. Ignore it. */
  608. }
  609. return 0;
  610. }
  611. static int ieee80211_ioctl_giwtxpower(struct net_device *dev,
  612. struct iw_request_info *info,
  613. union iwreq_data *data, char *extra)
  614. {
  615. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  616. data->txpower.fixed = 1;
  617. data->txpower.disabled = !(local->hw.conf.radio_enabled);
  618. data->txpower.value = local->hw.conf.power_level;
  619. data->txpower.flags = IW_TXPOW_DBM;
  620. return 0;
  621. }
  622. static int ieee80211_ioctl_siwrts(struct net_device *dev,
  623. struct iw_request_info *info,
  624. struct iw_param *rts, char *extra)
  625. {
  626. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  627. if (rts->disabled)
  628. local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
  629. else if (!rts->fixed)
  630. /* if the rts value is not fixed, then take default */
  631. local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
  632. else if (rts->value < 0 || rts->value > IEEE80211_MAX_RTS_THRESHOLD)
  633. return -EINVAL;
  634. else
  635. local->rts_threshold = rts->value;
  636. /* If the wlan card performs RTS/CTS in hardware/firmware,
  637. * configure it here */
  638. if (local->ops->set_rts_threshold)
  639. local->ops->set_rts_threshold(local_to_hw(local),
  640. local->rts_threshold);
  641. return 0;
  642. }
  643. static int ieee80211_ioctl_giwrts(struct net_device *dev,
  644. struct iw_request_info *info,
  645. struct iw_param *rts, char *extra)
  646. {
  647. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  648. rts->value = local->rts_threshold;
  649. rts->disabled = (rts->value >= IEEE80211_MAX_RTS_THRESHOLD);
  650. rts->fixed = 1;
  651. return 0;
  652. }
  653. static int ieee80211_ioctl_siwfrag(struct net_device *dev,
  654. struct iw_request_info *info,
  655. struct iw_param *frag, char *extra)
  656. {
  657. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  658. if (frag->disabled)
  659. local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
  660. else if (!frag->fixed)
  661. local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
  662. else if (frag->value < 256 ||
  663. frag->value > IEEE80211_MAX_FRAG_THRESHOLD)
  664. return -EINVAL;
  665. else {
  666. /* Fragment length must be even, so strip LSB. */
  667. local->fragmentation_threshold = frag->value & ~0x1;
  668. }
  669. /* If the wlan card performs fragmentation in hardware/firmware,
  670. * configure it here */
  671. if (local->ops->set_frag_threshold)
  672. local->ops->set_frag_threshold(
  673. local_to_hw(local),
  674. local->fragmentation_threshold);
  675. return 0;
  676. }
  677. static int ieee80211_ioctl_giwfrag(struct net_device *dev,
  678. struct iw_request_info *info,
  679. struct iw_param *frag, char *extra)
  680. {
  681. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  682. frag->value = local->fragmentation_threshold;
  683. frag->disabled = (frag->value >= IEEE80211_MAX_RTS_THRESHOLD);
  684. frag->fixed = 1;
  685. return 0;
  686. }
  687. static int ieee80211_ioctl_siwretry(struct net_device *dev,
  688. struct iw_request_info *info,
  689. struct iw_param *retry, char *extra)
  690. {
  691. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  692. if (retry->disabled ||
  693. (retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT)
  694. return -EINVAL;
  695. if (retry->flags & IW_RETRY_MAX)
  696. local->long_retry_limit = retry->value;
  697. else if (retry->flags & IW_RETRY_MIN)
  698. local->short_retry_limit = retry->value;
  699. else {
  700. local->long_retry_limit = retry->value;
  701. local->short_retry_limit = retry->value;
  702. }
  703. if (local->ops->set_retry_limit) {
  704. return local->ops->set_retry_limit(
  705. local_to_hw(local),
  706. local->short_retry_limit,
  707. local->long_retry_limit);
  708. }
  709. return 0;
  710. }
  711. static int ieee80211_ioctl_giwretry(struct net_device *dev,
  712. struct iw_request_info *info,
  713. struct iw_param *retry, char *extra)
  714. {
  715. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  716. retry->disabled = 0;
  717. if (retry->flags == 0 || retry->flags & IW_RETRY_MIN) {
  718. /* first return min value, iwconfig will ask max value
  719. * later if needed */
  720. retry->flags |= IW_RETRY_LIMIT;
  721. retry->value = local->short_retry_limit;
  722. if (local->long_retry_limit != local->short_retry_limit)
  723. retry->flags |= IW_RETRY_MIN;
  724. return 0;
  725. }
  726. if (retry->flags & IW_RETRY_MAX) {
  727. retry->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
  728. retry->value = local->long_retry_limit;
  729. }
  730. return 0;
  731. }
  732. static int ieee80211_ioctl_siwmlme(struct net_device *dev,
  733. struct iw_request_info *info,
  734. struct iw_point *data, char *extra)
  735. {
  736. struct ieee80211_sub_if_data *sdata;
  737. struct iw_mlme *mlme = (struct iw_mlme *) extra;
  738. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  739. if (sdata->vif.type != IEEE80211_IF_TYPE_STA &&
  740. sdata->vif.type != IEEE80211_IF_TYPE_IBSS)
  741. return -EINVAL;
  742. switch (mlme->cmd) {
  743. case IW_MLME_DEAUTH:
  744. /* TODO: mlme->addr.sa_data */
  745. return ieee80211_sta_deauthenticate(dev, mlme->reason_code);
  746. case IW_MLME_DISASSOC:
  747. /* TODO: mlme->addr.sa_data */
  748. return ieee80211_sta_disassociate(dev, mlme->reason_code);
  749. default:
  750. return -EOPNOTSUPP;
  751. }
  752. }
  753. static int ieee80211_ioctl_siwencode(struct net_device *dev,
  754. struct iw_request_info *info,
  755. struct iw_point *erq, char *keybuf)
  756. {
  757. struct ieee80211_sub_if_data *sdata;
  758. int idx, i, alg = ALG_WEP;
  759. u8 bcaddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
  760. int remove = 0;
  761. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  762. idx = erq->flags & IW_ENCODE_INDEX;
  763. if (idx == 0) {
  764. if (sdata->default_key)
  765. for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
  766. if (sdata->default_key == sdata->keys[i]) {
  767. idx = i;
  768. break;
  769. }
  770. }
  771. } else if (idx < 1 || idx > 4)
  772. return -EINVAL;
  773. else
  774. idx--;
  775. if (erq->flags & IW_ENCODE_DISABLED)
  776. remove = 1;
  777. else if (erq->length == 0) {
  778. /* No key data - just set the default TX key index */
  779. ieee80211_set_default_key(sdata, idx);
  780. return 0;
  781. }
  782. return ieee80211_set_encryption(
  783. dev, bcaddr,
  784. idx, alg, remove,
  785. !sdata->default_key,
  786. keybuf, erq->length);
  787. }
  788. static int ieee80211_ioctl_giwencode(struct net_device *dev,
  789. struct iw_request_info *info,
  790. struct iw_point *erq, char *key)
  791. {
  792. struct ieee80211_sub_if_data *sdata;
  793. int idx, i;
  794. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  795. idx = erq->flags & IW_ENCODE_INDEX;
  796. if (idx < 1 || idx > 4) {
  797. idx = -1;
  798. if (!sdata->default_key)
  799. idx = 0;
  800. else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
  801. if (sdata->default_key == sdata->keys[i]) {
  802. idx = i;
  803. break;
  804. }
  805. }
  806. if (idx < 0)
  807. return -EINVAL;
  808. } else
  809. idx--;
  810. erq->flags = idx + 1;
  811. if (!sdata->keys[idx]) {
  812. erq->length = 0;
  813. erq->flags |= IW_ENCODE_DISABLED;
  814. return 0;
  815. }
  816. memcpy(key, sdata->keys[idx]->conf.key,
  817. min_t(int, erq->length, sdata->keys[idx]->conf.keylen));
  818. erq->length = sdata->keys[idx]->conf.keylen;
  819. erq->flags |= IW_ENCODE_ENABLED;
  820. if (sdata->vif.type == IEEE80211_IF_TYPE_STA) {
  821. struct ieee80211_if_sta *ifsta = &sdata->u.sta;
  822. switch (ifsta->auth_alg) {
  823. case WLAN_AUTH_OPEN:
  824. case WLAN_AUTH_LEAP:
  825. erq->flags |= IW_ENCODE_OPEN;
  826. break;
  827. case WLAN_AUTH_SHARED_KEY:
  828. erq->flags |= IW_ENCODE_RESTRICTED;
  829. break;
  830. }
  831. }
  832. return 0;
  833. }
  834. static int ieee80211_ioctl_siwpower(struct net_device *dev,
  835. struct iw_request_info *info,
  836. struct iw_param *wrq,
  837. char *extra)
  838. {
  839. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  840. struct ieee80211_conf *conf = &local->hw.conf;
  841. if (wrq->disabled) {
  842. conf->flags &= ~IEEE80211_CONF_PS;
  843. return ieee80211_hw_config(local);
  844. }
  845. switch (wrq->flags & IW_POWER_MODE) {
  846. case IW_POWER_ON: /* If not specified */
  847. case IW_POWER_MODE: /* If set all mask */
  848. case IW_POWER_ALL_R: /* If explicitely state all */
  849. conf->flags |= IEEE80211_CONF_PS;
  850. break;
  851. default: /* Otherwise we don't support it */
  852. return -EINVAL;
  853. }
  854. return ieee80211_hw_config(local);
  855. }
  856. static int ieee80211_ioctl_giwpower(struct net_device *dev,
  857. struct iw_request_info *info,
  858. union iwreq_data *wrqu,
  859. char *extra)
  860. {
  861. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  862. struct ieee80211_conf *conf = &local->hw.conf;
  863. wrqu->power.disabled = !(conf->flags & IEEE80211_CONF_PS);
  864. return 0;
  865. }
  866. static int ieee80211_ioctl_siwauth(struct net_device *dev,
  867. struct iw_request_info *info,
  868. struct iw_param *data, char *extra)
  869. {
  870. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  871. int ret = 0;
  872. switch (data->flags & IW_AUTH_INDEX) {
  873. case IW_AUTH_WPA_VERSION:
  874. case IW_AUTH_CIPHER_PAIRWISE:
  875. case IW_AUTH_CIPHER_GROUP:
  876. case IW_AUTH_WPA_ENABLED:
  877. case IW_AUTH_RX_UNENCRYPTED_EAPOL:
  878. case IW_AUTH_KEY_MGMT:
  879. break;
  880. case IW_AUTH_DROP_UNENCRYPTED:
  881. sdata->drop_unencrypted = !!data->value;
  882. break;
  883. case IW_AUTH_PRIVACY_INVOKED:
  884. if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
  885. ret = -EINVAL;
  886. else {
  887. sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED;
  888. /*
  889. * Privacy invoked by wpa_supplicant, store the
  890. * value and allow associating to a protected
  891. * network without having a key up front.
  892. */
  893. if (data->value)
  894. sdata->u.sta.flags |=
  895. IEEE80211_STA_PRIVACY_INVOKED;
  896. }
  897. break;
  898. case IW_AUTH_80211_AUTH_ALG:
  899. if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
  900. sdata->vif.type == IEEE80211_IF_TYPE_IBSS)
  901. sdata->u.sta.auth_algs = data->value;
  902. else
  903. ret = -EOPNOTSUPP;
  904. break;
  905. default:
  906. ret = -EOPNOTSUPP;
  907. break;
  908. }
  909. return ret;
  910. }
  911. /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
  912. static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev)
  913. {
  914. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  915. struct iw_statistics *wstats = &local->wstats;
  916. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  917. struct sta_info *sta = NULL;
  918. rcu_read_lock();
  919. if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
  920. sdata->vif.type == IEEE80211_IF_TYPE_IBSS)
  921. sta = sta_info_get(local, sdata->u.sta.bssid);
  922. if (!sta) {
  923. wstats->discard.fragment = 0;
  924. wstats->discard.misc = 0;
  925. wstats->qual.qual = 0;
  926. wstats->qual.level = 0;
  927. wstats->qual.noise = 0;
  928. wstats->qual.updated = IW_QUAL_ALL_INVALID;
  929. } else {
  930. wstats->qual.level = sta->last_signal;
  931. wstats->qual.qual = sta->last_qual;
  932. wstats->qual.noise = sta->last_noise;
  933. wstats->qual.updated = local->wstats_flags;
  934. }
  935. rcu_read_unlock();
  936. return wstats;
  937. }
  938. static int ieee80211_ioctl_giwauth(struct net_device *dev,
  939. struct iw_request_info *info,
  940. struct iw_param *data, char *extra)
  941. {
  942. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  943. int ret = 0;
  944. switch (data->flags & IW_AUTH_INDEX) {
  945. case IW_AUTH_80211_AUTH_ALG:
  946. if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
  947. sdata->vif.type == IEEE80211_IF_TYPE_IBSS)
  948. data->value = sdata->u.sta.auth_algs;
  949. else
  950. ret = -EOPNOTSUPP;
  951. break;
  952. default:
  953. ret = -EOPNOTSUPP;
  954. break;
  955. }
  956. return ret;
  957. }
  958. static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
  959. struct iw_request_info *info,
  960. struct iw_point *erq, char *extra)
  961. {
  962. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  963. struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
  964. int uninitialized_var(alg), idx, i, remove = 0;
  965. switch (ext->alg) {
  966. case IW_ENCODE_ALG_NONE:
  967. remove = 1;
  968. break;
  969. case IW_ENCODE_ALG_WEP:
  970. alg = ALG_WEP;
  971. break;
  972. case IW_ENCODE_ALG_TKIP:
  973. alg = ALG_TKIP;
  974. break;
  975. case IW_ENCODE_ALG_CCMP:
  976. alg = ALG_CCMP;
  977. break;
  978. default:
  979. return -EOPNOTSUPP;
  980. }
  981. if (erq->flags & IW_ENCODE_DISABLED)
  982. remove = 1;
  983. idx = erq->flags & IW_ENCODE_INDEX;
  984. if (idx < 1 || idx > 4) {
  985. idx = -1;
  986. if (!sdata->default_key)
  987. idx = 0;
  988. else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
  989. if (sdata->default_key == sdata->keys[i]) {
  990. idx = i;
  991. break;
  992. }
  993. }
  994. if (idx < 0)
  995. return -EINVAL;
  996. } else
  997. idx--;
  998. return ieee80211_set_encryption(dev, ext->addr.sa_data, idx, alg,
  999. remove,
  1000. ext->ext_flags &
  1001. IW_ENCODE_EXT_SET_TX_KEY,
  1002. ext->key, ext->key_len);
  1003. }
  1004. /* Structures to export the Wireless Handlers */
  1005. static const iw_handler ieee80211_handler[] =
  1006. {
  1007. (iw_handler) NULL, /* SIOCSIWCOMMIT */
  1008. (iw_handler) ieee80211_ioctl_giwname, /* SIOCGIWNAME */
  1009. (iw_handler) NULL, /* SIOCSIWNWID */
  1010. (iw_handler) NULL, /* SIOCGIWNWID */
  1011. (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */
  1012. (iw_handler) ieee80211_ioctl_giwfreq, /* SIOCGIWFREQ */
  1013. (iw_handler) ieee80211_ioctl_siwmode, /* SIOCSIWMODE */
  1014. (iw_handler) ieee80211_ioctl_giwmode, /* SIOCGIWMODE */
  1015. (iw_handler) NULL, /* SIOCSIWSENS */
  1016. (iw_handler) NULL, /* SIOCGIWSENS */
  1017. (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */
  1018. (iw_handler) ieee80211_ioctl_giwrange, /* SIOCGIWRANGE */
  1019. (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */
  1020. (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */
  1021. (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */
  1022. (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */
  1023. (iw_handler) NULL, /* SIOCSIWSPY */
  1024. (iw_handler) NULL, /* SIOCGIWSPY */
  1025. (iw_handler) NULL, /* SIOCSIWTHRSPY */
  1026. (iw_handler) NULL, /* SIOCGIWTHRSPY */
  1027. (iw_handler) ieee80211_ioctl_siwap, /* SIOCSIWAP */
  1028. (iw_handler) ieee80211_ioctl_giwap, /* SIOCGIWAP */
  1029. (iw_handler) ieee80211_ioctl_siwmlme, /* SIOCSIWMLME */
  1030. (iw_handler) NULL, /* SIOCGIWAPLIST */
  1031. (iw_handler) ieee80211_ioctl_siwscan, /* SIOCSIWSCAN */
  1032. (iw_handler) ieee80211_ioctl_giwscan, /* SIOCGIWSCAN */
  1033. (iw_handler) ieee80211_ioctl_siwessid, /* SIOCSIWESSID */
  1034. (iw_handler) ieee80211_ioctl_giwessid, /* SIOCGIWESSID */
  1035. (iw_handler) NULL, /* SIOCSIWNICKN */
  1036. (iw_handler) NULL, /* SIOCGIWNICKN */
  1037. (iw_handler) NULL, /* -- hole -- */
  1038. (iw_handler) NULL, /* -- hole -- */
  1039. (iw_handler) ieee80211_ioctl_siwrate, /* SIOCSIWRATE */
  1040. (iw_handler) ieee80211_ioctl_giwrate, /* SIOCGIWRATE */
  1041. (iw_handler) ieee80211_ioctl_siwrts, /* SIOCSIWRTS */
  1042. (iw_handler) ieee80211_ioctl_giwrts, /* SIOCGIWRTS */
  1043. (iw_handler) ieee80211_ioctl_siwfrag, /* SIOCSIWFRAG */
  1044. (iw_handler) ieee80211_ioctl_giwfrag, /* SIOCGIWFRAG */
  1045. (iw_handler) ieee80211_ioctl_siwtxpower, /* SIOCSIWTXPOW */
  1046. (iw_handler) ieee80211_ioctl_giwtxpower, /* SIOCGIWTXPOW */
  1047. (iw_handler) ieee80211_ioctl_siwretry, /* SIOCSIWRETRY */
  1048. (iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */
  1049. (iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */
  1050. (iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */
  1051. (iw_handler) ieee80211_ioctl_siwpower, /* SIOCSIWPOWER */
  1052. (iw_handler) ieee80211_ioctl_giwpower, /* SIOCGIWPOWER */
  1053. (iw_handler) NULL, /* -- hole -- */
  1054. (iw_handler) NULL, /* -- hole -- */
  1055. (iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */
  1056. (iw_handler) NULL, /* SIOCGIWGENIE */
  1057. (iw_handler) ieee80211_ioctl_siwauth, /* SIOCSIWAUTH */
  1058. (iw_handler) ieee80211_ioctl_giwauth, /* SIOCGIWAUTH */
  1059. (iw_handler) ieee80211_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */
  1060. (iw_handler) NULL, /* SIOCGIWENCODEEXT */
  1061. (iw_handler) NULL, /* SIOCSIWPMKSA */
  1062. (iw_handler) NULL, /* -- hole -- */
  1063. };
  1064. const struct iw_handler_def ieee80211_iw_handler_def =
  1065. {
  1066. .num_standard = ARRAY_SIZE(ieee80211_handler),
  1067. .standard = (iw_handler *) ieee80211_handler,
  1068. .get_wireless_stats = ieee80211_get_wireless_stats,
  1069. };