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