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/wireless.h>
12 #include <linux/nl80211.h>
13 #include <linux/if_arp.h>
14 #include <linux/etherdevice.h>
15 #include <linux/slab.h>
16 #include <net/iw_handler.h>
17 #include <net/cfg80211.h>
18 #include <net/cfg80211-wext.h>
19 #include "wext-compat.h"
22 int cfg80211_wext_giwname(struct net_device
*dev
,
23 struct iw_request_info
*info
,
24 char *name
, char *extra
)
26 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
27 struct ieee80211_supported_band
*sband
;
28 bool is_ht
= false, is_a
= false, is_b
= false, is_g
= false;
33 sband
= wdev
->wiphy
->bands
[IEEE80211_BAND_5GHZ
];
36 is_ht
|= sband
->ht_cap
.ht_supported
;
39 sband
= wdev
->wiphy
->bands
[IEEE80211_BAND_2GHZ
];
42 /* Check for mandatory rates */
43 for (i
= 0; i
< sband
->n_bitrates
; i
++) {
44 if (sband
->bitrates
[i
].bitrate
== 10)
46 if (sband
->bitrates
[i
].bitrate
== 60)
49 is_ht
|= sband
->ht_cap
.ht_supported
;
52 strcpy(name
, "IEEE 802.11");
64 EXPORT_SYMBOL_GPL(cfg80211_wext_giwname
);
66 int cfg80211_wext_siwmode(struct net_device
*dev
, struct iw_request_info
*info
,
67 u32
*mode
, char *extra
)
69 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
70 struct cfg80211_registered_device
*rdev
;
71 struct vif_params vifparams
;
72 enum nl80211_iftype type
;
75 rdev
= wiphy_to_dev(wdev
->wiphy
);
79 type
= NL80211_IFTYPE_STATION
;
82 type
= NL80211_IFTYPE_ADHOC
;
85 type
= NL80211_IFTYPE_WDS
;
88 type
= NL80211_IFTYPE_MONITOR
;
94 if (type
== wdev
->iftype
)
97 memset(&vifparams
, 0, sizeof(vifparams
));
99 cfg80211_lock_rdev(rdev
);
100 ret
= cfg80211_change_iface(rdev
, dev
, type
, NULL
, &vifparams
);
101 cfg80211_unlock_rdev(rdev
);
105 EXPORT_SYMBOL_GPL(cfg80211_wext_siwmode
);
107 int cfg80211_wext_giwmode(struct net_device
*dev
, struct iw_request_info
*info
,
108 u32
*mode
, char *extra
)
110 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
115 switch (wdev
->iftype
) {
116 case NL80211_IFTYPE_AP
:
117 *mode
= IW_MODE_MASTER
;
119 case NL80211_IFTYPE_STATION
:
120 *mode
= IW_MODE_INFRA
;
122 case NL80211_IFTYPE_ADHOC
:
123 *mode
= IW_MODE_ADHOC
;
125 case NL80211_IFTYPE_MONITOR
:
126 *mode
= IW_MODE_MONITOR
;
128 case NL80211_IFTYPE_WDS
:
129 *mode
= IW_MODE_REPEAT
;
131 case NL80211_IFTYPE_AP_VLAN
:
132 *mode
= IW_MODE_SECOND
; /* FIXME */
135 *mode
= IW_MODE_AUTO
;
140 EXPORT_SYMBOL_GPL(cfg80211_wext_giwmode
);
143 int cfg80211_wext_giwrange(struct net_device
*dev
,
144 struct iw_request_info
*info
,
145 struct iw_point
*data
, char *extra
)
147 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
148 struct iw_range
*range
= (struct iw_range
*) extra
;
149 enum ieee80211_band band
;
155 data
->length
= sizeof(struct iw_range
);
156 memset(range
, 0, sizeof(struct iw_range
));
158 range
->we_version_compiled
= WIRELESS_EXT
;
159 range
->we_version_source
= 21;
160 range
->retry_capa
= IW_RETRY_LIMIT
;
161 range
->retry_flags
= IW_RETRY_LIMIT
;
162 range
->min_retry
= 0;
163 range
->max_retry
= 255;
165 range
->max_rts
= 2347;
166 range
->min_frag
= 256;
167 range
->max_frag
= 2346;
169 range
->max_encoding_tokens
= 4;
171 range
->max_qual
.updated
= IW_QUAL_NOISE_INVALID
;
173 switch (wdev
->wiphy
->signal_type
) {
174 case CFG80211_SIGNAL_TYPE_NONE
:
176 case CFG80211_SIGNAL_TYPE_MBM
:
177 range
->max_qual
.level
= -110;
178 range
->max_qual
.qual
= 70;
179 range
->avg_qual
.qual
= 35;
180 range
->max_qual
.updated
|= IW_QUAL_DBM
;
181 range
->max_qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
182 range
->max_qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
184 case CFG80211_SIGNAL_TYPE_UNSPEC
:
185 range
->max_qual
.level
= 100;
186 range
->max_qual
.qual
= 100;
187 range
->avg_qual
.qual
= 50;
188 range
->max_qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
189 range
->max_qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
193 range
->avg_qual
.level
= range
->max_qual
.level
/ 2;
194 range
->avg_qual
.noise
= range
->max_qual
.noise
/ 2;
195 range
->avg_qual
.updated
= range
->max_qual
.updated
;
197 for (i
= 0; i
< wdev
->wiphy
->n_cipher_suites
; i
++) {
198 switch (wdev
->wiphy
->cipher_suites
[i
]) {
199 case WLAN_CIPHER_SUITE_TKIP
:
200 range
->enc_capa
|= (IW_ENC_CAPA_CIPHER_TKIP
|
204 case WLAN_CIPHER_SUITE_CCMP
:
205 range
->enc_capa
|= (IW_ENC_CAPA_CIPHER_CCMP
|
209 case WLAN_CIPHER_SUITE_WEP40
:
210 range
->encoding_size
[range
->num_encoding_sizes
++] =
214 case WLAN_CIPHER_SUITE_WEP104
:
215 range
->encoding_size
[range
->num_encoding_sizes
++] =
221 for (band
= 0; band
< IEEE80211_NUM_BANDS
; band
++) {
222 struct ieee80211_supported_band
*sband
;
224 sband
= wdev
->wiphy
->bands
[band
];
229 for (i
= 0; i
< sband
->n_channels
&& c
< IW_MAX_FREQUENCIES
; i
++) {
230 struct ieee80211_channel
*chan
= &sband
->channels
[i
];
232 if (!(chan
->flags
& IEEE80211_CHAN_DISABLED
)) {
234 ieee80211_frequency_to_channel(
236 range
->freq
[c
].m
= chan
->center_freq
;
237 range
->freq
[c
].e
= 6;
242 range
->num_channels
= c
;
243 range
->num_frequency
= c
;
245 IW_EVENT_CAPA_SET_KERNEL(range
->event_capa
);
246 IW_EVENT_CAPA_SET(range
->event_capa
, SIOCGIWAP
);
247 IW_EVENT_CAPA_SET(range
->event_capa
, SIOCGIWSCAN
);
249 if (wdev
->wiphy
->max_scan_ssids
> 0)
250 range
->scan_capa
|= IW_SCAN_CAPA_ESSID
;
254 EXPORT_SYMBOL_GPL(cfg80211_wext_giwrange
);
258 * cfg80211_wext_freq - get wext frequency for non-"auto"
260 * @freq: the wext freq encoding
262 * Returns a frequency, or a negative error code, or 0 for auto.
264 int cfg80211_wext_freq(struct wiphy
*wiphy
, struct iw_freq
*freq
)
267 * Parse frequency - return 0 for auto and
268 * -EINVAL for impossible things.
271 enum ieee80211_band band
= IEEE80211_BAND_2GHZ
;
275 band
= IEEE80211_BAND_5GHZ
;
276 return ieee80211_channel_to_frequency(freq
->m
, band
);
278 int i
, div
= 1000000;
279 for (i
= 0; i
< freq
->e
; i
++)
283 return freq
->m
/ div
;
287 int cfg80211_wext_siwrts(struct net_device
*dev
,
288 struct iw_request_info
*info
,
289 struct iw_param
*rts
, char *extra
)
291 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
292 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
293 u32 orts
= wdev
->wiphy
->rts_threshold
;
296 if (rts
->disabled
|| !rts
->fixed
)
297 wdev
->wiphy
->rts_threshold
= (u32
) -1;
298 else if (rts
->value
< 0)
301 wdev
->wiphy
->rts_threshold
= rts
->value
;
303 err
= rdev
->ops
->set_wiphy_params(wdev
->wiphy
,
304 WIPHY_PARAM_RTS_THRESHOLD
);
306 wdev
->wiphy
->rts_threshold
= orts
;
310 EXPORT_SYMBOL_GPL(cfg80211_wext_siwrts
);
312 int cfg80211_wext_giwrts(struct net_device
*dev
,
313 struct iw_request_info
*info
,
314 struct iw_param
*rts
, char *extra
)
316 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
318 rts
->value
= wdev
->wiphy
->rts_threshold
;
319 rts
->disabled
= rts
->value
== (u32
) -1;
324 EXPORT_SYMBOL_GPL(cfg80211_wext_giwrts
);
326 int cfg80211_wext_siwfrag(struct net_device
*dev
,
327 struct iw_request_info
*info
,
328 struct iw_param
*frag
, char *extra
)
330 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
331 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
332 u32 ofrag
= wdev
->wiphy
->frag_threshold
;
335 if (frag
->disabled
|| !frag
->fixed
)
336 wdev
->wiphy
->frag_threshold
= (u32
) -1;
337 else if (frag
->value
< 256)
340 /* Fragment length must be even, so strip LSB. */
341 wdev
->wiphy
->frag_threshold
= frag
->value
& ~0x1;
344 err
= rdev
->ops
->set_wiphy_params(wdev
->wiphy
,
345 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
->ops
->set_wiphy_params(wdev
->wiphy
, 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
->ops
->del_key(&rdev
->wiphy
, dev
, idx
,
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
->ops
->add_key(&rdev
->wiphy
, dev
, idx
,
528 pairwise
, addr
, params
);
533 wdev
->wext
.keys
->params
[idx
] = *params
;
534 memcpy(wdev
->wext
.keys
->data
[idx
],
535 params
->key
, params
->key_len
);
536 wdev
->wext
.keys
->params
[idx
].key
=
537 wdev
->wext
.keys
->data
[idx
];
540 if ((params
->cipher
== WLAN_CIPHER_SUITE_WEP40
||
541 params
->cipher
== WLAN_CIPHER_SUITE_WEP104
) &&
542 (tx_key
|| (!addr
&& wdev
->wext
.default_key
== -1))) {
543 if (wdev
->current_bss
) {
545 * If we are getting a new TX key from not having
546 * had one before we need to join a new IBSS with
547 * the privacy bit set.
549 if (wdev
->iftype
== NL80211_IFTYPE_ADHOC
&&
550 wdev
->wext
.default_key
== -1) {
551 __cfg80211_leave_ibss(rdev
, wdev
->netdev
, true);
554 err
= rdev
->ops
->set_default_key(&rdev
->wiphy
, dev
,
558 wdev
->wext
.default_key
= idx
;
560 err
= cfg80211_ibss_wext_join(rdev
, wdev
);
565 if (params
->cipher
== WLAN_CIPHER_SUITE_AES_CMAC
&&
566 (tx_key
|| (!addr
&& wdev
->wext
.default_mgmt_key
== -1))) {
567 if (wdev
->current_bss
)
568 err
= rdev
->ops
->set_default_mgmt_key(&rdev
->wiphy
,
571 wdev
->wext
.default_mgmt_key
= idx
;
578 static int cfg80211_set_encryption(struct cfg80211_registered_device
*rdev
,
579 struct net_device
*dev
, bool pairwise
,
580 const u8
*addr
, bool remove
, bool tx_key
,
581 int idx
, struct key_params
*params
)
585 /* devlist mutex needed for possible IBSS re-join */
586 mutex_lock(&rdev
->devlist_mtx
);
587 wdev_lock(dev
->ieee80211_ptr
);
588 err
= __cfg80211_set_encryption(rdev
, dev
, pairwise
, addr
,
589 remove
, tx_key
, idx
, params
);
590 wdev_unlock(dev
->ieee80211_ptr
);
591 mutex_unlock(&rdev
->devlist_mtx
);
596 static int cfg80211_wext_siwencode(struct net_device
*dev
,
597 struct iw_request_info
*info
,
598 struct iw_point
*erq
, char *keybuf
)
600 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
601 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
604 struct key_params params
;
606 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
607 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
610 /* no use -- only MFP (set_default_mgmt_key) is optional */
611 if (!rdev
->ops
->del_key
||
612 !rdev
->ops
->add_key
||
613 !rdev
->ops
->set_default_key
)
616 idx
= erq
->flags
& IW_ENCODE_INDEX
;
618 idx
= wdev
->wext
.default_key
;
621 } else if (idx
< 1 || idx
> 4)
626 if (erq
->flags
& IW_ENCODE_DISABLED
)
628 else if (erq
->length
== 0) {
629 /* No key data - just set the default TX key index */
632 if (wdev
->current_bss
)
633 err
= rdev
->ops
->set_default_key(&rdev
->wiphy
, dev
,
636 wdev
->wext
.default_key
= idx
;
641 memset(¶ms
, 0, sizeof(params
));
643 params
.key_len
= erq
->length
;
644 if (erq
->length
== 5)
645 params
.cipher
= WLAN_CIPHER_SUITE_WEP40
;
646 else if (erq
->length
== 13)
647 params
.cipher
= WLAN_CIPHER_SUITE_WEP104
;
651 return cfg80211_set_encryption(rdev
, dev
, false, NULL
, remove
,
652 wdev
->wext
.default_key
== -1,
656 static int cfg80211_wext_siwencodeext(struct net_device
*dev
,
657 struct iw_request_info
*info
,
658 struct iw_point
*erq
, char *extra
)
660 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
661 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
662 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*) extra
;
666 struct key_params params
;
669 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
670 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
673 /* no use -- only MFP (set_default_mgmt_key) is optional */
674 if (!rdev
->ops
->del_key
||
675 !rdev
->ops
->add_key
||
676 !rdev
->ops
->set_default_key
)
680 case IW_ENCODE_ALG_NONE
:
684 case IW_ENCODE_ALG_WEP
:
685 if (ext
->key_len
== 5)
686 cipher
= WLAN_CIPHER_SUITE_WEP40
;
687 else if (ext
->key_len
== 13)
688 cipher
= WLAN_CIPHER_SUITE_WEP104
;
692 case IW_ENCODE_ALG_TKIP
:
693 cipher
= WLAN_CIPHER_SUITE_TKIP
;
695 case IW_ENCODE_ALG_CCMP
:
696 cipher
= WLAN_CIPHER_SUITE_CCMP
;
698 case IW_ENCODE_ALG_AES_CMAC
:
699 cipher
= WLAN_CIPHER_SUITE_AES_CMAC
;
705 if (erq
->flags
& IW_ENCODE_DISABLED
)
708 idx
= erq
->flags
& IW_ENCODE_INDEX
;
709 if (cipher
== WLAN_CIPHER_SUITE_AES_CMAC
) {
710 if (idx
< 4 || idx
> 5) {
711 idx
= wdev
->wext
.default_mgmt_key
;
717 if (idx
< 1 || idx
> 4) {
718 idx
= wdev
->wext
.default_key
;
725 addr
= ext
->addr
.sa_data
;
726 if (is_broadcast_ether_addr(addr
))
729 memset(¶ms
, 0, sizeof(params
));
730 params
.key
= ext
->key
;
731 params
.key_len
= ext
->key_len
;
732 params
.cipher
= cipher
;
734 if (ext
->ext_flags
& IW_ENCODE_EXT_RX_SEQ_VALID
) {
735 params
.seq
= ext
->rx_seq
;
739 return cfg80211_set_encryption(
741 !(ext
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
),
743 ext
->ext_flags
& IW_ENCODE_EXT_SET_TX_KEY
,
747 static int cfg80211_wext_giwencode(struct net_device
*dev
,
748 struct iw_request_info
*info
,
749 struct iw_point
*erq
, char *keybuf
)
751 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
754 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
755 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
758 idx
= erq
->flags
& IW_ENCODE_INDEX
;
760 idx
= wdev
->wext
.default_key
;
763 } else if (idx
< 1 || idx
> 4)
768 erq
->flags
= idx
+ 1;
770 if (!wdev
->wext
.keys
|| !wdev
->wext
.keys
->params
[idx
].cipher
) {
771 erq
->flags
|= IW_ENCODE_DISABLED
;
776 erq
->length
= min_t(size_t, erq
->length
,
777 wdev
->wext
.keys
->params
[idx
].key_len
);
778 memcpy(keybuf
, wdev
->wext
.keys
->params
[idx
].key
, erq
->length
);
779 erq
->flags
|= IW_ENCODE_ENABLED
;
784 static int cfg80211_wext_siwfreq(struct net_device
*dev
,
785 struct iw_request_info
*info
,
786 struct iw_freq
*wextfreq
, char *extra
)
788 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
789 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
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 case NL80211_IFTYPE_WDS
:
799 case NL80211_IFTYPE_MESH_POINT
:
800 freq
= cfg80211_wext_freq(wdev
->wiphy
, wextfreq
);
805 mutex_lock(&rdev
->devlist_mtx
);
807 err
= cfg80211_set_freq(rdev
, wdev
, freq
, NL80211_CHAN_NO_HT
);
809 mutex_unlock(&rdev
->devlist_mtx
);
816 static int cfg80211_wext_giwfreq(struct net_device
*dev
,
817 struct iw_request_info
*info
,
818 struct iw_freq
*freq
, char *extra
)
820 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
822 switch (wdev
->iftype
) {
823 case NL80211_IFTYPE_STATION
:
824 return cfg80211_mgd_wext_giwfreq(dev
, info
, freq
, extra
);
825 case NL80211_IFTYPE_ADHOC
:
826 return cfg80211_ibss_wext_giwfreq(dev
, info
, freq
, extra
);
830 freq
->m
= wdev
->channel
->center_freq
;
836 static int cfg80211_wext_siwtxpower(struct net_device
*dev
,
837 struct iw_request_info
*info
,
838 union iwreq_data
*data
, char *extra
)
840 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
841 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
842 enum nl80211_tx_power_setting type
;
845 if ((data
->txpower
.flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
)
847 if (data
->txpower
.flags
& IW_TXPOW_RANGE
)
850 if (!rdev
->ops
->set_tx_power
)
853 /* only change when not disabling */
854 if (!data
->txpower
.disabled
) {
855 rfkill_set_sw_state(rdev
->rfkill
, false);
857 if (data
->txpower
.fixed
) {
859 * wext doesn't support negative values, see
860 * below where it's for automatic
862 if (data
->txpower
.value
< 0)
864 dbm
= data
->txpower
.value
;
865 type
= NL80211_TX_POWER_FIXED
;
866 /* TODO: do regulatory check! */
869 * Automatic power level setting, max being the value
870 * passed in from userland.
872 if (data
->txpower
.value
< 0) {
873 type
= NL80211_TX_POWER_AUTOMATIC
;
875 dbm
= data
->txpower
.value
;
876 type
= NL80211_TX_POWER_LIMITED
;
880 rfkill_set_sw_state(rdev
->rfkill
, true);
881 schedule_work(&rdev
->rfkill_sync
);
885 return rdev
->ops
->set_tx_power(wdev
->wiphy
, type
, DBM_TO_MBM(dbm
));
888 static int cfg80211_wext_giwtxpower(struct net_device
*dev
,
889 struct iw_request_info
*info
,
890 union iwreq_data
*data
, char *extra
)
892 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
893 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
896 if ((data
->txpower
.flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
)
898 if (data
->txpower
.flags
& IW_TXPOW_RANGE
)
901 if (!rdev
->ops
->get_tx_power
)
904 err
= rdev
->ops
->get_tx_power(wdev
->wiphy
, &val
);
908 /* well... oh well */
909 data
->txpower
.fixed
= 1;
910 data
->txpower
.disabled
= rfkill_blocked(rdev
->rfkill
);
911 data
->txpower
.value
= val
;
912 data
->txpower
.flags
= IW_TXPOW_DBM
;
917 static int cfg80211_set_auth_alg(struct wireless_dev
*wdev
,
925 if (auth_alg
& ~(IW_AUTH_ALG_OPEN_SYSTEM
|
926 IW_AUTH_ALG_SHARED_KEY
|
930 if (auth_alg
& IW_AUTH_ALG_OPEN_SYSTEM
) {
932 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_OPEN_SYSTEM
;
935 if (auth_alg
& IW_AUTH_ALG_SHARED_KEY
) {
937 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_SHARED_KEY
;
940 if (auth_alg
& IW_AUTH_ALG_LEAP
) {
942 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_NETWORK_EAP
;
946 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_AUTOMATIC
;
951 static int cfg80211_set_wpa_version(struct wireless_dev
*wdev
, u32 wpa_versions
)
953 if (wpa_versions
& ~(IW_AUTH_WPA_VERSION_WPA
|
954 IW_AUTH_WPA_VERSION_WPA2
|
955 IW_AUTH_WPA_VERSION_DISABLED
))
958 if ((wpa_versions
& IW_AUTH_WPA_VERSION_DISABLED
) &&
959 (wpa_versions
& (IW_AUTH_WPA_VERSION_WPA
|
960 IW_AUTH_WPA_VERSION_WPA2
)))
963 if (wpa_versions
& IW_AUTH_WPA_VERSION_DISABLED
)
964 wdev
->wext
.connect
.crypto
.wpa_versions
&=
965 ~(NL80211_WPA_VERSION_1
|NL80211_WPA_VERSION_2
);
967 if (wpa_versions
& IW_AUTH_WPA_VERSION_WPA
)
968 wdev
->wext
.connect
.crypto
.wpa_versions
|=
969 NL80211_WPA_VERSION_1
;
971 if (wpa_versions
& IW_AUTH_WPA_VERSION_WPA2
)
972 wdev
->wext
.connect
.crypto
.wpa_versions
|=
973 NL80211_WPA_VERSION_2
;
978 static int cfg80211_set_cipher_group(struct wireless_dev
*wdev
, u32 cipher
)
980 if (cipher
& IW_AUTH_CIPHER_WEP40
)
981 wdev
->wext
.connect
.crypto
.cipher_group
=
982 WLAN_CIPHER_SUITE_WEP40
;
983 else if (cipher
& IW_AUTH_CIPHER_WEP104
)
984 wdev
->wext
.connect
.crypto
.cipher_group
=
985 WLAN_CIPHER_SUITE_WEP104
;
986 else if (cipher
& IW_AUTH_CIPHER_TKIP
)
987 wdev
->wext
.connect
.crypto
.cipher_group
=
988 WLAN_CIPHER_SUITE_TKIP
;
989 else if (cipher
& IW_AUTH_CIPHER_CCMP
)
990 wdev
->wext
.connect
.crypto
.cipher_group
=
991 WLAN_CIPHER_SUITE_CCMP
;
992 else if (cipher
& IW_AUTH_CIPHER_AES_CMAC
)
993 wdev
->wext
.connect
.crypto
.cipher_group
=
994 WLAN_CIPHER_SUITE_AES_CMAC
;
995 else if (cipher
& IW_AUTH_CIPHER_NONE
)
996 wdev
->wext
.connect
.crypto
.cipher_group
= 0;
1003 static int cfg80211_set_cipher_pairwise(struct wireless_dev
*wdev
, u32 cipher
)
1006 u32
*ciphers_pairwise
= wdev
->wext
.connect
.crypto
.ciphers_pairwise
;
1008 if (cipher
& IW_AUTH_CIPHER_WEP40
) {
1009 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_WEP40
;
1013 if (cipher
& IW_AUTH_CIPHER_WEP104
) {
1014 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_WEP104
;
1018 if (cipher
& IW_AUTH_CIPHER_TKIP
) {
1019 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_TKIP
;
1023 if (cipher
& IW_AUTH_CIPHER_CCMP
) {
1024 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_CCMP
;
1028 if (cipher
& IW_AUTH_CIPHER_AES_CMAC
) {
1029 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_AES_CMAC
;
1033 BUILD_BUG_ON(NL80211_MAX_NR_CIPHER_SUITES
< 5);
1035 wdev
->wext
.connect
.crypto
.n_ciphers_pairwise
= nr_ciphers
;
1041 static int cfg80211_set_key_mgt(struct wireless_dev
*wdev
, u32 key_mgt
)
1043 int nr_akm_suites
= 0;
1045 if (key_mgt
& ~(IW_AUTH_KEY_MGMT_802_1X
|
1046 IW_AUTH_KEY_MGMT_PSK
))
1049 if (key_mgt
& IW_AUTH_KEY_MGMT_802_1X
) {
1050 wdev
->wext
.connect
.crypto
.akm_suites
[nr_akm_suites
] =
1051 WLAN_AKM_SUITE_8021X
;
1055 if (key_mgt
& IW_AUTH_KEY_MGMT_PSK
) {
1056 wdev
->wext
.connect
.crypto
.akm_suites
[nr_akm_suites
] =
1061 wdev
->wext
.connect
.crypto
.n_akm_suites
= nr_akm_suites
;
1066 static int cfg80211_wext_siwauth(struct net_device
*dev
,
1067 struct iw_request_info
*info
,
1068 struct iw_param
*data
, char *extra
)
1070 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1072 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1075 switch (data
->flags
& IW_AUTH_INDEX
) {
1076 case IW_AUTH_PRIVACY_INVOKED
:
1077 wdev
->wext
.connect
.privacy
= data
->value
;
1079 case IW_AUTH_WPA_VERSION
:
1080 return cfg80211_set_wpa_version(wdev
, data
->value
);
1081 case IW_AUTH_CIPHER_GROUP
:
1082 return cfg80211_set_cipher_group(wdev
, data
->value
);
1083 case IW_AUTH_KEY_MGMT
:
1084 return cfg80211_set_key_mgt(wdev
, data
->value
);
1085 case IW_AUTH_CIPHER_PAIRWISE
:
1086 return cfg80211_set_cipher_pairwise(wdev
, data
->value
);
1087 case IW_AUTH_80211_AUTH_ALG
:
1088 return cfg80211_set_auth_alg(wdev
, data
->value
);
1089 case IW_AUTH_WPA_ENABLED
:
1090 case IW_AUTH_RX_UNENCRYPTED_EAPOL
:
1091 case IW_AUTH_DROP_UNENCRYPTED
:
1099 static int cfg80211_wext_giwauth(struct net_device
*dev
,
1100 struct iw_request_info
*info
,
1101 struct iw_param
*data
, char *extra
)
1103 /* XXX: what do we need? */
1108 static int cfg80211_wext_siwpower(struct net_device
*dev
,
1109 struct iw_request_info
*info
,
1110 struct iw_param
*wrq
, char *extra
)
1112 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1113 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1115 int timeout
= wdev
->ps_timeout
;
1118 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1121 if (!rdev
->ops
->set_power_mgmt
)
1124 if (wrq
->disabled
) {
1127 switch (wrq
->flags
& IW_POWER_MODE
) {
1128 case IW_POWER_ON
: /* If not specified */
1129 case IW_POWER_MODE
: /* If set all mask */
1130 case IW_POWER_ALL_R
: /* If explicitely state all */
1133 default: /* Otherwise we ignore */
1137 if (wrq
->flags
& ~(IW_POWER_MODE
| IW_POWER_TIMEOUT
))
1140 if (wrq
->flags
& IW_POWER_TIMEOUT
)
1141 timeout
= wrq
->value
/ 1000;
1144 err
= rdev
->ops
->set_power_mgmt(wdev
->wiphy
, dev
, ps
, timeout
);
1149 wdev
->ps_timeout
= timeout
;
1155 static int cfg80211_wext_giwpower(struct net_device
*dev
,
1156 struct iw_request_info
*info
,
1157 struct iw_param
*wrq
, char *extra
)
1159 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1161 wrq
->disabled
= !wdev
->ps
;
1166 static int cfg80211_wds_wext_siwap(struct net_device
*dev
,
1167 struct iw_request_info
*info
,
1168 struct sockaddr
*addr
, char *extra
)
1170 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1171 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1174 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_WDS
))
1177 if (addr
->sa_family
!= ARPHRD_ETHER
)
1180 if (netif_running(dev
))
1183 if (!rdev
->ops
->set_wds_peer
)
1186 err
= rdev
->ops
->set_wds_peer(wdev
->wiphy
, dev
, (u8
*) &addr
->sa_data
);
1190 memcpy(&wdev
->wext
.bssid
, (u8
*) &addr
->sa_data
, ETH_ALEN
);
1195 static int cfg80211_wds_wext_giwap(struct net_device
*dev
,
1196 struct iw_request_info
*info
,
1197 struct sockaddr
*addr
, char *extra
)
1199 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1201 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_WDS
))
1204 addr
->sa_family
= ARPHRD_ETHER
;
1205 memcpy(&addr
->sa_data
, wdev
->wext
.bssid
, ETH_ALEN
);
1210 static int cfg80211_wext_siwrate(struct net_device
*dev
,
1211 struct iw_request_info
*info
,
1212 struct iw_param
*rate
, char *extra
)
1214 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1215 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1216 struct cfg80211_bitrate_mask mask
;
1218 struct ieee80211_supported_band
*sband
;
1222 if (!rdev
->ops
->set_bitrate_mask
)
1225 memset(&mask
, 0, sizeof(mask
));
1229 if (rate
->value
< 0) {
1231 } else if (rate
->fixed
) {
1232 fixed
= rate
->value
/ 100000;
1234 maxrate
= rate
->value
/ 100000;
1237 for (band
= 0; band
< IEEE80211_NUM_BANDS
; band
++) {
1238 sband
= wdev
->wiphy
->bands
[band
];
1241 for (ridx
= 0; ridx
< sband
->n_bitrates
; ridx
++) {
1242 struct ieee80211_rate
*srate
= &sband
->bitrates
[ridx
];
1243 if (fixed
== srate
->bitrate
) {
1244 mask
.control
[band
].legacy
= 1 << ridx
;
1248 if (srate
->bitrate
<= maxrate
) {
1249 mask
.control
[band
].legacy
|= 1 << ridx
;
1258 return rdev
->ops
->set_bitrate_mask(wdev
->wiphy
, dev
, NULL
, &mask
);
1261 static int cfg80211_wext_giwrate(struct net_device
*dev
,
1262 struct iw_request_info
*info
,
1263 struct iw_param
*rate
, char *extra
)
1265 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1266 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1267 /* we are under RTNL - globally locked - so can use a static struct */
1268 static struct station_info sinfo
;
1272 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1275 if (!rdev
->ops
->get_station
)
1280 if (wdev
->current_bss
)
1281 memcpy(addr
, wdev
->current_bss
->pub
.bssid
, ETH_ALEN
);
1288 err
= rdev
->ops
->get_station(&rdev
->wiphy
, dev
, addr
, &sinfo
);
1292 if (!(sinfo
.filled
& STATION_INFO_TX_BITRATE
))
1295 rate
->value
= 100000 * cfg80211_calculate_bitrate(&sinfo
.txrate
);
1300 /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
1301 static struct iw_statistics
*cfg80211_wireless_stats(struct net_device
*dev
)
1303 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1304 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1305 /* we are under RTNL - globally locked - so can use static structs */
1306 static struct iw_statistics wstats
;
1307 static struct station_info sinfo
;
1310 if (dev
->ieee80211_ptr
->iftype
!= NL80211_IFTYPE_STATION
)
1313 if (!rdev
->ops
->get_station
)
1316 /* Grab BSSID of current BSS, if any */
1318 if (!wdev
->current_bss
) {
1322 memcpy(bssid
, wdev
->current_bss
->pub
.bssid
, ETH_ALEN
);
1325 if (rdev
->ops
->get_station(&rdev
->wiphy
, dev
, bssid
, &sinfo
))
1328 memset(&wstats
, 0, sizeof(wstats
));
1330 switch (rdev
->wiphy
.signal_type
) {
1331 case CFG80211_SIGNAL_TYPE_MBM
:
1332 if (sinfo
.filled
& STATION_INFO_SIGNAL
) {
1333 int sig
= sinfo
.signal
;
1334 wstats
.qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
1335 wstats
.qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
1336 wstats
.qual
.updated
|= IW_QUAL_DBM
;
1337 wstats
.qual
.level
= sig
;
1342 wstats
.qual
.qual
= sig
+ 110;
1345 case CFG80211_SIGNAL_TYPE_UNSPEC
:
1346 if (sinfo
.filled
& STATION_INFO_SIGNAL
) {
1347 wstats
.qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
1348 wstats
.qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
1349 wstats
.qual
.level
= sinfo
.signal
;
1350 wstats
.qual
.qual
= sinfo
.signal
;
1354 wstats
.qual
.updated
|= IW_QUAL_LEVEL_INVALID
;
1355 wstats
.qual
.updated
|= IW_QUAL_QUAL_INVALID
;
1358 wstats
.qual
.updated
|= IW_QUAL_NOISE_INVALID
;
1359 if (sinfo
.filled
& STATION_INFO_RX_DROP_MISC
)
1360 wstats
.discard
.misc
= sinfo
.rx_dropped_misc
;
1361 if (sinfo
.filled
& STATION_INFO_TX_FAILED
)
1362 wstats
.discard
.retries
= sinfo
.tx_failed
;
1367 static int cfg80211_wext_siwap(struct net_device
*dev
,
1368 struct iw_request_info
*info
,
1369 struct sockaddr
*ap_addr
, char *extra
)
1371 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1373 switch (wdev
->iftype
) {
1374 case NL80211_IFTYPE_ADHOC
:
1375 return cfg80211_ibss_wext_siwap(dev
, info
, ap_addr
, extra
);
1376 case NL80211_IFTYPE_STATION
:
1377 return cfg80211_mgd_wext_siwap(dev
, info
, ap_addr
, extra
);
1378 case NL80211_IFTYPE_WDS
:
1379 return cfg80211_wds_wext_siwap(dev
, info
, ap_addr
, extra
);
1385 static int cfg80211_wext_giwap(struct net_device
*dev
,
1386 struct iw_request_info
*info
,
1387 struct sockaddr
*ap_addr
, char *extra
)
1389 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1391 switch (wdev
->iftype
) {
1392 case NL80211_IFTYPE_ADHOC
:
1393 return cfg80211_ibss_wext_giwap(dev
, info
, ap_addr
, extra
);
1394 case NL80211_IFTYPE_STATION
:
1395 return cfg80211_mgd_wext_giwap(dev
, info
, ap_addr
, extra
);
1396 case NL80211_IFTYPE_WDS
:
1397 return cfg80211_wds_wext_giwap(dev
, info
, ap_addr
, extra
);
1403 static int cfg80211_wext_siwessid(struct net_device
*dev
,
1404 struct iw_request_info
*info
,
1405 struct iw_point
*data
, char *ssid
)
1407 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1409 switch (wdev
->iftype
) {
1410 case NL80211_IFTYPE_ADHOC
:
1411 return cfg80211_ibss_wext_siwessid(dev
, info
, data
, ssid
);
1412 case NL80211_IFTYPE_STATION
:
1413 return cfg80211_mgd_wext_siwessid(dev
, info
, data
, ssid
);
1419 static int cfg80211_wext_giwessid(struct net_device
*dev
,
1420 struct iw_request_info
*info
,
1421 struct iw_point
*data
, char *ssid
)
1423 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1428 switch (wdev
->iftype
) {
1429 case NL80211_IFTYPE_ADHOC
:
1430 return cfg80211_ibss_wext_giwessid(dev
, info
, data
, ssid
);
1431 case NL80211_IFTYPE_STATION
:
1432 return cfg80211_mgd_wext_giwessid(dev
, info
, data
, ssid
);
1438 static int cfg80211_wext_siwpmksa(struct net_device
*dev
,
1439 struct iw_request_info
*info
,
1440 struct iw_point
*data
, char *extra
)
1442 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1443 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1444 struct cfg80211_pmksa cfg_pmksa
;
1445 struct iw_pmksa
*pmksa
= (struct iw_pmksa
*)extra
;
1447 memset(&cfg_pmksa
, 0, sizeof(struct cfg80211_pmksa
));
1449 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1452 cfg_pmksa
.bssid
= pmksa
->bssid
.sa_data
;
1453 cfg_pmksa
.pmkid
= pmksa
->pmkid
;
1455 switch (pmksa
->cmd
) {
1457 if (!rdev
->ops
->set_pmksa
)
1460 return rdev
->ops
->set_pmksa(&rdev
->wiphy
, dev
, &cfg_pmksa
);
1462 case IW_PMKSA_REMOVE
:
1463 if (!rdev
->ops
->del_pmksa
)
1466 return rdev
->ops
->del_pmksa(&rdev
->wiphy
, dev
, &cfg_pmksa
);
1468 case IW_PMKSA_FLUSH
:
1469 if (!rdev
->ops
->flush_pmksa
)
1472 return rdev
->ops
->flush_pmksa(&rdev
->wiphy
, dev
);
1479 static const iw_handler cfg80211_handlers
[] = {
1480 [IW_IOCTL_IDX(SIOCGIWNAME
)] = (iw_handler
) cfg80211_wext_giwname
,
1481 [IW_IOCTL_IDX(SIOCSIWFREQ
)] = (iw_handler
) cfg80211_wext_siwfreq
,
1482 [IW_IOCTL_IDX(SIOCGIWFREQ
)] = (iw_handler
) cfg80211_wext_giwfreq
,
1483 [IW_IOCTL_IDX(SIOCSIWMODE
)] = (iw_handler
) cfg80211_wext_siwmode
,
1484 [IW_IOCTL_IDX(SIOCGIWMODE
)] = (iw_handler
) cfg80211_wext_giwmode
,
1485 [IW_IOCTL_IDX(SIOCGIWRANGE
)] = (iw_handler
) cfg80211_wext_giwrange
,
1486 [IW_IOCTL_IDX(SIOCSIWAP
)] = (iw_handler
) cfg80211_wext_siwap
,
1487 [IW_IOCTL_IDX(SIOCGIWAP
)] = (iw_handler
) cfg80211_wext_giwap
,
1488 [IW_IOCTL_IDX(SIOCSIWMLME
)] = (iw_handler
) cfg80211_wext_siwmlme
,
1489 [IW_IOCTL_IDX(SIOCSIWSCAN
)] = (iw_handler
) cfg80211_wext_siwscan
,
1490 [IW_IOCTL_IDX(SIOCGIWSCAN
)] = (iw_handler
) cfg80211_wext_giwscan
,
1491 [IW_IOCTL_IDX(SIOCSIWESSID
)] = (iw_handler
) cfg80211_wext_siwessid
,
1492 [IW_IOCTL_IDX(SIOCGIWESSID
)] = (iw_handler
) cfg80211_wext_giwessid
,
1493 [IW_IOCTL_IDX(SIOCSIWRATE
)] = (iw_handler
) cfg80211_wext_siwrate
,
1494 [IW_IOCTL_IDX(SIOCGIWRATE
)] = (iw_handler
) cfg80211_wext_giwrate
,
1495 [IW_IOCTL_IDX(SIOCSIWRTS
)] = (iw_handler
) cfg80211_wext_siwrts
,
1496 [IW_IOCTL_IDX(SIOCGIWRTS
)] = (iw_handler
) cfg80211_wext_giwrts
,
1497 [IW_IOCTL_IDX(SIOCSIWFRAG
)] = (iw_handler
) cfg80211_wext_siwfrag
,
1498 [IW_IOCTL_IDX(SIOCGIWFRAG
)] = (iw_handler
) cfg80211_wext_giwfrag
,
1499 [IW_IOCTL_IDX(SIOCSIWTXPOW
)] = (iw_handler
) cfg80211_wext_siwtxpower
,
1500 [IW_IOCTL_IDX(SIOCGIWTXPOW
)] = (iw_handler
) cfg80211_wext_giwtxpower
,
1501 [IW_IOCTL_IDX(SIOCSIWRETRY
)] = (iw_handler
) cfg80211_wext_siwretry
,
1502 [IW_IOCTL_IDX(SIOCGIWRETRY
)] = (iw_handler
) cfg80211_wext_giwretry
,
1503 [IW_IOCTL_IDX(SIOCSIWENCODE
)] = (iw_handler
) cfg80211_wext_siwencode
,
1504 [IW_IOCTL_IDX(SIOCGIWENCODE
)] = (iw_handler
) cfg80211_wext_giwencode
,
1505 [IW_IOCTL_IDX(SIOCSIWPOWER
)] = (iw_handler
) cfg80211_wext_siwpower
,
1506 [IW_IOCTL_IDX(SIOCGIWPOWER
)] = (iw_handler
) cfg80211_wext_giwpower
,
1507 [IW_IOCTL_IDX(SIOCSIWGENIE
)] = (iw_handler
) cfg80211_wext_siwgenie
,
1508 [IW_IOCTL_IDX(SIOCSIWAUTH
)] = (iw_handler
) cfg80211_wext_siwauth
,
1509 [IW_IOCTL_IDX(SIOCGIWAUTH
)] = (iw_handler
) cfg80211_wext_giwauth
,
1510 [IW_IOCTL_IDX(SIOCSIWENCODEEXT
)]= (iw_handler
) cfg80211_wext_siwencodeext
,
1511 [IW_IOCTL_IDX(SIOCSIWPMKSA
)] = (iw_handler
) cfg80211_wext_siwpmksa
,
1514 const struct iw_handler_def cfg80211_wext_handler
= {
1515 .num_standard
= ARRAY_SIZE(cfg80211_handlers
),
1516 .standard
= cfg80211_handlers
,
1517 .get_wireless_stats
= cfg80211_wireless_stats
,