2 * cfg80211 - wext compat code
4 * This is temporary code until all wireless functionality is migrated
5 * into cfg80211, when that happens all the exports here go away and
6 * we directly assign the wireless handlers of wireless interfaces.
8 * Copyright 2008-2009 Johannes Berg <johannes@sipsolutions.net>
11 #include <linux/export.h>
12 #include <linux/wireless.h>
13 #include <linux/nl80211.h>
14 #include <linux/if_arp.h>
15 #include <linux/etherdevice.h>
16 #include <linux/slab.h>
17 #include <net/iw_handler.h>
18 #include <net/cfg80211.h>
19 #include <net/cfg80211-wext.h>
20 #include "wext-compat.h"
24 int cfg80211_wext_giwname(struct net_device
*dev
,
25 struct iw_request_info
*info
,
26 char *name
, char *extra
)
28 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
29 struct ieee80211_supported_band
*sband
;
30 bool is_ht
= false, is_a
= false, is_b
= false, is_g
= false;
35 sband
= wdev
->wiphy
->bands
[IEEE80211_BAND_5GHZ
];
38 is_ht
|= sband
->ht_cap
.ht_supported
;
41 sband
= wdev
->wiphy
->bands
[IEEE80211_BAND_2GHZ
];
44 /* Check for mandatory rates */
45 for (i
= 0; i
< sband
->n_bitrates
; i
++) {
46 if (sband
->bitrates
[i
].bitrate
== 10)
48 if (sband
->bitrates
[i
].bitrate
== 60)
51 is_ht
|= sband
->ht_cap
.ht_supported
;
54 strcpy(name
, "IEEE 802.11");
66 EXPORT_SYMBOL_GPL(cfg80211_wext_giwname
);
68 int cfg80211_wext_siwmode(struct net_device
*dev
, struct iw_request_info
*info
,
69 u32
*mode
, char *extra
)
71 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
72 struct cfg80211_registered_device
*rdev
;
73 struct vif_params vifparams
;
74 enum nl80211_iftype type
;
77 rdev
= wiphy_to_dev(wdev
->wiphy
);
81 type
= NL80211_IFTYPE_STATION
;
84 type
= NL80211_IFTYPE_ADHOC
;
87 type
= NL80211_IFTYPE_WDS
;
90 type
= NL80211_IFTYPE_MONITOR
;
96 if (type
== wdev
->iftype
)
99 memset(&vifparams
, 0, sizeof(vifparams
));
101 cfg80211_lock_rdev(rdev
);
102 ret
= cfg80211_change_iface(rdev
, dev
, type
, NULL
, &vifparams
);
103 cfg80211_unlock_rdev(rdev
);
107 EXPORT_SYMBOL_GPL(cfg80211_wext_siwmode
);
109 int cfg80211_wext_giwmode(struct net_device
*dev
, struct iw_request_info
*info
,
110 u32
*mode
, char *extra
)
112 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
117 switch (wdev
->iftype
) {
118 case NL80211_IFTYPE_AP
:
119 *mode
= IW_MODE_MASTER
;
121 case NL80211_IFTYPE_STATION
:
122 *mode
= IW_MODE_INFRA
;
124 case NL80211_IFTYPE_ADHOC
:
125 *mode
= IW_MODE_ADHOC
;
127 case NL80211_IFTYPE_MONITOR
:
128 *mode
= IW_MODE_MONITOR
;
130 case NL80211_IFTYPE_WDS
:
131 *mode
= IW_MODE_REPEAT
;
133 case NL80211_IFTYPE_AP_VLAN
:
134 *mode
= IW_MODE_SECOND
; /* FIXME */
137 *mode
= IW_MODE_AUTO
;
142 EXPORT_SYMBOL_GPL(cfg80211_wext_giwmode
);
145 int cfg80211_wext_giwrange(struct net_device
*dev
,
146 struct iw_request_info
*info
,
147 struct iw_point
*data
, char *extra
)
149 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
150 struct iw_range
*range
= (struct iw_range
*) extra
;
151 enum ieee80211_band band
;
157 data
->length
= sizeof(struct iw_range
);
158 memset(range
, 0, sizeof(struct iw_range
));
160 range
->we_version_compiled
= WIRELESS_EXT
;
161 range
->we_version_source
= 21;
162 range
->retry_capa
= IW_RETRY_LIMIT
;
163 range
->retry_flags
= IW_RETRY_LIMIT
;
164 range
->min_retry
= 0;
165 range
->max_retry
= 255;
167 range
->max_rts
= 2347;
168 range
->min_frag
= 256;
169 range
->max_frag
= 2346;
171 range
->max_encoding_tokens
= 4;
173 range
->max_qual
.updated
= IW_QUAL_NOISE_INVALID
;
175 switch (wdev
->wiphy
->signal_type
) {
176 case CFG80211_SIGNAL_TYPE_NONE
:
178 case CFG80211_SIGNAL_TYPE_MBM
:
179 range
->max_qual
.level
= (u8
)-110;
180 range
->max_qual
.qual
= 70;
181 range
->avg_qual
.qual
= 35;
182 range
->max_qual
.updated
|= IW_QUAL_DBM
;
183 range
->max_qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
184 range
->max_qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
186 case CFG80211_SIGNAL_TYPE_UNSPEC
:
187 range
->max_qual
.level
= 100;
188 range
->max_qual
.qual
= 100;
189 range
->avg_qual
.qual
= 50;
190 range
->max_qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
191 range
->max_qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
195 range
->avg_qual
.level
= range
->max_qual
.level
/ 2;
196 range
->avg_qual
.noise
= range
->max_qual
.noise
/ 2;
197 range
->avg_qual
.updated
= range
->max_qual
.updated
;
199 for (i
= 0; i
< wdev
->wiphy
->n_cipher_suites
; i
++) {
200 switch (wdev
->wiphy
->cipher_suites
[i
]) {
201 case WLAN_CIPHER_SUITE_TKIP
:
202 range
->enc_capa
|= (IW_ENC_CAPA_CIPHER_TKIP
|
206 case WLAN_CIPHER_SUITE_CCMP
:
207 range
->enc_capa
|= (IW_ENC_CAPA_CIPHER_CCMP
|
211 case WLAN_CIPHER_SUITE_WEP40
:
212 range
->encoding_size
[range
->num_encoding_sizes
++] =
216 case WLAN_CIPHER_SUITE_WEP104
:
217 range
->encoding_size
[range
->num_encoding_sizes
++] =
223 for (band
= 0; band
< IEEE80211_NUM_BANDS
; band
++) {
224 struct ieee80211_supported_band
*sband
;
226 sband
= wdev
->wiphy
->bands
[band
];
231 for (i
= 0; i
< sband
->n_channels
&& c
< IW_MAX_FREQUENCIES
; i
++) {
232 struct ieee80211_channel
*chan
= &sband
->channels
[i
];
234 if (!(chan
->flags
& IEEE80211_CHAN_DISABLED
)) {
236 ieee80211_frequency_to_channel(
238 range
->freq
[c
].m
= chan
->center_freq
;
239 range
->freq
[c
].e
= 6;
244 range
->num_channels
= c
;
245 range
->num_frequency
= c
;
247 IW_EVENT_CAPA_SET_KERNEL(range
->event_capa
);
248 IW_EVENT_CAPA_SET(range
->event_capa
, SIOCGIWAP
);
249 IW_EVENT_CAPA_SET(range
->event_capa
, SIOCGIWSCAN
);
251 if (wdev
->wiphy
->max_scan_ssids
> 0)
252 range
->scan_capa
|= IW_SCAN_CAPA_ESSID
;
256 EXPORT_SYMBOL_GPL(cfg80211_wext_giwrange
);
260 * cfg80211_wext_freq - get wext frequency for non-"auto"
262 * @freq: the wext freq encoding
264 * Returns a frequency, or a negative error code, or 0 for auto.
266 int cfg80211_wext_freq(struct wiphy
*wiphy
, struct iw_freq
*freq
)
269 * Parse frequency - return 0 for auto and
270 * -EINVAL for impossible things.
273 enum ieee80211_band band
= IEEE80211_BAND_2GHZ
;
277 band
= IEEE80211_BAND_5GHZ
;
278 return ieee80211_channel_to_frequency(freq
->m
, band
);
280 int i
, div
= 1000000;
281 for (i
= 0; i
< freq
->e
; i
++)
285 return freq
->m
/ div
;
289 int cfg80211_wext_siwrts(struct net_device
*dev
,
290 struct iw_request_info
*info
,
291 struct iw_param
*rts
, char *extra
)
293 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
294 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
295 u32 orts
= wdev
->wiphy
->rts_threshold
;
298 if (rts
->disabled
|| !rts
->fixed
)
299 wdev
->wiphy
->rts_threshold
= (u32
) -1;
300 else if (rts
->value
< 0)
303 wdev
->wiphy
->rts_threshold
= rts
->value
;
305 err
= rdev_set_wiphy_params(rdev
, WIPHY_PARAM_RTS_THRESHOLD
);
307 wdev
->wiphy
->rts_threshold
= orts
;
311 EXPORT_SYMBOL_GPL(cfg80211_wext_siwrts
);
313 int cfg80211_wext_giwrts(struct net_device
*dev
,
314 struct iw_request_info
*info
,
315 struct iw_param
*rts
, char *extra
)
317 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
319 rts
->value
= wdev
->wiphy
->rts_threshold
;
320 rts
->disabled
= rts
->value
== (u32
) -1;
325 EXPORT_SYMBOL_GPL(cfg80211_wext_giwrts
);
327 int cfg80211_wext_siwfrag(struct net_device
*dev
,
328 struct iw_request_info
*info
,
329 struct iw_param
*frag
, char *extra
)
331 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
332 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
333 u32 ofrag
= wdev
->wiphy
->frag_threshold
;
336 if (frag
->disabled
|| !frag
->fixed
)
337 wdev
->wiphy
->frag_threshold
= (u32
) -1;
338 else if (frag
->value
< 256)
341 /* Fragment length must be even, so strip LSB. */
342 wdev
->wiphy
->frag_threshold
= frag
->value
& ~0x1;
345 err
= rdev_set_wiphy_params(rdev
, WIPHY_PARAM_FRAG_THRESHOLD
);
347 wdev
->wiphy
->frag_threshold
= ofrag
;
351 EXPORT_SYMBOL_GPL(cfg80211_wext_siwfrag
);
353 int cfg80211_wext_giwfrag(struct net_device
*dev
,
354 struct iw_request_info
*info
,
355 struct iw_param
*frag
, char *extra
)
357 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
359 frag
->value
= wdev
->wiphy
->frag_threshold
;
360 frag
->disabled
= frag
->value
== (u32
) -1;
365 EXPORT_SYMBOL_GPL(cfg80211_wext_giwfrag
);
367 static int cfg80211_wext_siwretry(struct net_device
*dev
,
368 struct iw_request_info
*info
,
369 struct iw_param
*retry
, char *extra
)
371 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
372 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
374 u8 olong
= wdev
->wiphy
->retry_long
;
375 u8 oshort
= wdev
->wiphy
->retry_short
;
378 if (retry
->disabled
||
379 (retry
->flags
& IW_RETRY_TYPE
) != IW_RETRY_LIMIT
)
382 if (retry
->flags
& IW_RETRY_LONG
) {
383 wdev
->wiphy
->retry_long
= retry
->value
;
384 changed
|= WIPHY_PARAM_RETRY_LONG
;
385 } else if (retry
->flags
& IW_RETRY_SHORT
) {
386 wdev
->wiphy
->retry_short
= retry
->value
;
387 changed
|= WIPHY_PARAM_RETRY_SHORT
;
389 wdev
->wiphy
->retry_short
= retry
->value
;
390 wdev
->wiphy
->retry_long
= retry
->value
;
391 changed
|= WIPHY_PARAM_RETRY_LONG
;
392 changed
|= WIPHY_PARAM_RETRY_SHORT
;
398 err
= rdev_set_wiphy_params(rdev
, changed
);
400 wdev
->wiphy
->retry_short
= oshort
;
401 wdev
->wiphy
->retry_long
= olong
;
407 int cfg80211_wext_giwretry(struct net_device
*dev
,
408 struct iw_request_info
*info
,
409 struct iw_param
*retry
, char *extra
)
411 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
415 if (retry
->flags
== 0 || (retry
->flags
& IW_RETRY_SHORT
)) {
417 * First return short value, iwconfig will ask long value
420 retry
->flags
|= IW_RETRY_LIMIT
;
421 retry
->value
= wdev
->wiphy
->retry_short
;
422 if (wdev
->wiphy
->retry_long
!= wdev
->wiphy
->retry_short
)
423 retry
->flags
|= IW_RETRY_LONG
;
428 if (retry
->flags
& IW_RETRY_LONG
) {
429 retry
->flags
= IW_RETRY_LIMIT
| IW_RETRY_LONG
;
430 retry
->value
= wdev
->wiphy
->retry_long
;
435 EXPORT_SYMBOL_GPL(cfg80211_wext_giwretry
);
437 static int __cfg80211_set_encryption(struct cfg80211_registered_device
*rdev
,
438 struct net_device
*dev
, bool pairwise
,
439 const u8
*addr
, bool remove
, bool tx_key
,
440 int idx
, struct key_params
*params
)
442 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
446 if (pairwise
&& !addr
)
449 if (!wdev
->wext
.keys
) {
450 wdev
->wext
.keys
= kzalloc(sizeof(*wdev
->wext
.keys
),
452 if (!wdev
->wext
.keys
)
454 for (i
= 0; i
< 6; i
++)
455 wdev
->wext
.keys
->params
[i
].key
=
456 wdev
->wext
.keys
->data
[i
];
459 if (wdev
->iftype
!= NL80211_IFTYPE_ADHOC
&&
460 wdev
->iftype
!= NL80211_IFTYPE_STATION
)
463 if (params
->cipher
== WLAN_CIPHER_SUITE_AES_CMAC
) {
464 if (!wdev
->current_bss
)
467 if (!rdev
->ops
->set_default_mgmt_key
)
470 if (idx
< 4 || idx
> 5)
472 } else if (idx
< 0 || idx
> 3)
477 if (wdev
->current_bss
) {
479 * If removing the current TX key, we will need to
480 * join a new IBSS without the privacy bit clear.
482 if (idx
== wdev
->wext
.default_key
&&
483 wdev
->iftype
== NL80211_IFTYPE_ADHOC
) {
484 __cfg80211_leave_ibss(rdev
, wdev
->netdev
, true);
488 if (!pairwise
&& addr
&&
489 !(rdev
->wiphy
.flags
& WIPHY_FLAG_IBSS_RSN
))
492 err
= rdev_del_key(rdev
, dev
, idx
, pairwise
,
495 wdev
->wext
.connect
.privacy
= false;
497 * Applications using wireless extensions expect to be
498 * able to delete keys that don't exist, so allow that.
504 wdev
->wext
.keys
->params
[idx
].key_len
= 0;
505 wdev
->wext
.keys
->params
[idx
].cipher
= 0;
507 if (idx
== wdev
->wext
.default_key
)
508 wdev
->wext
.default_key
= -1;
509 else if (idx
== wdev
->wext
.default_mgmt_key
)
510 wdev
->wext
.default_mgmt_key
= -1;
514 err
= cfg80211_ibss_wext_join(rdev
, wdev
);
522 if (cfg80211_validate_key_settings(rdev
, params
, idx
, pairwise
, addr
))
526 if (wdev
->current_bss
)
527 err
= rdev_add_key(rdev
, dev
, idx
, pairwise
, addr
, params
);
532 wdev
->wext
.keys
->params
[idx
] = *params
;
533 memcpy(wdev
->wext
.keys
->data
[idx
],
534 params
->key
, params
->key_len
);
535 wdev
->wext
.keys
->params
[idx
].key
=
536 wdev
->wext
.keys
->data
[idx
];
539 if ((params
->cipher
== WLAN_CIPHER_SUITE_WEP40
||
540 params
->cipher
== WLAN_CIPHER_SUITE_WEP104
) &&
541 (tx_key
|| (!addr
&& wdev
->wext
.default_key
== -1))) {
542 if (wdev
->current_bss
) {
544 * If we are getting a new TX key from not having
545 * had one before we need to join a new IBSS with
546 * the privacy bit set.
548 if (wdev
->iftype
== NL80211_IFTYPE_ADHOC
&&
549 wdev
->wext
.default_key
== -1) {
550 __cfg80211_leave_ibss(rdev
, wdev
->netdev
, true);
553 err
= rdev_set_default_key(rdev
, dev
, idx
, true, true);
556 wdev
->wext
.default_key
= idx
;
558 err
= cfg80211_ibss_wext_join(rdev
, wdev
);
563 if (params
->cipher
== WLAN_CIPHER_SUITE_AES_CMAC
&&
564 (tx_key
|| (!addr
&& wdev
->wext
.default_mgmt_key
== -1))) {
565 if (wdev
->current_bss
)
566 err
= rdev_set_default_mgmt_key(rdev
, dev
, idx
);
568 wdev
->wext
.default_mgmt_key
= idx
;
575 static int cfg80211_set_encryption(struct cfg80211_registered_device
*rdev
,
576 struct net_device
*dev
, bool pairwise
,
577 const u8
*addr
, bool remove
, bool tx_key
,
578 int idx
, struct key_params
*params
)
582 /* devlist mutex needed for possible IBSS re-join */
583 mutex_lock(&rdev
->devlist_mtx
);
584 wdev_lock(dev
->ieee80211_ptr
);
585 err
= __cfg80211_set_encryption(rdev
, dev
, pairwise
, addr
,
586 remove
, tx_key
, idx
, params
);
587 wdev_unlock(dev
->ieee80211_ptr
);
588 mutex_unlock(&rdev
->devlist_mtx
);
593 static int cfg80211_wext_siwencode(struct net_device
*dev
,
594 struct iw_request_info
*info
,
595 struct iw_point
*erq
, char *keybuf
)
597 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
598 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
601 struct key_params params
;
603 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
604 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
607 /* no use -- only MFP (set_default_mgmt_key) is optional */
608 if (!rdev
->ops
->del_key
||
609 !rdev
->ops
->add_key
||
610 !rdev
->ops
->set_default_key
)
613 idx
= erq
->flags
& IW_ENCODE_INDEX
;
615 idx
= wdev
->wext
.default_key
;
618 } else if (idx
< 1 || idx
> 4)
623 if (erq
->flags
& IW_ENCODE_DISABLED
)
625 else if (erq
->length
== 0) {
626 /* No key data - just set the default TX key index */
629 if (wdev
->current_bss
)
630 err
= rdev_set_default_key(rdev
, dev
, idx
, true,
633 wdev
->wext
.default_key
= idx
;
638 memset(¶ms
, 0, sizeof(params
));
640 params
.key_len
= erq
->length
;
641 if (erq
->length
== 5)
642 params
.cipher
= WLAN_CIPHER_SUITE_WEP40
;
643 else if (erq
->length
== 13)
644 params
.cipher
= WLAN_CIPHER_SUITE_WEP104
;
648 return cfg80211_set_encryption(rdev
, dev
, false, NULL
, remove
,
649 wdev
->wext
.default_key
== -1,
653 static int cfg80211_wext_siwencodeext(struct net_device
*dev
,
654 struct iw_request_info
*info
,
655 struct iw_point
*erq
, char *extra
)
657 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
658 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
659 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*) extra
;
663 struct key_params params
;
666 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
667 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
670 /* no use -- only MFP (set_default_mgmt_key) is optional */
671 if (!rdev
->ops
->del_key
||
672 !rdev
->ops
->add_key
||
673 !rdev
->ops
->set_default_key
)
677 case IW_ENCODE_ALG_NONE
:
681 case IW_ENCODE_ALG_WEP
:
682 if (ext
->key_len
== 5)
683 cipher
= WLAN_CIPHER_SUITE_WEP40
;
684 else if (ext
->key_len
== 13)
685 cipher
= WLAN_CIPHER_SUITE_WEP104
;
689 case IW_ENCODE_ALG_TKIP
:
690 cipher
= WLAN_CIPHER_SUITE_TKIP
;
692 case IW_ENCODE_ALG_CCMP
:
693 cipher
= WLAN_CIPHER_SUITE_CCMP
;
695 case IW_ENCODE_ALG_AES_CMAC
:
696 cipher
= WLAN_CIPHER_SUITE_AES_CMAC
;
702 if (erq
->flags
& IW_ENCODE_DISABLED
)
705 idx
= erq
->flags
& IW_ENCODE_INDEX
;
706 if (cipher
== WLAN_CIPHER_SUITE_AES_CMAC
) {
707 if (idx
< 4 || idx
> 5) {
708 idx
= wdev
->wext
.default_mgmt_key
;
714 if (idx
< 1 || idx
> 4) {
715 idx
= wdev
->wext
.default_key
;
722 addr
= ext
->addr
.sa_data
;
723 if (is_broadcast_ether_addr(addr
))
726 memset(¶ms
, 0, sizeof(params
));
727 params
.key
= ext
->key
;
728 params
.key_len
= ext
->key_len
;
729 params
.cipher
= cipher
;
731 if (ext
->ext_flags
& IW_ENCODE_EXT_RX_SEQ_VALID
) {
732 params
.seq
= ext
->rx_seq
;
736 return cfg80211_set_encryption(
738 !(ext
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
),
740 ext
->ext_flags
& IW_ENCODE_EXT_SET_TX_KEY
,
744 static int cfg80211_wext_giwencode(struct net_device
*dev
,
745 struct iw_request_info
*info
,
746 struct iw_point
*erq
, char *keybuf
)
748 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
751 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
752 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
755 idx
= erq
->flags
& IW_ENCODE_INDEX
;
757 idx
= wdev
->wext
.default_key
;
760 } else if (idx
< 1 || idx
> 4)
765 erq
->flags
= idx
+ 1;
767 if (!wdev
->wext
.keys
|| !wdev
->wext
.keys
->params
[idx
].cipher
) {
768 erq
->flags
|= IW_ENCODE_DISABLED
;
773 erq
->length
= min_t(size_t, erq
->length
,
774 wdev
->wext
.keys
->params
[idx
].key_len
);
775 memcpy(keybuf
, wdev
->wext
.keys
->params
[idx
].key
, erq
->length
);
776 erq
->flags
|= IW_ENCODE_ENABLED
;
781 static int cfg80211_wext_siwfreq(struct net_device
*dev
,
782 struct iw_request_info
*info
,
783 struct iw_freq
*wextfreq
, char *extra
)
785 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
786 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
787 struct cfg80211_chan_def chandef
= {
788 .width
= NL80211_CHAN_WIDTH_20_NOHT
,
792 switch (wdev
->iftype
) {
793 case NL80211_IFTYPE_STATION
:
794 return cfg80211_mgd_wext_siwfreq(dev
, info
, wextfreq
, extra
);
795 case NL80211_IFTYPE_ADHOC
:
796 return cfg80211_ibss_wext_siwfreq(dev
, info
, wextfreq
, extra
);
797 case NL80211_IFTYPE_MONITOR
:
798 freq
= cfg80211_wext_freq(wdev
->wiphy
, wextfreq
);
803 chandef
.center_freq1
= freq
;
804 chandef
.chan
= ieee80211_get_channel(&rdev
->wiphy
, freq
);
807 mutex_lock(&rdev
->devlist_mtx
);
808 err
= cfg80211_set_monitor_channel(rdev
, &chandef
);
809 mutex_unlock(&rdev
->devlist_mtx
);
811 case NL80211_IFTYPE_MESH_POINT
:
812 freq
= cfg80211_wext_freq(wdev
->wiphy
, wextfreq
);
817 chandef
.center_freq1
= freq
;
818 chandef
.chan
= ieee80211_get_channel(&rdev
->wiphy
, freq
);
821 mutex_lock(&rdev
->devlist_mtx
);
822 err
= cfg80211_set_mesh_channel(rdev
, wdev
, &chandef
);
823 mutex_unlock(&rdev
->devlist_mtx
);
830 static int cfg80211_wext_giwfreq(struct net_device
*dev
,
831 struct iw_request_info
*info
,
832 struct iw_freq
*freq
, char *extra
)
834 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
835 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
836 struct cfg80211_chan_def chandef
;
839 switch (wdev
->iftype
) {
840 case NL80211_IFTYPE_STATION
:
841 return cfg80211_mgd_wext_giwfreq(dev
, info
, freq
, extra
);
842 case NL80211_IFTYPE_ADHOC
:
843 return cfg80211_ibss_wext_giwfreq(dev
, info
, freq
, extra
);
844 case NL80211_IFTYPE_MONITOR
:
845 if (!rdev
->ops
->get_channel
)
848 ret
= rdev_get_channel(rdev
, wdev
, &chandef
);
851 freq
->m
= chandef
.chan
->center_freq
;
859 static int cfg80211_wext_siwtxpower(struct net_device
*dev
,
860 struct iw_request_info
*info
,
861 union iwreq_data
*data
, char *extra
)
863 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
864 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
865 enum nl80211_tx_power_setting type
;
868 if ((data
->txpower
.flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
)
870 if (data
->txpower
.flags
& IW_TXPOW_RANGE
)
873 if (!rdev
->ops
->set_tx_power
)
876 /* only change when not disabling */
877 if (!data
->txpower
.disabled
) {
878 rfkill_set_sw_state(rdev
->rfkill
, false);
880 if (data
->txpower
.fixed
) {
882 * wext doesn't support negative values, see
883 * below where it's for automatic
885 if (data
->txpower
.value
< 0)
887 dbm
= data
->txpower
.value
;
888 type
= NL80211_TX_POWER_FIXED
;
889 /* TODO: do regulatory check! */
892 * Automatic power level setting, max being the value
893 * passed in from userland.
895 if (data
->txpower
.value
< 0) {
896 type
= NL80211_TX_POWER_AUTOMATIC
;
898 dbm
= data
->txpower
.value
;
899 type
= NL80211_TX_POWER_LIMITED
;
903 rfkill_set_sw_state(rdev
->rfkill
, true);
904 schedule_work(&rdev
->rfkill_sync
);
908 return rdev_set_tx_power(rdev
, wdev
, type
, DBM_TO_MBM(dbm
));
911 static int cfg80211_wext_giwtxpower(struct net_device
*dev
,
912 struct iw_request_info
*info
,
913 union iwreq_data
*data
, char *extra
)
915 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
916 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
919 if ((data
->txpower
.flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
)
921 if (data
->txpower
.flags
& IW_TXPOW_RANGE
)
924 if (!rdev
->ops
->get_tx_power
)
927 err
= rdev_get_tx_power(rdev
, wdev
, &val
);
931 /* well... oh well */
932 data
->txpower
.fixed
= 1;
933 data
->txpower
.disabled
= rfkill_blocked(rdev
->rfkill
);
934 data
->txpower
.value
= val
;
935 data
->txpower
.flags
= IW_TXPOW_DBM
;
940 static int cfg80211_set_auth_alg(struct wireless_dev
*wdev
,
948 if (auth_alg
& ~(IW_AUTH_ALG_OPEN_SYSTEM
|
949 IW_AUTH_ALG_SHARED_KEY
|
953 if (auth_alg
& IW_AUTH_ALG_OPEN_SYSTEM
) {
955 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_OPEN_SYSTEM
;
958 if (auth_alg
& IW_AUTH_ALG_SHARED_KEY
) {
960 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_SHARED_KEY
;
963 if (auth_alg
& IW_AUTH_ALG_LEAP
) {
965 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_NETWORK_EAP
;
969 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_AUTOMATIC
;
974 static int cfg80211_set_wpa_version(struct wireless_dev
*wdev
, u32 wpa_versions
)
976 if (wpa_versions
& ~(IW_AUTH_WPA_VERSION_WPA
|
977 IW_AUTH_WPA_VERSION_WPA2
|
978 IW_AUTH_WPA_VERSION_DISABLED
))
981 if ((wpa_versions
& IW_AUTH_WPA_VERSION_DISABLED
) &&
982 (wpa_versions
& (IW_AUTH_WPA_VERSION_WPA
|
983 IW_AUTH_WPA_VERSION_WPA2
)))
986 if (wpa_versions
& IW_AUTH_WPA_VERSION_DISABLED
)
987 wdev
->wext
.connect
.crypto
.wpa_versions
&=
988 ~(NL80211_WPA_VERSION_1
|NL80211_WPA_VERSION_2
);
990 if (wpa_versions
& IW_AUTH_WPA_VERSION_WPA
)
991 wdev
->wext
.connect
.crypto
.wpa_versions
|=
992 NL80211_WPA_VERSION_1
;
994 if (wpa_versions
& IW_AUTH_WPA_VERSION_WPA2
)
995 wdev
->wext
.connect
.crypto
.wpa_versions
|=
996 NL80211_WPA_VERSION_2
;
1001 static int cfg80211_set_cipher_group(struct wireless_dev
*wdev
, u32 cipher
)
1003 if (cipher
& IW_AUTH_CIPHER_WEP40
)
1004 wdev
->wext
.connect
.crypto
.cipher_group
=
1005 WLAN_CIPHER_SUITE_WEP40
;
1006 else if (cipher
& IW_AUTH_CIPHER_WEP104
)
1007 wdev
->wext
.connect
.crypto
.cipher_group
=
1008 WLAN_CIPHER_SUITE_WEP104
;
1009 else if (cipher
& IW_AUTH_CIPHER_TKIP
)
1010 wdev
->wext
.connect
.crypto
.cipher_group
=
1011 WLAN_CIPHER_SUITE_TKIP
;
1012 else if (cipher
& IW_AUTH_CIPHER_CCMP
)
1013 wdev
->wext
.connect
.crypto
.cipher_group
=
1014 WLAN_CIPHER_SUITE_CCMP
;
1015 else if (cipher
& IW_AUTH_CIPHER_AES_CMAC
)
1016 wdev
->wext
.connect
.crypto
.cipher_group
=
1017 WLAN_CIPHER_SUITE_AES_CMAC
;
1018 else if (cipher
& IW_AUTH_CIPHER_NONE
)
1019 wdev
->wext
.connect
.crypto
.cipher_group
= 0;
1026 static int cfg80211_set_cipher_pairwise(struct wireless_dev
*wdev
, u32 cipher
)
1029 u32
*ciphers_pairwise
= wdev
->wext
.connect
.crypto
.ciphers_pairwise
;
1031 if (cipher
& IW_AUTH_CIPHER_WEP40
) {
1032 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_WEP40
;
1036 if (cipher
& IW_AUTH_CIPHER_WEP104
) {
1037 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_WEP104
;
1041 if (cipher
& IW_AUTH_CIPHER_TKIP
) {
1042 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_TKIP
;
1046 if (cipher
& IW_AUTH_CIPHER_CCMP
) {
1047 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_CCMP
;
1051 if (cipher
& IW_AUTH_CIPHER_AES_CMAC
) {
1052 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_AES_CMAC
;
1056 BUILD_BUG_ON(NL80211_MAX_NR_CIPHER_SUITES
< 5);
1058 wdev
->wext
.connect
.crypto
.n_ciphers_pairwise
= nr_ciphers
;
1064 static int cfg80211_set_key_mgt(struct wireless_dev
*wdev
, u32 key_mgt
)
1066 int nr_akm_suites
= 0;
1068 if (key_mgt
& ~(IW_AUTH_KEY_MGMT_802_1X
|
1069 IW_AUTH_KEY_MGMT_PSK
))
1072 if (key_mgt
& IW_AUTH_KEY_MGMT_802_1X
) {
1073 wdev
->wext
.connect
.crypto
.akm_suites
[nr_akm_suites
] =
1074 WLAN_AKM_SUITE_8021X
;
1078 if (key_mgt
& IW_AUTH_KEY_MGMT_PSK
) {
1079 wdev
->wext
.connect
.crypto
.akm_suites
[nr_akm_suites
] =
1084 wdev
->wext
.connect
.crypto
.n_akm_suites
= nr_akm_suites
;
1089 static int cfg80211_wext_siwauth(struct net_device
*dev
,
1090 struct iw_request_info
*info
,
1091 struct iw_param
*data
, char *extra
)
1093 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1095 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1098 switch (data
->flags
& IW_AUTH_INDEX
) {
1099 case IW_AUTH_PRIVACY_INVOKED
:
1100 wdev
->wext
.connect
.privacy
= data
->value
;
1102 case IW_AUTH_WPA_VERSION
:
1103 return cfg80211_set_wpa_version(wdev
, data
->value
);
1104 case IW_AUTH_CIPHER_GROUP
:
1105 return cfg80211_set_cipher_group(wdev
, data
->value
);
1106 case IW_AUTH_KEY_MGMT
:
1107 return cfg80211_set_key_mgt(wdev
, data
->value
);
1108 case IW_AUTH_CIPHER_PAIRWISE
:
1109 return cfg80211_set_cipher_pairwise(wdev
, data
->value
);
1110 case IW_AUTH_80211_AUTH_ALG
:
1111 return cfg80211_set_auth_alg(wdev
, data
->value
);
1112 case IW_AUTH_WPA_ENABLED
:
1113 case IW_AUTH_RX_UNENCRYPTED_EAPOL
:
1114 case IW_AUTH_DROP_UNENCRYPTED
:
1122 static int cfg80211_wext_giwauth(struct net_device
*dev
,
1123 struct iw_request_info
*info
,
1124 struct iw_param
*data
, char *extra
)
1126 /* XXX: what do we need? */
1131 static int cfg80211_wext_siwpower(struct net_device
*dev
,
1132 struct iw_request_info
*info
,
1133 struct iw_param
*wrq
, char *extra
)
1135 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1136 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1138 int timeout
= wdev
->ps_timeout
;
1141 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1144 if (!rdev
->ops
->set_power_mgmt
)
1147 if (wrq
->disabled
) {
1150 switch (wrq
->flags
& IW_POWER_MODE
) {
1151 case IW_POWER_ON
: /* If not specified */
1152 case IW_POWER_MODE
: /* If set all mask */
1153 case IW_POWER_ALL_R
: /* If explicitely state all */
1156 default: /* Otherwise we ignore */
1160 if (wrq
->flags
& ~(IW_POWER_MODE
| IW_POWER_TIMEOUT
))
1163 if (wrq
->flags
& IW_POWER_TIMEOUT
)
1164 timeout
= wrq
->value
/ 1000;
1167 err
= rdev_set_power_mgmt(rdev
, dev
, ps
, timeout
);
1172 wdev
->ps_timeout
= timeout
;
1178 static int cfg80211_wext_giwpower(struct net_device
*dev
,
1179 struct iw_request_info
*info
,
1180 struct iw_param
*wrq
, char *extra
)
1182 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1184 wrq
->disabled
= !wdev
->ps
;
1189 static int cfg80211_wds_wext_siwap(struct net_device
*dev
,
1190 struct iw_request_info
*info
,
1191 struct sockaddr
*addr
, char *extra
)
1193 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1194 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1197 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_WDS
))
1200 if (addr
->sa_family
!= ARPHRD_ETHER
)
1203 if (netif_running(dev
))
1206 if (!rdev
->ops
->set_wds_peer
)
1209 err
= rdev_set_wds_peer(rdev
, dev
, (u8
*)&addr
->sa_data
);
1213 memcpy(&wdev
->wext
.bssid
, (u8
*) &addr
->sa_data
, ETH_ALEN
);
1218 static int cfg80211_wds_wext_giwap(struct net_device
*dev
,
1219 struct iw_request_info
*info
,
1220 struct sockaddr
*addr
, char *extra
)
1222 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1224 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_WDS
))
1227 addr
->sa_family
= ARPHRD_ETHER
;
1228 memcpy(&addr
->sa_data
, wdev
->wext
.bssid
, ETH_ALEN
);
1233 static int cfg80211_wext_siwrate(struct net_device
*dev
,
1234 struct iw_request_info
*info
,
1235 struct iw_param
*rate
, char *extra
)
1237 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1238 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1239 struct cfg80211_bitrate_mask mask
;
1241 struct ieee80211_supported_band
*sband
;
1245 if (!rdev
->ops
->set_bitrate_mask
)
1248 memset(&mask
, 0, sizeof(mask
));
1252 if (rate
->value
< 0) {
1254 } else if (rate
->fixed
) {
1255 fixed
= rate
->value
/ 100000;
1257 maxrate
= rate
->value
/ 100000;
1260 for (band
= 0; band
< IEEE80211_NUM_BANDS
; band
++) {
1261 sband
= wdev
->wiphy
->bands
[band
];
1264 for (ridx
= 0; ridx
< sband
->n_bitrates
; ridx
++) {
1265 struct ieee80211_rate
*srate
= &sband
->bitrates
[ridx
];
1266 if (fixed
== srate
->bitrate
) {
1267 mask
.control
[band
].legacy
= 1 << ridx
;
1271 if (srate
->bitrate
<= maxrate
) {
1272 mask
.control
[band
].legacy
|= 1 << ridx
;
1281 return rdev_set_bitrate_mask(rdev
, dev
, NULL
, &mask
);
1284 static int cfg80211_wext_giwrate(struct net_device
*dev
,
1285 struct iw_request_info
*info
,
1286 struct iw_param
*rate
, char *extra
)
1288 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1289 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1290 /* we are under RTNL - globally locked - so can use a static struct */
1291 static struct station_info sinfo
;
1295 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1298 if (!rdev
->ops
->get_station
)
1303 if (wdev
->current_bss
)
1304 memcpy(addr
, wdev
->current_bss
->pub
.bssid
, ETH_ALEN
);
1311 err
= rdev_get_station(rdev
, dev
, addr
, &sinfo
);
1315 if (!(sinfo
.filled
& STATION_INFO_TX_BITRATE
))
1318 rate
->value
= 100000 * cfg80211_calculate_bitrate(&sinfo
.txrate
);
1323 /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
1324 static struct iw_statistics
*cfg80211_wireless_stats(struct net_device
*dev
)
1326 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1327 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1328 /* we are under RTNL - globally locked - so can use static structs */
1329 static struct iw_statistics wstats
;
1330 static struct station_info sinfo
;
1333 if (dev
->ieee80211_ptr
->iftype
!= NL80211_IFTYPE_STATION
)
1336 if (!rdev
->ops
->get_station
)
1339 /* Grab BSSID of current BSS, if any */
1341 if (!wdev
->current_bss
) {
1345 memcpy(bssid
, wdev
->current_bss
->pub
.bssid
, ETH_ALEN
);
1348 if (rdev_get_station(rdev
, dev
, bssid
, &sinfo
))
1351 memset(&wstats
, 0, sizeof(wstats
));
1353 switch (rdev
->wiphy
.signal_type
) {
1354 case CFG80211_SIGNAL_TYPE_MBM
:
1355 if (sinfo
.filled
& STATION_INFO_SIGNAL
) {
1356 int sig
= sinfo
.signal
;
1357 wstats
.qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
1358 wstats
.qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
1359 wstats
.qual
.updated
|= IW_QUAL_DBM
;
1360 wstats
.qual
.level
= sig
;
1365 wstats
.qual
.qual
= sig
+ 110;
1368 case CFG80211_SIGNAL_TYPE_UNSPEC
:
1369 if (sinfo
.filled
& STATION_INFO_SIGNAL
) {
1370 wstats
.qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
1371 wstats
.qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
1372 wstats
.qual
.level
= sinfo
.signal
;
1373 wstats
.qual
.qual
= sinfo
.signal
;
1377 wstats
.qual
.updated
|= IW_QUAL_LEVEL_INVALID
;
1378 wstats
.qual
.updated
|= IW_QUAL_QUAL_INVALID
;
1381 wstats
.qual
.updated
|= IW_QUAL_NOISE_INVALID
;
1382 if (sinfo
.filled
& STATION_INFO_RX_DROP_MISC
)
1383 wstats
.discard
.misc
= sinfo
.rx_dropped_misc
;
1384 if (sinfo
.filled
& STATION_INFO_TX_FAILED
)
1385 wstats
.discard
.retries
= sinfo
.tx_failed
;
1390 static int cfg80211_wext_siwap(struct net_device
*dev
,
1391 struct iw_request_info
*info
,
1392 struct sockaddr
*ap_addr
, char *extra
)
1394 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1396 switch (wdev
->iftype
) {
1397 case NL80211_IFTYPE_ADHOC
:
1398 return cfg80211_ibss_wext_siwap(dev
, info
, ap_addr
, extra
);
1399 case NL80211_IFTYPE_STATION
:
1400 return cfg80211_mgd_wext_siwap(dev
, info
, ap_addr
, extra
);
1401 case NL80211_IFTYPE_WDS
:
1402 return cfg80211_wds_wext_siwap(dev
, info
, ap_addr
, extra
);
1408 static int cfg80211_wext_giwap(struct net_device
*dev
,
1409 struct iw_request_info
*info
,
1410 struct sockaddr
*ap_addr
, char *extra
)
1412 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1414 switch (wdev
->iftype
) {
1415 case NL80211_IFTYPE_ADHOC
:
1416 return cfg80211_ibss_wext_giwap(dev
, info
, ap_addr
, extra
);
1417 case NL80211_IFTYPE_STATION
:
1418 return cfg80211_mgd_wext_giwap(dev
, info
, ap_addr
, extra
);
1419 case NL80211_IFTYPE_WDS
:
1420 return cfg80211_wds_wext_giwap(dev
, info
, ap_addr
, extra
);
1426 static int cfg80211_wext_siwessid(struct net_device
*dev
,
1427 struct iw_request_info
*info
,
1428 struct iw_point
*data
, char *ssid
)
1430 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1432 switch (wdev
->iftype
) {
1433 case NL80211_IFTYPE_ADHOC
:
1434 return cfg80211_ibss_wext_siwessid(dev
, info
, data
, ssid
);
1435 case NL80211_IFTYPE_STATION
:
1436 return cfg80211_mgd_wext_siwessid(dev
, info
, data
, ssid
);
1442 static int cfg80211_wext_giwessid(struct net_device
*dev
,
1443 struct iw_request_info
*info
,
1444 struct iw_point
*data
, char *ssid
)
1446 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1451 switch (wdev
->iftype
) {
1452 case NL80211_IFTYPE_ADHOC
:
1453 return cfg80211_ibss_wext_giwessid(dev
, info
, data
, ssid
);
1454 case NL80211_IFTYPE_STATION
:
1455 return cfg80211_mgd_wext_giwessid(dev
, info
, data
, ssid
);
1461 static int cfg80211_wext_siwpmksa(struct net_device
*dev
,
1462 struct iw_request_info
*info
,
1463 struct iw_point
*data
, char *extra
)
1465 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1466 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1467 struct cfg80211_pmksa cfg_pmksa
;
1468 struct iw_pmksa
*pmksa
= (struct iw_pmksa
*)extra
;
1470 memset(&cfg_pmksa
, 0, sizeof(struct cfg80211_pmksa
));
1472 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1475 cfg_pmksa
.bssid
= pmksa
->bssid
.sa_data
;
1476 cfg_pmksa
.pmkid
= pmksa
->pmkid
;
1478 switch (pmksa
->cmd
) {
1480 if (!rdev
->ops
->set_pmksa
)
1483 return rdev_set_pmksa(rdev
, dev
, &cfg_pmksa
);
1485 case IW_PMKSA_REMOVE
:
1486 if (!rdev
->ops
->del_pmksa
)
1489 return rdev_del_pmksa(rdev
, dev
, &cfg_pmksa
);
1491 case IW_PMKSA_FLUSH
:
1492 if (!rdev
->ops
->flush_pmksa
)
1495 return rdev_flush_pmksa(rdev
, dev
);
1502 static const iw_handler cfg80211_handlers
[] = {
1503 [IW_IOCTL_IDX(SIOCGIWNAME
)] = (iw_handler
) cfg80211_wext_giwname
,
1504 [IW_IOCTL_IDX(SIOCSIWFREQ
)] = (iw_handler
) cfg80211_wext_siwfreq
,
1505 [IW_IOCTL_IDX(SIOCGIWFREQ
)] = (iw_handler
) cfg80211_wext_giwfreq
,
1506 [IW_IOCTL_IDX(SIOCSIWMODE
)] = (iw_handler
) cfg80211_wext_siwmode
,
1507 [IW_IOCTL_IDX(SIOCGIWMODE
)] = (iw_handler
) cfg80211_wext_giwmode
,
1508 [IW_IOCTL_IDX(SIOCGIWRANGE
)] = (iw_handler
) cfg80211_wext_giwrange
,
1509 [IW_IOCTL_IDX(SIOCSIWAP
)] = (iw_handler
) cfg80211_wext_siwap
,
1510 [IW_IOCTL_IDX(SIOCGIWAP
)] = (iw_handler
) cfg80211_wext_giwap
,
1511 [IW_IOCTL_IDX(SIOCSIWMLME
)] = (iw_handler
) cfg80211_wext_siwmlme
,
1512 [IW_IOCTL_IDX(SIOCSIWSCAN
)] = (iw_handler
) cfg80211_wext_siwscan
,
1513 [IW_IOCTL_IDX(SIOCGIWSCAN
)] = (iw_handler
) cfg80211_wext_giwscan
,
1514 [IW_IOCTL_IDX(SIOCSIWESSID
)] = (iw_handler
) cfg80211_wext_siwessid
,
1515 [IW_IOCTL_IDX(SIOCGIWESSID
)] = (iw_handler
) cfg80211_wext_giwessid
,
1516 [IW_IOCTL_IDX(SIOCSIWRATE
)] = (iw_handler
) cfg80211_wext_siwrate
,
1517 [IW_IOCTL_IDX(SIOCGIWRATE
)] = (iw_handler
) cfg80211_wext_giwrate
,
1518 [IW_IOCTL_IDX(SIOCSIWRTS
)] = (iw_handler
) cfg80211_wext_siwrts
,
1519 [IW_IOCTL_IDX(SIOCGIWRTS
)] = (iw_handler
) cfg80211_wext_giwrts
,
1520 [IW_IOCTL_IDX(SIOCSIWFRAG
)] = (iw_handler
) cfg80211_wext_siwfrag
,
1521 [IW_IOCTL_IDX(SIOCGIWFRAG
)] = (iw_handler
) cfg80211_wext_giwfrag
,
1522 [IW_IOCTL_IDX(SIOCSIWTXPOW
)] = (iw_handler
) cfg80211_wext_siwtxpower
,
1523 [IW_IOCTL_IDX(SIOCGIWTXPOW
)] = (iw_handler
) cfg80211_wext_giwtxpower
,
1524 [IW_IOCTL_IDX(SIOCSIWRETRY
)] = (iw_handler
) cfg80211_wext_siwretry
,
1525 [IW_IOCTL_IDX(SIOCGIWRETRY
)] = (iw_handler
) cfg80211_wext_giwretry
,
1526 [IW_IOCTL_IDX(SIOCSIWENCODE
)] = (iw_handler
) cfg80211_wext_siwencode
,
1527 [IW_IOCTL_IDX(SIOCGIWENCODE
)] = (iw_handler
) cfg80211_wext_giwencode
,
1528 [IW_IOCTL_IDX(SIOCSIWPOWER
)] = (iw_handler
) cfg80211_wext_siwpower
,
1529 [IW_IOCTL_IDX(SIOCGIWPOWER
)] = (iw_handler
) cfg80211_wext_giwpower
,
1530 [IW_IOCTL_IDX(SIOCSIWGENIE
)] = (iw_handler
) cfg80211_wext_siwgenie
,
1531 [IW_IOCTL_IDX(SIOCSIWAUTH
)] = (iw_handler
) cfg80211_wext_siwauth
,
1532 [IW_IOCTL_IDX(SIOCGIWAUTH
)] = (iw_handler
) cfg80211_wext_giwauth
,
1533 [IW_IOCTL_IDX(SIOCSIWENCODEEXT
)]= (iw_handler
) cfg80211_wext_siwencodeext
,
1534 [IW_IOCTL_IDX(SIOCSIWPMKSA
)] = (iw_handler
) cfg80211_wext_siwpmksa
,
1537 const struct iw_handler_def cfg80211_wext_handler
= {
1538 .num_standard
= ARRAY_SIZE(cfg80211_handlers
),
1539 .standard
= cfg80211_handlers
,
1540 .get_wireless_stats
= cfg80211_wireless_stats
,