wext.c 32 KB

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