wext.c 31 KB

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