wext.c 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262
  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. if (alg == ALG_WEP &&
  84. key_len != LEN_WEP40 && key_len != LEN_WEP104) {
  85. ieee80211_key_free(key);
  86. err = -EINVAL;
  87. goto out_unlock;
  88. }
  89. ieee80211_key_link(key, sdata, sta);
  90. if (set_tx_key || (!sta && !sdata->default_key && key))
  91. ieee80211_set_default_key(sdata, idx);
  92. }
  93. out_unlock:
  94. rcu_read_unlock();
  95. return err;
  96. }
  97. static int ieee80211_ioctl_siwgenie(struct net_device *dev,
  98. struct iw_request_info *info,
  99. struct iw_point *data, char *extra)
  100. {
  101. struct ieee80211_sub_if_data *sdata;
  102. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  103. if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME)
  104. return -EOPNOTSUPP;
  105. if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
  106. sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
  107. int ret = ieee80211_sta_set_extra_ie(dev, extra, data->length);
  108. if (ret)
  109. return ret;
  110. sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
  111. ieee80211_sta_req_auth(dev, &sdata->u.sta);
  112. return 0;
  113. }
  114. return -EOPNOTSUPP;
  115. }
  116. static int ieee80211_ioctl_giwname(struct net_device *dev,
  117. struct iw_request_info *info,
  118. char *name, char *extra)
  119. {
  120. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  121. struct ieee80211_supported_band *sband;
  122. u8 is_ht = 0, is_a = 0, is_b = 0, is_g = 0;
  123. sband = local->hw.wiphy->bands[IEEE80211_BAND_5GHZ];
  124. if (sband) {
  125. is_a = 1;
  126. is_ht |= sband->ht_info.ht_supported;
  127. }
  128. sband = local->hw.wiphy->bands[IEEE80211_BAND_2GHZ];
  129. if (sband) {
  130. int i;
  131. /* Check for mandatory rates */
  132. for (i = 0; i < sband->n_bitrates; i++) {
  133. if (sband->bitrates[i].bitrate == 10)
  134. is_b = 1;
  135. if (sband->bitrates[i].bitrate == 60)
  136. is_g = 1;
  137. }
  138. is_ht |= sband->ht_info.ht_supported;
  139. }
  140. strcpy(name, "IEEE 802.11");
  141. if (is_a)
  142. strcat(name, "a");
  143. if (is_b)
  144. strcat(name, "b");
  145. if (is_g)
  146. strcat(name, "g");
  147. if (is_ht)
  148. strcat(name, "n");
  149. return 0;
  150. }
  151. static int ieee80211_ioctl_giwrange(struct net_device *dev,
  152. struct iw_request_info *info,
  153. struct iw_point *data, char *extra)
  154. {
  155. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  156. struct iw_range *range = (struct iw_range *) extra;
  157. enum ieee80211_band band;
  158. int c = 0;
  159. data->length = sizeof(struct iw_range);
  160. memset(range, 0, sizeof(struct iw_range));
  161. range->we_version_compiled = WIRELESS_EXT;
  162. range->we_version_source = 21;
  163. range->retry_capa = IW_RETRY_LIMIT;
  164. range->retry_flags = IW_RETRY_LIMIT;
  165. range->min_retry = 0;
  166. range->max_retry = 255;
  167. range->min_rts = 0;
  168. range->max_rts = 2347;
  169. range->min_frag = 256;
  170. range->max_frag = 2346;
  171. range->encoding_size[0] = 5;
  172. range->encoding_size[1] = 13;
  173. range->num_encoding_sizes = 2;
  174. range->max_encoding_tokens = NUM_DEFAULT_KEYS;
  175. if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC ||
  176. local->hw.flags & IEEE80211_HW_SIGNAL_DB)
  177. range->max_qual.level = local->hw.max_signal;
  178. else if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
  179. range->max_qual.level = -110;
  180. else
  181. range->max_qual.level = 0;
  182. if (local->hw.flags & IEEE80211_HW_NOISE_DBM)
  183. range->max_qual.noise = -110;
  184. else
  185. range->max_qual.noise = 0;
  186. range->max_qual.qual = 100;
  187. range->max_qual.updated = local->wstats_flags;
  188. range->avg_qual.qual = 50;
  189. /* not always true but better than nothing */
  190. range->avg_qual.level = range->max_qual.level / 2;
  191. range->avg_qual.noise = range->max_qual.noise / 2;
  192. range->avg_qual.updated = local->wstats_flags;
  193. range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
  194. IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
  195. for (band = 0; band < IEEE80211_NUM_BANDS; band ++) {
  196. int i;
  197. struct ieee80211_supported_band *sband;
  198. sband = local->hw.wiphy->bands[band];
  199. if (!sband)
  200. continue;
  201. for (i = 0; i < sband->n_channels && c < IW_MAX_FREQUENCIES; i++) {
  202. struct ieee80211_channel *chan = &sband->channels[i];
  203. if (!(chan->flags & IEEE80211_CHAN_DISABLED)) {
  204. range->freq[c].i =
  205. ieee80211_frequency_to_channel(
  206. chan->center_freq);
  207. range->freq[c].m = chan->center_freq;
  208. range->freq[c].e = 6;
  209. c++;
  210. }
  211. }
  212. }
  213. range->num_channels = c;
  214. range->num_frequency = c;
  215. IW_EVENT_CAPA_SET_KERNEL(range->event_capa);
  216. IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP);
  217. IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN);
  218. range->scan_capa |= IW_SCAN_CAPA_ESSID;
  219. return 0;
  220. }
  221. static int ieee80211_ioctl_siwmode(struct net_device *dev,
  222. struct iw_request_info *info,
  223. __u32 *mode, char *extra)
  224. {
  225. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  226. int type;
  227. if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN)
  228. return -EOPNOTSUPP;
  229. switch (*mode) {
  230. case IW_MODE_INFRA:
  231. type = IEEE80211_IF_TYPE_STA;
  232. break;
  233. case IW_MODE_ADHOC:
  234. type = IEEE80211_IF_TYPE_IBSS;
  235. break;
  236. case IW_MODE_REPEAT:
  237. type = IEEE80211_IF_TYPE_WDS;
  238. break;
  239. case IW_MODE_MONITOR:
  240. type = IEEE80211_IF_TYPE_MNTR;
  241. break;
  242. default:
  243. return -EINVAL;
  244. }
  245. return ieee80211_if_change_type(sdata, type);
  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(sdata, IEEE80211_IFCC_SSID);
  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. sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
  521. /* target_rate = -1, rate->fixed = 0 means auto only, so use all rates
  522. * target_rate = X, rate->fixed = 1 means only rate X
  523. * target_rate = X, rate->fixed = 0 means all rates <= X */
  524. sdata->max_ratectrl_rateidx = -1;
  525. sdata->force_unicast_rateidx = -1;
  526. if (rate->value < 0)
  527. return 0;
  528. for (i=0; i< sband->n_bitrates; i++) {
  529. struct ieee80211_rate *brate = &sband->bitrates[i];
  530. int this_rate = brate->bitrate;
  531. if (target_rate == this_rate) {
  532. sdata->max_ratectrl_rateidx = i;
  533. if (rate->fixed)
  534. sdata->force_unicast_rateidx = i;
  535. err = 0;
  536. break;
  537. }
  538. }
  539. return err;
  540. }
  541. static int ieee80211_ioctl_giwrate(struct net_device *dev,
  542. struct iw_request_info *info,
  543. struct iw_param *rate, char *extra)
  544. {
  545. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  546. struct sta_info *sta;
  547. struct ieee80211_sub_if_data *sdata;
  548. struct ieee80211_supported_band *sband;
  549. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  550. if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
  551. return -EOPNOTSUPP;
  552. sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
  553. rcu_read_lock();
  554. sta = sta_info_get(local, sdata->u.sta.bssid);
  555. if (sta && sta->txrate_idx < sband->n_bitrates)
  556. rate->value = sband->bitrates[sta->txrate_idx].bitrate;
  557. else
  558. rate->value = 0;
  559. rcu_read_unlock();
  560. if (!sta)
  561. return -ENODEV;
  562. rate->value *= 100000;
  563. return 0;
  564. }
  565. static int ieee80211_ioctl_siwtxpower(struct net_device *dev,
  566. struct iw_request_info *info,
  567. union iwreq_data *data, char *extra)
  568. {
  569. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  570. bool need_reconfig = 0;
  571. int new_power_level;
  572. if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM)
  573. return -EINVAL;
  574. if (data->txpower.flags & IW_TXPOW_RANGE)
  575. return -EINVAL;
  576. if (data->txpower.fixed) {
  577. new_power_level = data->txpower.value;
  578. } else {
  579. /*
  580. * Automatic power level. Use maximum power for the current
  581. * channel. Should be part of rate control.
  582. */
  583. struct ieee80211_channel* chan = local->hw.conf.channel;
  584. if (!chan)
  585. return -EINVAL;
  586. new_power_level = chan->max_power;
  587. }
  588. if (local->hw.conf.power_level != new_power_level) {
  589. local->hw.conf.power_level = new_power_level;
  590. need_reconfig = 1;
  591. }
  592. if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) {
  593. local->hw.conf.radio_enabled = !(data->txpower.disabled);
  594. need_reconfig = 1;
  595. ieee80211_led_radio(local, local->hw.conf.radio_enabled);
  596. }
  597. if (need_reconfig) {
  598. ieee80211_hw_config(local);
  599. /* The return value of hw_config is not of big interest here,
  600. * as it doesn't say that it failed because of _this_ config
  601. * change or something else. Ignore it. */
  602. }
  603. return 0;
  604. }
  605. static int ieee80211_ioctl_giwtxpower(struct net_device *dev,
  606. struct iw_request_info *info,
  607. union iwreq_data *data, char *extra)
  608. {
  609. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  610. data->txpower.fixed = 1;
  611. data->txpower.disabled = !(local->hw.conf.radio_enabled);
  612. data->txpower.value = local->hw.conf.power_level;
  613. data->txpower.flags = IW_TXPOW_DBM;
  614. return 0;
  615. }
  616. static int ieee80211_ioctl_siwrts(struct net_device *dev,
  617. struct iw_request_info *info,
  618. struct iw_param *rts, char *extra)
  619. {
  620. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  621. if (rts->disabled)
  622. local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
  623. else if (!rts->fixed)
  624. /* if the rts value is not fixed, then take default */
  625. local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
  626. else if (rts->value < 0 || rts->value > IEEE80211_MAX_RTS_THRESHOLD)
  627. return -EINVAL;
  628. else
  629. local->rts_threshold = rts->value;
  630. /* If the wlan card performs RTS/CTS in hardware/firmware,
  631. * configure it here */
  632. if (local->ops->set_rts_threshold)
  633. local->ops->set_rts_threshold(local_to_hw(local),
  634. local->rts_threshold);
  635. return 0;
  636. }
  637. static int ieee80211_ioctl_giwrts(struct net_device *dev,
  638. struct iw_request_info *info,
  639. struct iw_param *rts, char *extra)
  640. {
  641. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  642. rts->value = local->rts_threshold;
  643. rts->disabled = (rts->value >= IEEE80211_MAX_RTS_THRESHOLD);
  644. rts->fixed = 1;
  645. return 0;
  646. }
  647. static int ieee80211_ioctl_siwfrag(struct net_device *dev,
  648. struct iw_request_info *info,
  649. struct iw_param *frag, char *extra)
  650. {
  651. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  652. if (frag->disabled)
  653. local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
  654. else if (!frag->fixed)
  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_siwpower(struct net_device *dev,
  829. struct iw_request_info *info,
  830. struct iw_param *wrq,
  831. char *extra)
  832. {
  833. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  834. struct ieee80211_conf *conf = &local->hw.conf;
  835. if (wrq->disabled) {
  836. conf->flags &= ~IEEE80211_CONF_PS;
  837. return ieee80211_hw_config(local);
  838. }
  839. switch (wrq->flags & IW_POWER_MODE) {
  840. case IW_POWER_ON: /* If not specified */
  841. case IW_POWER_MODE: /* If set all mask */
  842. case IW_POWER_ALL_R: /* If explicitely state all */
  843. conf->flags |= IEEE80211_CONF_PS;
  844. break;
  845. default: /* Otherwise we don't support it */
  846. return -EINVAL;
  847. }
  848. return ieee80211_hw_config(local);
  849. }
  850. static int ieee80211_ioctl_giwpower(struct net_device *dev,
  851. struct iw_request_info *info,
  852. union iwreq_data *wrqu,
  853. char *extra)
  854. {
  855. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  856. struct ieee80211_conf *conf = &local->hw.conf;
  857. wrqu->power.disabled = !(conf->flags & IEEE80211_CONF_PS);
  858. return 0;
  859. }
  860. static int ieee80211_ioctl_siwauth(struct net_device *dev,
  861. struct iw_request_info *info,
  862. struct iw_param *data, char *extra)
  863. {
  864. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  865. int ret = 0;
  866. switch (data->flags & IW_AUTH_INDEX) {
  867. case IW_AUTH_WPA_VERSION:
  868. case IW_AUTH_CIPHER_PAIRWISE:
  869. case IW_AUTH_CIPHER_GROUP:
  870. case IW_AUTH_WPA_ENABLED:
  871. case IW_AUTH_RX_UNENCRYPTED_EAPOL:
  872. case IW_AUTH_KEY_MGMT:
  873. break;
  874. case IW_AUTH_DROP_UNENCRYPTED:
  875. sdata->drop_unencrypted = !!data->value;
  876. break;
  877. case IW_AUTH_PRIVACY_INVOKED:
  878. if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
  879. ret = -EINVAL;
  880. else {
  881. sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED;
  882. /*
  883. * Privacy invoked by wpa_supplicant, store the
  884. * value and allow associating to a protected
  885. * network without having a key up front.
  886. */
  887. if (data->value)
  888. sdata->u.sta.flags |=
  889. IEEE80211_STA_PRIVACY_INVOKED;
  890. }
  891. break;
  892. case IW_AUTH_80211_AUTH_ALG:
  893. if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
  894. sdata->vif.type == IEEE80211_IF_TYPE_IBSS)
  895. sdata->u.sta.auth_algs = data->value;
  896. else
  897. ret = -EOPNOTSUPP;
  898. break;
  899. default:
  900. ret = -EOPNOTSUPP;
  901. break;
  902. }
  903. return ret;
  904. }
  905. /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
  906. static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev)
  907. {
  908. struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
  909. struct iw_statistics *wstats = &local->wstats;
  910. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  911. struct sta_info *sta = NULL;
  912. rcu_read_lock();
  913. if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
  914. sdata->vif.type == IEEE80211_IF_TYPE_IBSS)
  915. sta = sta_info_get(local, sdata->u.sta.bssid);
  916. if (!sta) {
  917. wstats->discard.fragment = 0;
  918. wstats->discard.misc = 0;
  919. wstats->qual.qual = 0;
  920. wstats->qual.level = 0;
  921. wstats->qual.noise = 0;
  922. wstats->qual.updated = IW_QUAL_ALL_INVALID;
  923. } else {
  924. wstats->qual.level = sta->last_signal;
  925. wstats->qual.qual = sta->last_qual;
  926. wstats->qual.noise = sta->last_noise;
  927. wstats->qual.updated = local->wstats_flags;
  928. }
  929. rcu_read_unlock();
  930. return wstats;
  931. }
  932. static int ieee80211_ioctl_giwauth(struct net_device *dev,
  933. struct iw_request_info *info,
  934. struct iw_param *data, char *extra)
  935. {
  936. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  937. int ret = 0;
  938. switch (data->flags & IW_AUTH_INDEX) {
  939. case IW_AUTH_80211_AUTH_ALG:
  940. if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
  941. sdata->vif.type == IEEE80211_IF_TYPE_IBSS)
  942. data->value = sdata->u.sta.auth_algs;
  943. else
  944. ret = -EOPNOTSUPP;
  945. break;
  946. default:
  947. ret = -EOPNOTSUPP;
  948. break;
  949. }
  950. return ret;
  951. }
  952. static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
  953. struct iw_request_info *info,
  954. struct iw_point *erq, char *extra)
  955. {
  956. struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  957. struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
  958. int uninitialized_var(alg), idx, i, remove = 0;
  959. switch (ext->alg) {
  960. case IW_ENCODE_ALG_NONE:
  961. remove = 1;
  962. break;
  963. case IW_ENCODE_ALG_WEP:
  964. alg = ALG_WEP;
  965. break;
  966. case IW_ENCODE_ALG_TKIP:
  967. alg = ALG_TKIP;
  968. break;
  969. case IW_ENCODE_ALG_CCMP:
  970. alg = ALG_CCMP;
  971. break;
  972. default:
  973. return -EOPNOTSUPP;
  974. }
  975. if (erq->flags & IW_ENCODE_DISABLED)
  976. remove = 1;
  977. idx = erq->flags & IW_ENCODE_INDEX;
  978. if (idx < 1 || idx > 4) {
  979. idx = -1;
  980. if (!sdata->default_key)
  981. idx = 0;
  982. else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
  983. if (sdata->default_key == sdata->keys[i]) {
  984. idx = i;
  985. break;
  986. }
  987. }
  988. if (idx < 0)
  989. return -EINVAL;
  990. } else
  991. idx--;
  992. return ieee80211_set_encryption(dev, ext->addr.sa_data, idx, alg,
  993. remove,
  994. ext->ext_flags &
  995. IW_ENCODE_EXT_SET_TX_KEY,
  996. ext->key, ext->key_len);
  997. }
  998. /* Structures to export the Wireless Handlers */
  999. static const iw_handler ieee80211_handler[] =
  1000. {
  1001. (iw_handler) NULL, /* SIOCSIWCOMMIT */
  1002. (iw_handler) ieee80211_ioctl_giwname, /* SIOCGIWNAME */
  1003. (iw_handler) NULL, /* SIOCSIWNWID */
  1004. (iw_handler) NULL, /* SIOCGIWNWID */
  1005. (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */
  1006. (iw_handler) ieee80211_ioctl_giwfreq, /* SIOCGIWFREQ */
  1007. (iw_handler) ieee80211_ioctl_siwmode, /* SIOCSIWMODE */
  1008. (iw_handler) ieee80211_ioctl_giwmode, /* SIOCGIWMODE */
  1009. (iw_handler) NULL, /* SIOCSIWSENS */
  1010. (iw_handler) NULL, /* SIOCGIWSENS */
  1011. (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */
  1012. (iw_handler) ieee80211_ioctl_giwrange, /* SIOCGIWRANGE */
  1013. (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */
  1014. (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */
  1015. (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */
  1016. (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */
  1017. (iw_handler) NULL, /* SIOCSIWSPY */
  1018. (iw_handler) NULL, /* SIOCGIWSPY */
  1019. (iw_handler) NULL, /* SIOCSIWTHRSPY */
  1020. (iw_handler) NULL, /* SIOCGIWTHRSPY */
  1021. (iw_handler) ieee80211_ioctl_siwap, /* SIOCSIWAP */
  1022. (iw_handler) ieee80211_ioctl_giwap, /* SIOCGIWAP */
  1023. (iw_handler) ieee80211_ioctl_siwmlme, /* SIOCSIWMLME */
  1024. (iw_handler) NULL, /* SIOCGIWAPLIST */
  1025. (iw_handler) ieee80211_ioctl_siwscan, /* SIOCSIWSCAN */
  1026. (iw_handler) ieee80211_ioctl_giwscan, /* SIOCGIWSCAN */
  1027. (iw_handler) ieee80211_ioctl_siwessid, /* SIOCSIWESSID */
  1028. (iw_handler) ieee80211_ioctl_giwessid, /* SIOCGIWESSID */
  1029. (iw_handler) NULL, /* SIOCSIWNICKN */
  1030. (iw_handler) NULL, /* SIOCGIWNICKN */
  1031. (iw_handler) NULL, /* -- hole -- */
  1032. (iw_handler) NULL, /* -- hole -- */
  1033. (iw_handler) ieee80211_ioctl_siwrate, /* SIOCSIWRATE */
  1034. (iw_handler) ieee80211_ioctl_giwrate, /* SIOCGIWRATE */
  1035. (iw_handler) ieee80211_ioctl_siwrts, /* SIOCSIWRTS */
  1036. (iw_handler) ieee80211_ioctl_giwrts, /* SIOCGIWRTS */
  1037. (iw_handler) ieee80211_ioctl_siwfrag, /* SIOCSIWFRAG */
  1038. (iw_handler) ieee80211_ioctl_giwfrag, /* SIOCGIWFRAG */
  1039. (iw_handler) ieee80211_ioctl_siwtxpower, /* SIOCSIWTXPOW */
  1040. (iw_handler) ieee80211_ioctl_giwtxpower, /* SIOCGIWTXPOW */
  1041. (iw_handler) ieee80211_ioctl_siwretry, /* SIOCSIWRETRY */
  1042. (iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */
  1043. (iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */
  1044. (iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */
  1045. (iw_handler) ieee80211_ioctl_siwpower, /* SIOCSIWPOWER */
  1046. (iw_handler) ieee80211_ioctl_giwpower, /* SIOCGIWPOWER */
  1047. (iw_handler) NULL, /* -- hole -- */
  1048. (iw_handler) NULL, /* -- hole -- */
  1049. (iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */
  1050. (iw_handler) NULL, /* SIOCGIWGENIE */
  1051. (iw_handler) ieee80211_ioctl_siwauth, /* SIOCSIWAUTH */
  1052. (iw_handler) ieee80211_ioctl_giwauth, /* SIOCGIWAUTH */
  1053. (iw_handler) ieee80211_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */
  1054. (iw_handler) NULL, /* SIOCGIWENCODEEXT */
  1055. (iw_handler) NULL, /* SIOCSIWPMKSA */
  1056. (iw_handler) NULL, /* -- hole -- */
  1057. };
  1058. const struct iw_handler_def ieee80211_iw_handler_def =
  1059. {
  1060. .num_standard = ARRAY_SIZE(ieee80211_handler),
  1061. .standard = (iw_handler *) ieee80211_handler,
  1062. .get_wireless_stats = ieee80211_get_wireless_stats,
  1063. };