wext.c 32 KB

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