wext.c 32 KB

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