wext.c 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229
  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_cap.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_cap.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. return 0;
  577. }
  578. static int ieee80211_ioctl_giwtxpower(struct net_device *dev,
  579. struct iw_request_info *info,
  580. union iwreq_data *data, char *extra)
  581. {
  582. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  583. data->txpower.fixed = 1;
  584. data->txpower.disabled = !(local->hw.conf.radio_enabled);
  585. data->txpower.value = local->hw.conf.power_level;
  586. data->txpower.flags = IW_TXPOW_DBM;
  587. return 0;
  588. }
  589. static int ieee80211_ioctl_siwrts(struct net_device *dev,
  590. struct iw_request_info *info,
  591. struct iw_param *rts, char *extra)
  592. {
  593. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  594. if (rts->disabled)
  595. local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
  596. else if (!rts->fixed)
  597. /* if the rts value is not fixed, then take default */
  598. local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
  599. else if (rts->value < 0 || rts->value > IEEE80211_MAX_RTS_THRESHOLD)
  600. return -EINVAL;
  601. else
  602. local->rts_threshold = rts->value;
  603. /* If the wlan card performs RTS/CTS in hardware/firmware,
  604. * configure it here */
  605. if (local->ops->set_rts_threshold)
  606. local->ops->set_rts_threshold(local_to_hw(local),
  607. local->rts_threshold);
  608. return 0;
  609. }
  610. static int ieee80211_ioctl_giwrts(struct net_device *dev,
  611. struct iw_request_info *info,
  612. struct iw_param *rts, char *extra)
  613. {
  614. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  615. rts->value = local->rts_threshold;
  616. rts->disabled = (rts->value >= IEEE80211_MAX_RTS_THRESHOLD);
  617. rts->fixed = 1;
  618. return 0;
  619. }
  620. static int ieee80211_ioctl_siwfrag(struct net_device *dev,
  621. struct iw_request_info *info,
  622. struct iw_param *frag, char *extra)
  623. {
  624. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  625. if (frag->disabled)
  626. local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
  627. else if (!frag->fixed)
  628. local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
  629. else if (frag->value < 256 ||
  630. frag->value > IEEE80211_MAX_FRAG_THRESHOLD)
  631. return -EINVAL;
  632. else {
  633. /* Fragment length must be even, so strip LSB. */
  634. local->fragmentation_threshold = frag->value & ~0x1;
  635. }
  636. /* If the wlan card performs fragmentation in hardware/firmware,
  637. * configure it here */
  638. if (local->ops->set_frag_threshold)
  639. return local->ops->set_frag_threshold(
  640. local_to_hw(local),
  641. local->fragmentation_threshold);
  642. return 0;
  643. }
  644. static int ieee80211_ioctl_giwfrag(struct net_device *dev,
  645. struct iw_request_info *info,
  646. struct iw_param *frag, char *extra)
  647. {
  648. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  649. frag->value = local->fragmentation_threshold;
  650. frag->disabled = (frag->value >= IEEE80211_MAX_RTS_THRESHOLD);
  651. frag->fixed = 1;
  652. return 0;
  653. }
  654. static int ieee80211_ioctl_siwretry(struct net_device *dev,
  655. struct iw_request_info *info,
  656. struct iw_param *retry, char *extra)
  657. {
  658. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  659. if (retry->disabled ||
  660. (retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT)
  661. return -EINVAL;
  662. if (retry->flags & IW_RETRY_MAX)
  663. local->long_retry_limit = retry->value;
  664. else if (retry->flags & IW_RETRY_MIN)
  665. local->short_retry_limit = retry->value;
  666. else {
  667. local->long_retry_limit = retry->value;
  668. local->short_retry_limit = retry->value;
  669. }
  670. if (local->ops->set_retry_limit) {
  671. return local->ops->set_retry_limit(
  672. local_to_hw(local),
  673. local->short_retry_limit,
  674. local->long_retry_limit);
  675. }
  676. return 0;
  677. }
  678. static int ieee80211_ioctl_giwretry(struct net_device *dev,
  679. struct iw_request_info *info,
  680. struct iw_param *retry, char *extra)
  681. {
  682. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  683. retry->disabled = 0;
  684. if (retry->flags == 0 || retry->flags & IW_RETRY_MIN) {
  685. /* first return min value, iwconfig will ask max value
  686. * later if needed */
  687. retry->flags |= IW_RETRY_LIMIT;
  688. retry->value = local->short_retry_limit;
  689. if (local->long_retry_limit != local->short_retry_limit)
  690. retry->flags |= IW_RETRY_MIN;
  691. return 0;
  692. }
  693. if (retry->flags & IW_RETRY_MAX) {
  694. retry->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
  695. retry->value = local->long_retry_limit;
  696. }
  697. return 0;
  698. }
  699. static int ieee80211_ioctl_siwmlme(struct net_device *dev,
  700. struct iw_request_info *info,
  701. struct iw_point *data, char *extra)
  702. {
  703. struct ieee80211_sub_if_data *sdata;
  704. struct iw_mlme *mlme = (struct iw_mlme *) extra;
  705. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  706. if (sdata->vif.type != NL80211_IFTYPE_STATION &&
  707. sdata->vif.type != NL80211_IFTYPE_ADHOC)
  708. return -EINVAL;
  709. switch (mlme->cmd) {
  710. case IW_MLME_DEAUTH:
  711. /* TODO: mlme->addr.sa_data */
  712. return ieee80211_sta_deauthenticate(sdata, mlme->reason_code);
  713. case IW_MLME_DISASSOC:
  714. /* TODO: mlme->addr.sa_data */
  715. return ieee80211_sta_disassociate(sdata, mlme->reason_code);
  716. default:
  717. return -EOPNOTSUPP;
  718. }
  719. }
  720. static int ieee80211_ioctl_siwencode(struct net_device *dev,
  721. struct iw_request_info *info,
  722. struct iw_point *erq, char *keybuf)
  723. {
  724. struct ieee80211_sub_if_data *sdata;
  725. int idx, i, alg = ALG_WEP;
  726. u8 bcaddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
  727. int remove = 0;
  728. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  729. idx = erq->flags & IW_ENCODE_INDEX;
  730. if (idx == 0) {
  731. if (sdata->default_key)
  732. for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
  733. if (sdata->default_key == sdata->keys[i]) {
  734. idx = i;
  735. break;
  736. }
  737. }
  738. } else if (idx < 1 || idx > 4)
  739. return -EINVAL;
  740. else
  741. idx--;
  742. if (erq->flags & IW_ENCODE_DISABLED)
  743. remove = 1;
  744. else if (erq->length == 0) {
  745. /* No key data - just set the default TX key index */
  746. ieee80211_set_default_key(sdata, idx);
  747. return 0;
  748. }
  749. return ieee80211_set_encryption(
  750. sdata, bcaddr,
  751. idx, alg, remove,
  752. !sdata->default_key,
  753. keybuf, erq->length);
  754. }
  755. static int ieee80211_ioctl_giwencode(struct net_device *dev,
  756. struct iw_request_info *info,
  757. struct iw_point *erq, char *key)
  758. {
  759. struct ieee80211_sub_if_data *sdata;
  760. int idx, i;
  761. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  762. idx = erq->flags & IW_ENCODE_INDEX;
  763. if (idx < 1 || idx > 4) {
  764. idx = -1;
  765. if (!sdata->default_key)
  766. idx = 0;
  767. else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
  768. if (sdata->default_key == sdata->keys[i]) {
  769. idx = i;
  770. break;
  771. }
  772. }
  773. if (idx < 0)
  774. return -EINVAL;
  775. } else
  776. idx--;
  777. erq->flags = idx + 1;
  778. if (!sdata->keys[idx]) {
  779. erq->length = 0;
  780. erq->flags |= IW_ENCODE_DISABLED;
  781. return 0;
  782. }
  783. memcpy(key, sdata->keys[idx]->conf.key,
  784. min_t(int, erq->length, sdata->keys[idx]->conf.keylen));
  785. erq->length = sdata->keys[idx]->conf.keylen;
  786. erq->flags |= IW_ENCODE_ENABLED;
  787. if (sdata->vif.type == NL80211_IFTYPE_STATION) {
  788. struct ieee80211_if_sta *ifsta = &sdata->u.sta;
  789. switch (ifsta->auth_alg) {
  790. case WLAN_AUTH_OPEN:
  791. case WLAN_AUTH_LEAP:
  792. erq->flags |= IW_ENCODE_OPEN;
  793. break;
  794. case WLAN_AUTH_SHARED_KEY:
  795. erq->flags |= IW_ENCODE_RESTRICTED;
  796. break;
  797. }
  798. }
  799. return 0;
  800. }
  801. static int ieee80211_ioctl_siwpower(struct net_device *dev,
  802. struct iw_request_info *info,
  803. struct iw_param *wrq,
  804. char *extra)
  805. {
  806. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  807. struct ieee80211_conf *conf = &local->hw.conf;
  808. if (wrq->disabled) {
  809. conf->flags &= ~IEEE80211_CONF_PS;
  810. return ieee80211_hw_config(local);
  811. }
  812. switch (wrq->flags & IW_POWER_MODE) {
  813. case IW_POWER_ON: /* If not specified */
  814. case IW_POWER_MODE: /* If set all mask */
  815. case IW_POWER_ALL_R: /* If explicitely state all */
  816. conf->flags |= IEEE80211_CONF_PS;
  817. break;
  818. default: /* Otherwise we don't support it */
  819. return -EINVAL;
  820. }
  821. return ieee80211_hw_config(local);
  822. }
  823. static int ieee80211_ioctl_giwpower(struct net_device *dev,
  824. struct iw_request_info *info,
  825. union iwreq_data *wrqu,
  826. char *extra)
  827. {
  828. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  829. struct ieee80211_conf *conf = &local->hw.conf;
  830. wrqu->power.disabled = !(conf->flags & IEEE80211_CONF_PS);
  831. return 0;
  832. }
  833. static int ieee80211_ioctl_siwauth(struct net_device *dev,
  834. struct iw_request_info *info,
  835. struct iw_param *data, char *extra)
  836. {
  837. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  838. int ret = 0;
  839. switch (data->flags & IW_AUTH_INDEX) {
  840. case IW_AUTH_WPA_VERSION:
  841. case IW_AUTH_CIPHER_PAIRWISE:
  842. case IW_AUTH_CIPHER_GROUP:
  843. case IW_AUTH_WPA_ENABLED:
  844. case IW_AUTH_RX_UNENCRYPTED_EAPOL:
  845. case IW_AUTH_KEY_MGMT:
  846. break;
  847. case IW_AUTH_DROP_UNENCRYPTED:
  848. sdata->drop_unencrypted = !!data->value;
  849. break;
  850. case IW_AUTH_PRIVACY_INVOKED:
  851. if (sdata->vif.type != NL80211_IFTYPE_STATION)
  852. ret = -EINVAL;
  853. else {
  854. sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED;
  855. /*
  856. * Privacy invoked by wpa_supplicant, store the
  857. * value and allow associating to a protected
  858. * network without having a key up front.
  859. */
  860. if (data->value)
  861. sdata->u.sta.flags |=
  862. IEEE80211_STA_PRIVACY_INVOKED;
  863. }
  864. break;
  865. case IW_AUTH_80211_AUTH_ALG:
  866. if (sdata->vif.type == NL80211_IFTYPE_STATION ||
  867. sdata->vif.type == NL80211_IFTYPE_ADHOC)
  868. sdata->u.sta.auth_algs = data->value;
  869. else
  870. ret = -EOPNOTSUPP;
  871. break;
  872. default:
  873. ret = -EOPNOTSUPP;
  874. break;
  875. }
  876. return ret;
  877. }
  878. /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
  879. static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev)
  880. {
  881. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  882. struct iw_statistics *wstats = &local->wstats;
  883. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  884. struct sta_info *sta = NULL;
  885. rcu_read_lock();
  886. if (sdata->vif.type == NL80211_IFTYPE_STATION ||
  887. sdata->vif.type == NL80211_IFTYPE_ADHOC)
  888. sta = sta_info_get(local, sdata->u.sta.bssid);
  889. if (!sta) {
  890. wstats->discard.fragment = 0;
  891. wstats->discard.misc = 0;
  892. wstats->qual.qual = 0;
  893. wstats->qual.level = 0;
  894. wstats->qual.noise = 0;
  895. wstats->qual.updated = IW_QUAL_ALL_INVALID;
  896. } else {
  897. wstats->qual.level = sta->last_signal;
  898. wstats->qual.qual = sta->last_qual;
  899. wstats->qual.noise = sta->last_noise;
  900. wstats->qual.updated = local->wstats_flags;
  901. }
  902. rcu_read_unlock();
  903. return wstats;
  904. }
  905. static int ieee80211_ioctl_giwauth(struct net_device *dev,
  906. struct iw_request_info *info,
  907. struct iw_param *data, char *extra)
  908. {
  909. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  910. int ret = 0;
  911. switch (data->flags & IW_AUTH_INDEX) {
  912. case IW_AUTH_80211_AUTH_ALG:
  913. if (sdata->vif.type == NL80211_IFTYPE_STATION ||
  914. sdata->vif.type == NL80211_IFTYPE_ADHOC)
  915. data->value = sdata->u.sta.auth_algs;
  916. else
  917. ret = -EOPNOTSUPP;
  918. break;
  919. default:
  920. ret = -EOPNOTSUPP;
  921. break;
  922. }
  923. return ret;
  924. }
  925. static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
  926. struct iw_request_info *info,
  927. struct iw_point *erq, char *extra)
  928. {
  929. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  930. struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
  931. int uninitialized_var(alg), idx, i, remove = 0;
  932. switch (ext->alg) {
  933. case IW_ENCODE_ALG_NONE:
  934. remove = 1;
  935. break;
  936. case IW_ENCODE_ALG_WEP:
  937. alg = ALG_WEP;
  938. break;
  939. case IW_ENCODE_ALG_TKIP:
  940. alg = ALG_TKIP;
  941. break;
  942. case IW_ENCODE_ALG_CCMP:
  943. alg = ALG_CCMP;
  944. break;
  945. default:
  946. return -EOPNOTSUPP;
  947. }
  948. if (erq->flags & IW_ENCODE_DISABLED)
  949. remove = 1;
  950. idx = erq->flags & IW_ENCODE_INDEX;
  951. if (idx < 1 || idx > 4) {
  952. idx = -1;
  953. if (!sdata->default_key)
  954. idx = 0;
  955. else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
  956. if (sdata->default_key == sdata->keys[i]) {
  957. idx = i;
  958. break;
  959. }
  960. }
  961. if (idx < 0)
  962. return -EINVAL;
  963. } else
  964. idx--;
  965. return ieee80211_set_encryption(sdata, ext->addr.sa_data, idx, alg,
  966. remove,
  967. ext->ext_flags &
  968. IW_ENCODE_EXT_SET_TX_KEY,
  969. ext->key, ext->key_len);
  970. }
  971. /* Structures to export the Wireless Handlers */
  972. static const iw_handler ieee80211_handler[] =
  973. {
  974. (iw_handler) NULL, /* SIOCSIWCOMMIT */
  975. (iw_handler) ieee80211_ioctl_giwname, /* SIOCGIWNAME */
  976. (iw_handler) NULL, /* SIOCSIWNWID */
  977. (iw_handler) NULL, /* SIOCGIWNWID */
  978. (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */
  979. (iw_handler) ieee80211_ioctl_giwfreq, /* SIOCGIWFREQ */
  980. (iw_handler) ieee80211_ioctl_siwmode, /* SIOCSIWMODE */
  981. (iw_handler) ieee80211_ioctl_giwmode, /* SIOCGIWMODE */
  982. (iw_handler) NULL, /* SIOCSIWSENS */
  983. (iw_handler) NULL, /* SIOCGIWSENS */
  984. (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */
  985. (iw_handler) ieee80211_ioctl_giwrange, /* SIOCGIWRANGE */
  986. (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */
  987. (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */
  988. (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */
  989. (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */
  990. (iw_handler) NULL, /* SIOCSIWSPY */
  991. (iw_handler) NULL, /* SIOCGIWSPY */
  992. (iw_handler) NULL, /* SIOCSIWTHRSPY */
  993. (iw_handler) NULL, /* SIOCGIWTHRSPY */
  994. (iw_handler) ieee80211_ioctl_siwap, /* SIOCSIWAP */
  995. (iw_handler) ieee80211_ioctl_giwap, /* SIOCGIWAP */
  996. (iw_handler) ieee80211_ioctl_siwmlme, /* SIOCSIWMLME */
  997. (iw_handler) NULL, /* SIOCGIWAPLIST */
  998. (iw_handler) ieee80211_ioctl_siwscan, /* SIOCSIWSCAN */
  999. (iw_handler) ieee80211_ioctl_giwscan, /* SIOCGIWSCAN */
  1000. (iw_handler) ieee80211_ioctl_siwessid, /* SIOCSIWESSID */
  1001. (iw_handler) ieee80211_ioctl_giwessid, /* SIOCGIWESSID */
  1002. (iw_handler) NULL, /* SIOCSIWNICKN */
  1003. (iw_handler) NULL, /* SIOCGIWNICKN */
  1004. (iw_handler) NULL, /* -- hole -- */
  1005. (iw_handler) NULL, /* -- hole -- */
  1006. (iw_handler) ieee80211_ioctl_siwrate, /* SIOCSIWRATE */
  1007. (iw_handler) ieee80211_ioctl_giwrate, /* SIOCGIWRATE */
  1008. (iw_handler) ieee80211_ioctl_siwrts, /* SIOCSIWRTS */
  1009. (iw_handler) ieee80211_ioctl_giwrts, /* SIOCGIWRTS */
  1010. (iw_handler) ieee80211_ioctl_siwfrag, /* SIOCSIWFRAG */
  1011. (iw_handler) ieee80211_ioctl_giwfrag, /* SIOCGIWFRAG */
  1012. (iw_handler) ieee80211_ioctl_siwtxpower, /* SIOCSIWTXPOW */
  1013. (iw_handler) ieee80211_ioctl_giwtxpower, /* SIOCGIWTXPOW */
  1014. (iw_handler) ieee80211_ioctl_siwretry, /* SIOCSIWRETRY */
  1015. (iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */
  1016. (iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */
  1017. (iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */
  1018. (iw_handler) ieee80211_ioctl_siwpower, /* SIOCSIWPOWER */
  1019. (iw_handler) ieee80211_ioctl_giwpower, /* SIOCGIWPOWER */
  1020. (iw_handler) NULL, /* -- hole -- */
  1021. (iw_handler) NULL, /* -- hole -- */
  1022. (iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */
  1023. (iw_handler) NULL, /* SIOCGIWGENIE */
  1024. (iw_handler) ieee80211_ioctl_siwauth, /* SIOCSIWAUTH */
  1025. (iw_handler) ieee80211_ioctl_giwauth, /* SIOCGIWAUTH */
  1026. (iw_handler) ieee80211_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */
  1027. (iw_handler) NULL, /* SIOCGIWENCODEEXT */
  1028. (iw_handler) NULL, /* SIOCSIWPMKSA */
  1029. (iw_handler) NULL, /* -- hole -- */
  1030. };
  1031. const struct iw_handler_def ieee80211_iw_handler_def =
  1032. {
  1033. .num_standard = ARRAY_SIZE(ieee80211_handler),
  1034. .standard = (iw_handler *) ieee80211_handler,
  1035. .get_wireless_stats = ieee80211_get_wireless_stats,
  1036. };