wext.c 32 KB

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