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 "wext-compat.h"
21 int cfg80211_wext_giwname(struct net_device
*dev
,
22 struct iw_request_info
*info
,
23 char *name
, char *extra
)
25 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
26 struct ieee80211_supported_band
*sband
;
27 bool is_ht
= false, is_a
= false, is_b
= false, is_g
= false;
32 sband
= wdev
->wiphy
->bands
[IEEE80211_BAND_5GHZ
];
35 is_ht
|= sband
->ht_cap
.ht_supported
;
38 sband
= wdev
->wiphy
->bands
[IEEE80211_BAND_2GHZ
];
41 /* Check for mandatory rates */
42 for (i
= 0; i
< sband
->n_bitrates
; i
++) {
43 if (sband
->bitrates
[i
].bitrate
== 10)
45 if (sband
->bitrates
[i
].bitrate
== 60)
48 is_ht
|= sband
->ht_cap
.ht_supported
;
51 strcpy(name
, "IEEE 802.11");
63 EXPORT_SYMBOL_GPL(cfg80211_wext_giwname
);
65 int cfg80211_wext_siwmode(struct net_device
*dev
, struct iw_request_info
*info
,
66 u32
*mode
, char *extra
)
68 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
69 struct cfg80211_registered_device
*rdev
;
70 struct vif_params vifparams
;
71 enum nl80211_iftype type
;
74 rdev
= wiphy_to_dev(wdev
->wiphy
);
78 type
= NL80211_IFTYPE_STATION
;
81 type
= NL80211_IFTYPE_ADHOC
;
84 type
= NL80211_IFTYPE_WDS
;
87 type
= NL80211_IFTYPE_MONITOR
;
93 if (type
== wdev
->iftype
)
96 memset(&vifparams
, 0, sizeof(vifparams
));
98 cfg80211_lock_rdev(rdev
);
99 ret
= cfg80211_change_iface(rdev
, dev
, type
, NULL
, &vifparams
);
100 cfg80211_unlock_rdev(rdev
);
104 EXPORT_SYMBOL_GPL(cfg80211_wext_siwmode
);
106 int cfg80211_wext_giwmode(struct net_device
*dev
, struct iw_request_info
*info
,
107 u32
*mode
, char *extra
)
109 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
114 switch (wdev
->iftype
) {
115 case NL80211_IFTYPE_AP
:
116 *mode
= IW_MODE_MASTER
;
118 case NL80211_IFTYPE_STATION
:
119 *mode
= IW_MODE_INFRA
;
121 case NL80211_IFTYPE_ADHOC
:
122 *mode
= IW_MODE_ADHOC
;
124 case NL80211_IFTYPE_MONITOR
:
125 *mode
= IW_MODE_MONITOR
;
127 case NL80211_IFTYPE_WDS
:
128 *mode
= IW_MODE_REPEAT
;
130 case NL80211_IFTYPE_AP_VLAN
:
131 *mode
= IW_MODE_SECOND
; /* FIXME */
134 *mode
= IW_MODE_AUTO
;
139 EXPORT_SYMBOL_GPL(cfg80211_wext_giwmode
);
142 int cfg80211_wext_giwrange(struct net_device
*dev
,
143 struct iw_request_info
*info
,
144 struct iw_point
*data
, char *extra
)
146 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
147 struct iw_range
*range
= (struct iw_range
*) extra
;
148 enum ieee80211_band band
;
154 data
->length
= sizeof(struct iw_range
);
155 memset(range
, 0, sizeof(struct iw_range
));
157 range
->we_version_compiled
= WIRELESS_EXT
;
158 range
->we_version_source
= 21;
159 range
->retry_capa
= IW_RETRY_LIMIT
;
160 range
->retry_flags
= IW_RETRY_LIMIT
;
161 range
->min_retry
= 0;
162 range
->max_retry
= 255;
164 range
->max_rts
= 2347;
165 range
->min_frag
= 256;
166 range
->max_frag
= 2346;
168 range
->max_encoding_tokens
= 4;
170 range
->max_qual
.updated
= IW_QUAL_NOISE_INVALID
;
172 switch (wdev
->wiphy
->signal_type
) {
173 case CFG80211_SIGNAL_TYPE_NONE
:
175 case CFG80211_SIGNAL_TYPE_MBM
:
176 range
->max_qual
.level
= -110;
177 range
->max_qual
.qual
= 70;
178 range
->avg_qual
.qual
= 35;
179 range
->max_qual
.updated
|= IW_QUAL_DBM
;
180 range
->max_qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
181 range
->max_qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
183 case CFG80211_SIGNAL_TYPE_UNSPEC
:
184 range
->max_qual
.level
= 100;
185 range
->max_qual
.qual
= 100;
186 range
->avg_qual
.qual
= 50;
187 range
->max_qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
188 range
->max_qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
192 range
->avg_qual
.level
= range
->max_qual
.level
/ 2;
193 range
->avg_qual
.noise
= range
->max_qual
.noise
/ 2;
194 range
->avg_qual
.updated
= range
->max_qual
.updated
;
196 for (i
= 0; i
< wdev
->wiphy
->n_cipher_suites
; i
++) {
197 switch (wdev
->wiphy
->cipher_suites
[i
]) {
198 case WLAN_CIPHER_SUITE_TKIP
:
199 range
->enc_capa
|= (IW_ENC_CAPA_CIPHER_TKIP
|
203 case WLAN_CIPHER_SUITE_CCMP
:
204 range
->enc_capa
|= (IW_ENC_CAPA_CIPHER_CCMP
|
208 case WLAN_CIPHER_SUITE_WEP40
:
209 range
->encoding_size
[range
->num_encoding_sizes
++] =
213 case WLAN_CIPHER_SUITE_WEP104
:
214 range
->encoding_size
[range
->num_encoding_sizes
++] =
220 for (band
= 0; band
< IEEE80211_NUM_BANDS
; band
++) {
221 struct ieee80211_supported_band
*sband
;
223 sband
= wdev
->wiphy
->bands
[band
];
228 for (i
= 0; i
< sband
->n_channels
&& c
< IW_MAX_FREQUENCIES
; i
++) {
229 struct ieee80211_channel
*chan
= &sband
->channels
[i
];
231 if (!(chan
->flags
& IEEE80211_CHAN_DISABLED
)) {
233 ieee80211_frequency_to_channel(
235 range
->freq
[c
].m
= chan
->center_freq
;
236 range
->freq
[c
].e
= 6;
241 range
->num_channels
= c
;
242 range
->num_frequency
= c
;
244 IW_EVENT_CAPA_SET_KERNEL(range
->event_capa
);
245 IW_EVENT_CAPA_SET(range
->event_capa
, SIOCGIWAP
);
246 IW_EVENT_CAPA_SET(range
->event_capa
, SIOCGIWSCAN
);
248 if (wdev
->wiphy
->max_scan_ssids
> 0)
249 range
->scan_capa
|= IW_SCAN_CAPA_ESSID
;
253 EXPORT_SYMBOL_GPL(cfg80211_wext_giwrange
);
257 * cfg80211_wext_freq - get wext frequency for non-"auto"
259 * @freq: the wext freq encoding
261 * Returns a frequency, or a negative error code, or 0 for auto.
263 int cfg80211_wext_freq(struct wiphy
*wiphy
, struct iw_freq
*freq
)
266 * Parse frequency - return 0 for auto and
267 * -EINVAL for impossible things.
272 return ieee80211_channel_to_frequency(freq
->m
);
274 int i
, div
= 1000000;
275 for (i
= 0; i
< freq
->e
; i
++)
279 return freq
->m
/ div
;
283 int cfg80211_wext_siwrts(struct net_device
*dev
,
284 struct iw_request_info
*info
,
285 struct iw_param
*rts
, char *extra
)
287 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
288 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
289 u32 orts
= wdev
->wiphy
->rts_threshold
;
292 if (rts
->disabled
|| !rts
->fixed
)
293 wdev
->wiphy
->rts_threshold
= (u32
) -1;
294 else if (rts
->value
< 0)
297 wdev
->wiphy
->rts_threshold
= rts
->value
;
299 err
= rdev
->ops
->set_wiphy_params(wdev
->wiphy
,
300 WIPHY_PARAM_RTS_THRESHOLD
);
302 wdev
->wiphy
->rts_threshold
= orts
;
306 EXPORT_SYMBOL_GPL(cfg80211_wext_siwrts
);
308 int cfg80211_wext_giwrts(struct net_device
*dev
,
309 struct iw_request_info
*info
,
310 struct iw_param
*rts
, char *extra
)
312 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
314 rts
->value
= wdev
->wiphy
->rts_threshold
;
315 rts
->disabled
= rts
->value
== (u32
) -1;
320 EXPORT_SYMBOL_GPL(cfg80211_wext_giwrts
);
322 int cfg80211_wext_siwfrag(struct net_device
*dev
,
323 struct iw_request_info
*info
,
324 struct iw_param
*frag
, char *extra
)
326 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
327 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
328 u32 ofrag
= wdev
->wiphy
->frag_threshold
;
331 if (frag
->disabled
|| !frag
->fixed
)
332 wdev
->wiphy
->frag_threshold
= (u32
) -1;
333 else if (frag
->value
< 256)
336 /* Fragment length must be even, so strip LSB. */
337 wdev
->wiphy
->frag_threshold
= frag
->value
& ~0x1;
340 err
= rdev
->ops
->set_wiphy_params(wdev
->wiphy
,
341 WIPHY_PARAM_FRAG_THRESHOLD
);
343 wdev
->wiphy
->frag_threshold
= ofrag
;
347 EXPORT_SYMBOL_GPL(cfg80211_wext_siwfrag
);
349 int cfg80211_wext_giwfrag(struct net_device
*dev
,
350 struct iw_request_info
*info
,
351 struct iw_param
*frag
, char *extra
)
353 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
355 frag
->value
= wdev
->wiphy
->frag_threshold
;
356 frag
->disabled
= frag
->value
== (u32
) -1;
361 EXPORT_SYMBOL_GPL(cfg80211_wext_giwfrag
);
363 int cfg80211_wext_siwretry(struct net_device
*dev
,
364 struct iw_request_info
*info
,
365 struct iw_param
*retry
, char *extra
)
367 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
368 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
370 u8 olong
= wdev
->wiphy
->retry_long
;
371 u8 oshort
= wdev
->wiphy
->retry_short
;
374 if (retry
->disabled
||
375 (retry
->flags
& IW_RETRY_TYPE
) != IW_RETRY_LIMIT
)
378 if (retry
->flags
& IW_RETRY_LONG
) {
379 wdev
->wiphy
->retry_long
= retry
->value
;
380 changed
|= WIPHY_PARAM_RETRY_LONG
;
381 } else if (retry
->flags
& IW_RETRY_SHORT
) {
382 wdev
->wiphy
->retry_short
= retry
->value
;
383 changed
|= WIPHY_PARAM_RETRY_SHORT
;
385 wdev
->wiphy
->retry_short
= retry
->value
;
386 wdev
->wiphy
->retry_long
= retry
->value
;
387 changed
|= WIPHY_PARAM_RETRY_LONG
;
388 changed
|= WIPHY_PARAM_RETRY_SHORT
;
394 err
= rdev
->ops
->set_wiphy_params(wdev
->wiphy
, changed
);
396 wdev
->wiphy
->retry_short
= oshort
;
397 wdev
->wiphy
->retry_long
= olong
;
402 EXPORT_SYMBOL_GPL(cfg80211_wext_siwretry
);
404 int cfg80211_wext_giwretry(struct net_device
*dev
,
405 struct iw_request_info
*info
,
406 struct iw_param
*retry
, char *extra
)
408 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
412 if (retry
->flags
== 0 || (retry
->flags
& IW_RETRY_SHORT
)) {
414 * First return short value, iwconfig will ask long value
417 retry
->flags
|= IW_RETRY_LIMIT
;
418 retry
->value
= wdev
->wiphy
->retry_short
;
419 if (wdev
->wiphy
->retry_long
!= wdev
->wiphy
->retry_short
)
420 retry
->flags
|= IW_RETRY_LONG
;
425 if (retry
->flags
& IW_RETRY_LONG
) {
426 retry
->flags
= IW_RETRY_LIMIT
| IW_RETRY_LONG
;
427 retry
->value
= wdev
->wiphy
->retry_long
;
432 EXPORT_SYMBOL_GPL(cfg80211_wext_giwretry
);
434 static int __cfg80211_set_encryption(struct cfg80211_registered_device
*rdev
,
435 struct net_device
*dev
, const u8
*addr
,
436 bool remove
, bool tx_key
, int idx
,
437 struct key_params
*params
)
439 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
443 if (!wdev
->wext
.keys
) {
444 wdev
->wext
.keys
= kzalloc(sizeof(*wdev
->wext
.keys
),
446 if (!wdev
->wext
.keys
)
448 for (i
= 0; i
< 6; i
++)
449 wdev
->wext
.keys
->params
[i
].key
=
450 wdev
->wext
.keys
->data
[i
];
453 if (wdev
->iftype
!= NL80211_IFTYPE_ADHOC
&&
454 wdev
->iftype
!= NL80211_IFTYPE_STATION
)
457 if (params
->cipher
== WLAN_CIPHER_SUITE_AES_CMAC
) {
458 if (!wdev
->current_bss
)
461 if (!rdev
->ops
->set_default_mgmt_key
)
464 if (idx
< 4 || idx
> 5)
466 } else if (idx
< 0 || idx
> 3)
471 if (wdev
->current_bss
) {
473 * If removing the current TX key, we will need to
474 * join a new IBSS without the privacy bit clear.
476 if (idx
== wdev
->wext
.default_key
&&
477 wdev
->iftype
== NL80211_IFTYPE_ADHOC
) {
478 __cfg80211_leave_ibss(rdev
, wdev
->netdev
, true);
481 err
= rdev
->ops
->del_key(&rdev
->wiphy
, dev
, idx
, addr
);
483 wdev
->wext
.connect
.privacy
= false;
485 * Applications using wireless extensions expect to be
486 * able to delete keys that don't exist, so allow that.
492 wdev
->wext
.keys
->params
[idx
].key_len
= 0;
493 wdev
->wext
.keys
->params
[idx
].cipher
= 0;
495 if (idx
== wdev
->wext
.default_key
)
496 wdev
->wext
.default_key
= -1;
497 else if (idx
== wdev
->wext
.default_mgmt_key
)
498 wdev
->wext
.default_mgmt_key
= -1;
502 err
= cfg80211_ibss_wext_join(rdev
, wdev
);
510 if (cfg80211_validate_key_settings(rdev
, params
, idx
, addr
))
514 if (wdev
->current_bss
)
515 err
= rdev
->ops
->add_key(&rdev
->wiphy
, dev
, idx
, addr
, params
);
520 wdev
->wext
.keys
->params
[idx
] = *params
;
521 memcpy(wdev
->wext
.keys
->data
[idx
],
522 params
->key
, params
->key_len
);
523 wdev
->wext
.keys
->params
[idx
].key
=
524 wdev
->wext
.keys
->data
[idx
];
527 if ((params
->cipher
== WLAN_CIPHER_SUITE_WEP40
||
528 params
->cipher
== WLAN_CIPHER_SUITE_WEP104
) &&
529 (tx_key
|| (!addr
&& wdev
->wext
.default_key
== -1))) {
530 if (wdev
->current_bss
) {
532 * If we are getting a new TX key from not having
533 * had one before we need to join a new IBSS with
534 * the privacy bit set.
536 if (wdev
->iftype
== NL80211_IFTYPE_ADHOC
&&
537 wdev
->wext
.default_key
== -1) {
538 __cfg80211_leave_ibss(rdev
, wdev
->netdev
, true);
541 err
= rdev
->ops
->set_default_key(&rdev
->wiphy
,
545 wdev
->wext
.default_key
= idx
;
547 err
= cfg80211_ibss_wext_join(rdev
, wdev
);
552 if (params
->cipher
== WLAN_CIPHER_SUITE_AES_CMAC
&&
553 (tx_key
|| (!addr
&& wdev
->wext
.default_mgmt_key
== -1))) {
554 if (wdev
->current_bss
)
555 err
= rdev
->ops
->set_default_mgmt_key(&rdev
->wiphy
,
558 wdev
->wext
.default_mgmt_key
= idx
;
565 static int cfg80211_set_encryption(struct cfg80211_registered_device
*rdev
,
566 struct net_device
*dev
, const u8
*addr
,
567 bool remove
, bool tx_key
, int idx
,
568 struct key_params
*params
)
572 /* devlist mutex needed for possible IBSS re-join */
573 mutex_lock(&rdev
->devlist_mtx
);
574 wdev_lock(dev
->ieee80211_ptr
);
575 err
= __cfg80211_set_encryption(rdev
, dev
, addr
, remove
,
576 tx_key
, idx
, params
);
577 wdev_unlock(dev
->ieee80211_ptr
);
578 mutex_unlock(&rdev
->devlist_mtx
);
583 int cfg80211_wext_siwencode(struct net_device
*dev
,
584 struct iw_request_info
*info
,
585 struct iw_point
*erq
, char *keybuf
)
587 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
588 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
591 struct key_params params
;
593 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
594 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
597 /* no use -- only MFP (set_default_mgmt_key) is optional */
598 if (!rdev
->ops
->del_key
||
599 !rdev
->ops
->add_key
||
600 !rdev
->ops
->set_default_key
)
603 idx
= erq
->flags
& IW_ENCODE_INDEX
;
605 idx
= wdev
->wext
.default_key
;
608 } else if (idx
< 1 || idx
> 4)
613 if (erq
->flags
& IW_ENCODE_DISABLED
)
615 else if (erq
->length
== 0) {
616 /* No key data - just set the default TX key index */
619 if (wdev
->current_bss
)
620 err
= rdev
->ops
->set_default_key(&rdev
->wiphy
,
623 wdev
->wext
.default_key
= idx
;
628 memset(¶ms
, 0, sizeof(params
));
630 params
.key_len
= erq
->length
;
631 if (erq
->length
== 5)
632 params
.cipher
= WLAN_CIPHER_SUITE_WEP40
;
633 else if (erq
->length
== 13)
634 params
.cipher
= WLAN_CIPHER_SUITE_WEP104
;
638 return cfg80211_set_encryption(rdev
, dev
, NULL
, remove
,
639 wdev
->wext
.default_key
== -1,
642 EXPORT_SYMBOL_GPL(cfg80211_wext_siwencode
);
644 int cfg80211_wext_siwencodeext(struct net_device
*dev
,
645 struct iw_request_info
*info
,
646 struct iw_point
*erq
, char *extra
)
648 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
649 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
650 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*) extra
;
654 struct key_params params
;
657 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
658 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
661 /* no use -- only MFP (set_default_mgmt_key) is optional */
662 if (!rdev
->ops
->del_key
||
663 !rdev
->ops
->add_key
||
664 !rdev
->ops
->set_default_key
)
668 case IW_ENCODE_ALG_NONE
:
672 case IW_ENCODE_ALG_WEP
:
673 if (ext
->key_len
== 5)
674 cipher
= WLAN_CIPHER_SUITE_WEP40
;
675 else if (ext
->key_len
== 13)
676 cipher
= WLAN_CIPHER_SUITE_WEP104
;
680 case IW_ENCODE_ALG_TKIP
:
681 cipher
= WLAN_CIPHER_SUITE_TKIP
;
683 case IW_ENCODE_ALG_CCMP
:
684 cipher
= WLAN_CIPHER_SUITE_CCMP
;
686 case IW_ENCODE_ALG_AES_CMAC
:
687 cipher
= WLAN_CIPHER_SUITE_AES_CMAC
;
693 if (erq
->flags
& IW_ENCODE_DISABLED
)
696 idx
= erq
->flags
& IW_ENCODE_INDEX
;
697 if (cipher
== WLAN_CIPHER_SUITE_AES_CMAC
) {
698 if (idx
< 4 || idx
> 5) {
699 idx
= wdev
->wext
.default_mgmt_key
;
705 if (idx
< 1 || idx
> 4) {
706 idx
= wdev
->wext
.default_key
;
713 addr
= ext
->addr
.sa_data
;
714 if (is_broadcast_ether_addr(addr
))
717 memset(¶ms
, 0, sizeof(params
));
718 params
.key
= ext
->key
;
719 params
.key_len
= ext
->key_len
;
720 params
.cipher
= cipher
;
722 if (ext
->ext_flags
& IW_ENCODE_EXT_RX_SEQ_VALID
) {
723 params
.seq
= ext
->rx_seq
;
727 return cfg80211_set_encryption(
728 rdev
, dev
, addr
, remove
,
729 ext
->ext_flags
& IW_ENCODE_EXT_SET_TX_KEY
,
732 EXPORT_SYMBOL_GPL(cfg80211_wext_siwencodeext
);
734 int cfg80211_wext_giwencode(struct net_device
*dev
,
735 struct iw_request_info
*info
,
736 struct iw_point
*erq
, char *keybuf
)
738 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
741 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
742 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
745 idx
= erq
->flags
& IW_ENCODE_INDEX
;
747 idx
= wdev
->wext
.default_key
;
750 } else if (idx
< 1 || idx
> 4)
755 erq
->flags
= idx
+ 1;
757 if (!wdev
->wext
.keys
|| !wdev
->wext
.keys
->params
[idx
].cipher
) {
758 erq
->flags
|= IW_ENCODE_DISABLED
;
763 erq
->length
= min_t(size_t, erq
->length
,
764 wdev
->wext
.keys
->params
[idx
].key_len
);
765 memcpy(keybuf
, wdev
->wext
.keys
->params
[idx
].key
, erq
->length
);
766 erq
->flags
|= IW_ENCODE_ENABLED
;
770 EXPORT_SYMBOL_GPL(cfg80211_wext_giwencode
);
772 int cfg80211_wext_siwfreq(struct net_device
*dev
,
773 struct iw_request_info
*info
,
774 struct iw_freq
*wextfreq
, char *extra
)
776 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
777 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
780 switch (wdev
->iftype
) {
781 case NL80211_IFTYPE_STATION
:
782 return cfg80211_mgd_wext_siwfreq(dev
, info
, wextfreq
, extra
);
783 case NL80211_IFTYPE_ADHOC
:
784 return cfg80211_ibss_wext_siwfreq(dev
, info
, wextfreq
, extra
);
786 freq
= cfg80211_wext_freq(wdev
->wiphy
, wextfreq
);
791 mutex_lock(&rdev
->devlist_mtx
);
792 err
= rdev_set_freq(rdev
, NULL
, freq
, NL80211_CHAN_NO_HT
);
793 mutex_unlock(&rdev
->devlist_mtx
);
797 EXPORT_SYMBOL_GPL(cfg80211_wext_siwfreq
);
799 int cfg80211_wext_giwfreq(struct net_device
*dev
,
800 struct iw_request_info
*info
,
801 struct iw_freq
*freq
, char *extra
)
803 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
804 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
806 switch (wdev
->iftype
) {
807 case NL80211_IFTYPE_STATION
:
808 return cfg80211_mgd_wext_giwfreq(dev
, info
, freq
, extra
);
809 case NL80211_IFTYPE_ADHOC
:
810 return cfg80211_ibss_wext_giwfreq(dev
, info
, freq
, extra
);
814 freq
->m
= rdev
->channel
->center_freq
;
819 EXPORT_SYMBOL_GPL(cfg80211_wext_giwfreq
);
821 int cfg80211_wext_siwtxpower(struct net_device
*dev
,
822 struct iw_request_info
*info
,
823 union iwreq_data
*data
, char *extra
)
825 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
826 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
827 enum tx_power_setting type
;
830 if ((data
->txpower
.flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
)
832 if (data
->txpower
.flags
& IW_TXPOW_RANGE
)
835 if (!rdev
->ops
->set_tx_power
)
838 /* only change when not disabling */
839 if (!data
->txpower
.disabled
) {
840 rfkill_set_sw_state(rdev
->rfkill
, false);
842 if (data
->txpower
.fixed
) {
844 * wext doesn't support negative values, see
845 * below where it's for automatic
847 if (data
->txpower
.value
< 0)
849 dbm
= data
->txpower
.value
;
850 type
= TX_POWER_FIXED
;
851 /* TODO: do regulatory check! */
854 * Automatic power level setting, max being the value
855 * passed in from userland.
857 if (data
->txpower
.value
< 0) {
858 type
= TX_POWER_AUTOMATIC
;
860 dbm
= data
->txpower
.value
;
861 type
= TX_POWER_LIMITED
;
865 rfkill_set_sw_state(rdev
->rfkill
, true);
866 schedule_work(&rdev
->rfkill_sync
);
870 return rdev
->ops
->set_tx_power(wdev
->wiphy
, type
, dbm
);
872 EXPORT_SYMBOL_GPL(cfg80211_wext_siwtxpower
);
874 int cfg80211_wext_giwtxpower(struct net_device
*dev
,
875 struct iw_request_info
*info
,
876 union iwreq_data
*data
, char *extra
)
878 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
879 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
882 if ((data
->txpower
.flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
)
884 if (data
->txpower
.flags
& IW_TXPOW_RANGE
)
887 if (!rdev
->ops
->get_tx_power
)
890 err
= rdev
->ops
->get_tx_power(wdev
->wiphy
, &val
);
894 /* well... oh well */
895 data
->txpower
.fixed
= 1;
896 data
->txpower
.disabled
= rfkill_blocked(rdev
->rfkill
);
897 data
->txpower
.value
= val
;
898 data
->txpower
.flags
= IW_TXPOW_DBM
;
902 EXPORT_SYMBOL_GPL(cfg80211_wext_giwtxpower
);
904 static int cfg80211_set_auth_alg(struct wireless_dev
*wdev
,
912 if (auth_alg
& ~(IW_AUTH_ALG_OPEN_SYSTEM
|
913 IW_AUTH_ALG_SHARED_KEY
|
917 if (auth_alg
& IW_AUTH_ALG_OPEN_SYSTEM
) {
919 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_OPEN_SYSTEM
;
922 if (auth_alg
& IW_AUTH_ALG_SHARED_KEY
) {
924 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_SHARED_KEY
;
927 if (auth_alg
& IW_AUTH_ALG_LEAP
) {
929 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_NETWORK_EAP
;
933 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_AUTOMATIC
;
938 static int cfg80211_set_wpa_version(struct wireless_dev
*wdev
, u32 wpa_versions
)
940 if (wpa_versions
& ~(IW_AUTH_WPA_VERSION_WPA
|
941 IW_AUTH_WPA_VERSION_WPA2
|
942 IW_AUTH_WPA_VERSION_DISABLED
))
945 if ((wpa_versions
& IW_AUTH_WPA_VERSION_DISABLED
) &&
946 (wpa_versions
& (IW_AUTH_WPA_VERSION_WPA
|
947 IW_AUTH_WPA_VERSION_WPA2
)))
950 if (wpa_versions
& IW_AUTH_WPA_VERSION_DISABLED
)
951 wdev
->wext
.connect
.crypto
.wpa_versions
&=
952 ~(NL80211_WPA_VERSION_1
|NL80211_WPA_VERSION_2
);
954 if (wpa_versions
& IW_AUTH_WPA_VERSION_WPA
)
955 wdev
->wext
.connect
.crypto
.wpa_versions
|=
956 NL80211_WPA_VERSION_1
;
958 if (wpa_versions
& IW_AUTH_WPA_VERSION_WPA2
)
959 wdev
->wext
.connect
.crypto
.wpa_versions
|=
960 NL80211_WPA_VERSION_2
;
965 static int cfg80211_set_cipher_group(struct wireless_dev
*wdev
, u32 cipher
)
967 if (cipher
& IW_AUTH_CIPHER_WEP40
)
968 wdev
->wext
.connect
.crypto
.cipher_group
=
969 WLAN_CIPHER_SUITE_WEP40
;
970 else if (cipher
& IW_AUTH_CIPHER_WEP104
)
971 wdev
->wext
.connect
.crypto
.cipher_group
=
972 WLAN_CIPHER_SUITE_WEP104
;
973 else if (cipher
& IW_AUTH_CIPHER_TKIP
)
974 wdev
->wext
.connect
.crypto
.cipher_group
=
975 WLAN_CIPHER_SUITE_TKIP
;
976 else if (cipher
& IW_AUTH_CIPHER_CCMP
)
977 wdev
->wext
.connect
.crypto
.cipher_group
=
978 WLAN_CIPHER_SUITE_CCMP
;
979 else if (cipher
& IW_AUTH_CIPHER_AES_CMAC
)
980 wdev
->wext
.connect
.crypto
.cipher_group
=
981 WLAN_CIPHER_SUITE_AES_CMAC
;
982 else if (cipher
& IW_AUTH_CIPHER_NONE
)
983 wdev
->wext
.connect
.crypto
.cipher_group
= 0;
990 static int cfg80211_set_cipher_pairwise(struct wireless_dev
*wdev
, u32 cipher
)
993 u32
*ciphers_pairwise
= wdev
->wext
.connect
.crypto
.ciphers_pairwise
;
995 if (cipher
& IW_AUTH_CIPHER_WEP40
) {
996 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_WEP40
;
1000 if (cipher
& IW_AUTH_CIPHER_WEP104
) {
1001 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_WEP104
;
1005 if (cipher
& IW_AUTH_CIPHER_TKIP
) {
1006 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_TKIP
;
1010 if (cipher
& IW_AUTH_CIPHER_CCMP
) {
1011 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_CCMP
;
1015 if (cipher
& IW_AUTH_CIPHER_AES_CMAC
) {
1016 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_AES_CMAC
;
1020 BUILD_BUG_ON(NL80211_MAX_NR_CIPHER_SUITES
< 5);
1022 wdev
->wext
.connect
.crypto
.n_ciphers_pairwise
= nr_ciphers
;
1028 static int cfg80211_set_key_mgt(struct wireless_dev
*wdev
, u32 key_mgt
)
1030 int nr_akm_suites
= 0;
1032 if (key_mgt
& ~(IW_AUTH_KEY_MGMT_802_1X
|
1033 IW_AUTH_KEY_MGMT_PSK
))
1036 if (key_mgt
& IW_AUTH_KEY_MGMT_802_1X
) {
1037 wdev
->wext
.connect
.crypto
.akm_suites
[nr_akm_suites
] =
1038 WLAN_AKM_SUITE_8021X
;
1042 if (key_mgt
& IW_AUTH_KEY_MGMT_PSK
) {
1043 wdev
->wext
.connect
.crypto
.akm_suites
[nr_akm_suites
] =
1048 wdev
->wext
.connect
.crypto
.n_akm_suites
= nr_akm_suites
;
1053 int cfg80211_wext_siwauth(struct net_device
*dev
,
1054 struct iw_request_info
*info
,
1055 struct iw_param
*data
, char *extra
)
1057 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1059 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1062 switch (data
->flags
& IW_AUTH_INDEX
) {
1063 case IW_AUTH_PRIVACY_INVOKED
:
1064 wdev
->wext
.connect
.privacy
= data
->value
;
1066 case IW_AUTH_WPA_VERSION
:
1067 return cfg80211_set_wpa_version(wdev
, data
->value
);
1068 case IW_AUTH_CIPHER_GROUP
:
1069 return cfg80211_set_cipher_group(wdev
, data
->value
);
1070 case IW_AUTH_KEY_MGMT
:
1071 return cfg80211_set_key_mgt(wdev
, data
->value
);
1072 case IW_AUTH_CIPHER_PAIRWISE
:
1073 return cfg80211_set_cipher_pairwise(wdev
, data
->value
);
1074 case IW_AUTH_80211_AUTH_ALG
:
1075 return cfg80211_set_auth_alg(wdev
, data
->value
);
1076 case IW_AUTH_WPA_ENABLED
:
1077 case IW_AUTH_RX_UNENCRYPTED_EAPOL
:
1078 case IW_AUTH_DROP_UNENCRYPTED
:
1085 EXPORT_SYMBOL_GPL(cfg80211_wext_siwauth
);
1087 int cfg80211_wext_giwauth(struct net_device
*dev
,
1088 struct iw_request_info
*info
,
1089 struct iw_param
*data
, char *extra
)
1091 /* XXX: what do we need? */
1095 EXPORT_SYMBOL_GPL(cfg80211_wext_giwauth
);
1097 int cfg80211_wext_siwpower(struct net_device
*dev
,
1098 struct iw_request_info
*info
,
1099 struct iw_param
*wrq
, char *extra
)
1101 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1102 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1104 int timeout
= wdev
->ps_timeout
;
1107 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1110 if (!rdev
->ops
->set_power_mgmt
)
1113 if (wrq
->disabled
) {
1116 switch (wrq
->flags
& IW_POWER_MODE
) {
1117 case IW_POWER_ON
: /* If not specified */
1118 case IW_POWER_MODE
: /* If set all mask */
1119 case IW_POWER_ALL_R
: /* If explicitely state all */
1122 default: /* Otherwise we ignore */
1126 if (wrq
->flags
& ~(IW_POWER_MODE
| IW_POWER_TIMEOUT
))
1129 if (wrq
->flags
& IW_POWER_TIMEOUT
)
1130 timeout
= wrq
->value
/ 1000;
1133 err
= rdev
->ops
->set_power_mgmt(wdev
->wiphy
, dev
, ps
, timeout
);
1138 wdev
->ps_timeout
= timeout
;
1143 EXPORT_SYMBOL_GPL(cfg80211_wext_siwpower
);
1145 int cfg80211_wext_giwpower(struct net_device
*dev
,
1146 struct iw_request_info
*info
,
1147 struct iw_param
*wrq
, char *extra
)
1149 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1151 wrq
->disabled
= !wdev
->ps
;
1155 EXPORT_SYMBOL_GPL(cfg80211_wext_giwpower
);
1157 static int cfg80211_wds_wext_siwap(struct net_device
*dev
,
1158 struct iw_request_info
*info
,
1159 struct sockaddr
*addr
, char *extra
)
1161 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1162 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1165 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_WDS
))
1168 if (addr
->sa_family
!= ARPHRD_ETHER
)
1171 if (netif_running(dev
))
1174 if (!rdev
->ops
->set_wds_peer
)
1177 err
= rdev
->ops
->set_wds_peer(wdev
->wiphy
, dev
, (u8
*) &addr
->sa_data
);
1181 memcpy(&wdev
->wext
.bssid
, (u8
*) &addr
->sa_data
, ETH_ALEN
);
1186 static int cfg80211_wds_wext_giwap(struct net_device
*dev
,
1187 struct iw_request_info
*info
,
1188 struct sockaddr
*addr
, char *extra
)
1190 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1192 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_WDS
))
1195 addr
->sa_family
= ARPHRD_ETHER
;
1196 memcpy(&addr
->sa_data
, wdev
->wext
.bssid
, ETH_ALEN
);
1201 int cfg80211_wext_siwrate(struct net_device
*dev
,
1202 struct iw_request_info
*info
,
1203 struct iw_param
*rate
, char *extra
)
1205 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1206 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1207 struct cfg80211_bitrate_mask mask
;
1209 struct ieee80211_supported_band
*sband
;
1213 if (!rdev
->ops
->set_bitrate_mask
)
1216 memset(&mask
, 0, sizeof(mask
));
1220 if (rate
->value
< 0) {
1222 } else if (rate
->fixed
) {
1223 fixed
= rate
->value
/ 100000;
1225 maxrate
= rate
->value
/ 100000;
1228 for (band
= 0; band
< IEEE80211_NUM_BANDS
; band
++) {
1229 sband
= wdev
->wiphy
->bands
[band
];
1232 for (ridx
= 0; ridx
< sband
->n_bitrates
; ridx
++) {
1233 struct ieee80211_rate
*srate
= &sband
->bitrates
[ridx
];
1234 if (fixed
== srate
->bitrate
) {
1235 mask
.control
[band
].legacy
= 1 << ridx
;
1239 if (srate
->bitrate
<= maxrate
) {
1240 mask
.control
[band
].legacy
|= 1 << ridx
;
1249 return rdev
->ops
->set_bitrate_mask(wdev
->wiphy
, dev
, NULL
, &mask
);
1251 EXPORT_SYMBOL_GPL(cfg80211_wext_siwrate
);
1253 int cfg80211_wext_giwrate(struct net_device
*dev
,
1254 struct iw_request_info
*info
,
1255 struct iw_param
*rate
, char *extra
)
1257 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1258 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1259 /* we are under RTNL - globally locked - so can use a static struct */
1260 static struct station_info sinfo
;
1264 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1267 if (!rdev
->ops
->get_station
)
1272 if (wdev
->current_bss
)
1273 memcpy(addr
, wdev
->current_bss
->pub
.bssid
, ETH_ALEN
);
1280 err
= rdev
->ops
->get_station(&rdev
->wiphy
, dev
, addr
, &sinfo
);
1284 if (!(sinfo
.filled
& STATION_INFO_TX_BITRATE
))
1287 rate
->value
= 100000 * cfg80211_calculate_bitrate(&sinfo
.txrate
);
1291 EXPORT_SYMBOL_GPL(cfg80211_wext_giwrate
);
1293 /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
1294 struct iw_statistics
*cfg80211_wireless_stats(struct net_device
*dev
)
1296 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1297 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1298 /* we are under RTNL - globally locked - so can use static structs */
1299 static struct iw_statistics wstats
;
1300 static struct station_info sinfo
;
1303 if (dev
->ieee80211_ptr
->iftype
!= NL80211_IFTYPE_STATION
)
1306 if (!rdev
->ops
->get_station
)
1309 /* Grab BSSID of current BSS, if any */
1311 if (!wdev
->current_bss
) {
1315 memcpy(bssid
, wdev
->current_bss
->pub
.bssid
, ETH_ALEN
);
1318 if (rdev
->ops
->get_station(&rdev
->wiphy
, dev
, bssid
, &sinfo
))
1321 memset(&wstats
, 0, sizeof(wstats
));
1323 switch (rdev
->wiphy
.signal_type
) {
1324 case CFG80211_SIGNAL_TYPE_MBM
:
1325 if (sinfo
.filled
& STATION_INFO_SIGNAL
) {
1326 int sig
= sinfo
.signal
;
1327 wstats
.qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
1328 wstats
.qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
1329 wstats
.qual
.updated
|= IW_QUAL_DBM
;
1330 wstats
.qual
.level
= sig
;
1335 wstats
.qual
.qual
= sig
+ 110;
1338 case CFG80211_SIGNAL_TYPE_UNSPEC
:
1339 if (sinfo
.filled
& STATION_INFO_SIGNAL
) {
1340 wstats
.qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
1341 wstats
.qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
1342 wstats
.qual
.level
= sinfo
.signal
;
1343 wstats
.qual
.qual
= sinfo
.signal
;
1347 wstats
.qual
.updated
|= IW_QUAL_LEVEL_INVALID
;
1348 wstats
.qual
.updated
|= IW_QUAL_QUAL_INVALID
;
1351 wstats
.qual
.updated
|= IW_QUAL_NOISE_INVALID
;
1355 EXPORT_SYMBOL_GPL(cfg80211_wireless_stats
);
1357 int cfg80211_wext_siwap(struct net_device
*dev
,
1358 struct iw_request_info
*info
,
1359 struct sockaddr
*ap_addr
, char *extra
)
1361 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1363 switch (wdev
->iftype
) {
1364 case NL80211_IFTYPE_ADHOC
:
1365 return cfg80211_ibss_wext_siwap(dev
, info
, ap_addr
, extra
);
1366 case NL80211_IFTYPE_STATION
:
1367 return cfg80211_mgd_wext_siwap(dev
, info
, ap_addr
, extra
);
1368 case NL80211_IFTYPE_WDS
:
1369 return cfg80211_wds_wext_siwap(dev
, info
, ap_addr
, extra
);
1374 EXPORT_SYMBOL_GPL(cfg80211_wext_siwap
);
1376 int cfg80211_wext_giwap(struct net_device
*dev
,
1377 struct iw_request_info
*info
,
1378 struct sockaddr
*ap_addr
, char *extra
)
1380 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1382 switch (wdev
->iftype
) {
1383 case NL80211_IFTYPE_ADHOC
:
1384 return cfg80211_ibss_wext_giwap(dev
, info
, ap_addr
, extra
);
1385 case NL80211_IFTYPE_STATION
:
1386 return cfg80211_mgd_wext_giwap(dev
, info
, ap_addr
, extra
);
1387 case NL80211_IFTYPE_WDS
:
1388 return cfg80211_wds_wext_giwap(dev
, info
, ap_addr
, extra
);
1393 EXPORT_SYMBOL_GPL(cfg80211_wext_giwap
);
1395 int cfg80211_wext_siwessid(struct net_device
*dev
,
1396 struct iw_request_info
*info
,
1397 struct iw_point
*data
, char *ssid
)
1399 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1401 switch (wdev
->iftype
) {
1402 case NL80211_IFTYPE_ADHOC
:
1403 return cfg80211_ibss_wext_siwessid(dev
, info
, data
, ssid
);
1404 case NL80211_IFTYPE_STATION
:
1405 return cfg80211_mgd_wext_siwessid(dev
, info
, data
, ssid
);
1410 EXPORT_SYMBOL_GPL(cfg80211_wext_siwessid
);
1412 int cfg80211_wext_giwessid(struct net_device
*dev
,
1413 struct iw_request_info
*info
,
1414 struct iw_point
*data
, char *ssid
)
1416 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1418 switch (wdev
->iftype
) {
1419 case NL80211_IFTYPE_ADHOC
:
1420 return cfg80211_ibss_wext_giwessid(dev
, info
, data
, ssid
);
1421 case NL80211_IFTYPE_STATION
:
1422 return cfg80211_mgd_wext_giwessid(dev
, info
, data
, ssid
);
1427 EXPORT_SYMBOL_GPL(cfg80211_wext_giwessid
);
1429 int cfg80211_wext_siwpmksa(struct net_device
*dev
,
1430 struct iw_request_info
*info
,
1431 struct iw_point
*data
, char *extra
)
1433 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1434 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1435 struct cfg80211_pmksa cfg_pmksa
;
1436 struct iw_pmksa
*pmksa
= (struct iw_pmksa
*)extra
;
1438 memset(&cfg_pmksa
, 0, sizeof(struct cfg80211_pmksa
));
1440 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1443 cfg_pmksa
.bssid
= pmksa
->bssid
.sa_data
;
1444 cfg_pmksa
.pmkid
= pmksa
->pmkid
;
1446 switch (pmksa
->cmd
) {
1448 if (!rdev
->ops
->set_pmksa
)
1451 return rdev
->ops
->set_pmksa(&rdev
->wiphy
, dev
, &cfg_pmksa
);
1453 case IW_PMKSA_REMOVE
:
1454 if (!rdev
->ops
->del_pmksa
)
1457 return rdev
->ops
->del_pmksa(&rdev
->wiphy
, dev
, &cfg_pmksa
);
1459 case IW_PMKSA_FLUSH
:
1460 if (!rdev
->ops
->flush_pmksa
)
1463 return rdev
->ops
->flush_pmksa(&rdev
->wiphy
, dev
);
1470 static const iw_handler cfg80211_handlers
[] = {
1471 [IW_IOCTL_IDX(SIOCGIWNAME
)] = (iw_handler
) cfg80211_wext_giwname
,
1472 [IW_IOCTL_IDX(SIOCSIWFREQ
)] = (iw_handler
) cfg80211_wext_siwfreq
,
1473 [IW_IOCTL_IDX(SIOCGIWFREQ
)] = (iw_handler
) cfg80211_wext_giwfreq
,
1474 [IW_IOCTL_IDX(SIOCSIWMODE
)] = (iw_handler
) cfg80211_wext_siwmode
,
1475 [IW_IOCTL_IDX(SIOCGIWMODE
)] = (iw_handler
) cfg80211_wext_giwmode
,
1476 [IW_IOCTL_IDX(SIOCGIWRANGE
)] = (iw_handler
) cfg80211_wext_giwrange
,
1477 [IW_IOCTL_IDX(SIOCSIWAP
)] = (iw_handler
) cfg80211_wext_siwap
,
1478 [IW_IOCTL_IDX(SIOCGIWAP
)] = (iw_handler
) cfg80211_wext_giwap
,
1479 [IW_IOCTL_IDX(SIOCSIWMLME
)] = (iw_handler
) cfg80211_wext_siwmlme
,
1480 [IW_IOCTL_IDX(SIOCSIWSCAN
)] = (iw_handler
) cfg80211_wext_siwscan
,
1481 [IW_IOCTL_IDX(SIOCGIWSCAN
)] = (iw_handler
) cfg80211_wext_giwscan
,
1482 [IW_IOCTL_IDX(SIOCSIWESSID
)] = (iw_handler
) cfg80211_wext_siwessid
,
1483 [IW_IOCTL_IDX(SIOCGIWESSID
)] = (iw_handler
) cfg80211_wext_giwessid
,
1484 [IW_IOCTL_IDX(SIOCSIWRATE
)] = (iw_handler
) cfg80211_wext_siwrate
,
1485 [IW_IOCTL_IDX(SIOCGIWRATE
)] = (iw_handler
) cfg80211_wext_giwrate
,
1486 [IW_IOCTL_IDX(SIOCSIWRTS
)] = (iw_handler
) cfg80211_wext_siwrts
,
1487 [IW_IOCTL_IDX(SIOCGIWRTS
)] = (iw_handler
) cfg80211_wext_giwrts
,
1488 [IW_IOCTL_IDX(SIOCSIWFRAG
)] = (iw_handler
) cfg80211_wext_siwfrag
,
1489 [IW_IOCTL_IDX(SIOCGIWFRAG
)] = (iw_handler
) cfg80211_wext_giwfrag
,
1490 [IW_IOCTL_IDX(SIOCSIWTXPOW
)] = (iw_handler
) cfg80211_wext_siwtxpower
,
1491 [IW_IOCTL_IDX(SIOCGIWTXPOW
)] = (iw_handler
) cfg80211_wext_giwtxpower
,
1492 [IW_IOCTL_IDX(SIOCSIWRETRY
)] = (iw_handler
) cfg80211_wext_siwretry
,
1493 [IW_IOCTL_IDX(SIOCGIWRETRY
)] = (iw_handler
) cfg80211_wext_giwretry
,
1494 [IW_IOCTL_IDX(SIOCSIWENCODE
)] = (iw_handler
) cfg80211_wext_siwencode
,
1495 [IW_IOCTL_IDX(SIOCGIWENCODE
)] = (iw_handler
) cfg80211_wext_giwencode
,
1496 [IW_IOCTL_IDX(SIOCSIWPOWER
)] = (iw_handler
) cfg80211_wext_siwpower
,
1497 [IW_IOCTL_IDX(SIOCGIWPOWER
)] = (iw_handler
) cfg80211_wext_giwpower
,
1498 [IW_IOCTL_IDX(SIOCSIWGENIE
)] = (iw_handler
) cfg80211_wext_siwgenie
,
1499 [IW_IOCTL_IDX(SIOCSIWAUTH
)] = (iw_handler
) cfg80211_wext_siwauth
,
1500 [IW_IOCTL_IDX(SIOCGIWAUTH
)] = (iw_handler
) cfg80211_wext_giwauth
,
1501 [IW_IOCTL_IDX(SIOCSIWENCODEEXT
)]= (iw_handler
) cfg80211_wext_siwencodeext
,
1502 [IW_IOCTL_IDX(SIOCSIWPMKSA
)] = (iw_handler
) cfg80211_wext_siwpmksa
,
1505 const struct iw_handler_def cfg80211_wext_handler
= {
1506 .num_standard
= ARRAY_SIZE(cfg80211_handlers
),
1507 .standard
= cfg80211_handlers
,
1508 .get_wireless_stats
= cfg80211_wireless_stats
,