wext.c 32 KB

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