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"
23 int cfg80211_wext_giwname(struct net_device
*dev
,
24 struct iw_request_info
*info
,
25 char *name
, char *extra
)
27 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
28 struct ieee80211_supported_band
*sband
;
29 bool is_ht
= false, is_a
= false, is_b
= false, is_g
= false;
34 sband
= wdev
->wiphy
->bands
[IEEE80211_BAND_5GHZ
];
37 is_ht
|= sband
->ht_cap
.ht_supported
;
40 sband
= wdev
->wiphy
->bands
[IEEE80211_BAND_2GHZ
];
43 /* Check for mandatory rates */
44 for (i
= 0; i
< sband
->n_bitrates
; i
++) {
45 if (sband
->bitrates
[i
].bitrate
== 10)
47 if (sband
->bitrates
[i
].bitrate
== 60)
50 is_ht
|= sband
->ht_cap
.ht_supported
;
53 strcpy(name
, "IEEE 802.11");
65 EXPORT_SYMBOL_GPL(cfg80211_wext_giwname
);
67 int cfg80211_wext_siwmode(struct net_device
*dev
, struct iw_request_info
*info
,
68 u32
*mode
, char *extra
)
70 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
71 struct cfg80211_registered_device
*rdev
;
72 struct vif_params vifparams
;
73 enum nl80211_iftype type
;
76 rdev
= wiphy_to_dev(wdev
->wiphy
);
80 type
= NL80211_IFTYPE_STATION
;
83 type
= NL80211_IFTYPE_ADHOC
;
86 type
= NL80211_IFTYPE_WDS
;
89 type
= NL80211_IFTYPE_MONITOR
;
95 if (type
== wdev
->iftype
)
98 memset(&vifparams
, 0, sizeof(vifparams
));
100 cfg80211_lock_rdev(rdev
);
101 ret
= cfg80211_change_iface(rdev
, dev
, type
, NULL
, &vifparams
);
102 cfg80211_unlock_rdev(rdev
);
106 EXPORT_SYMBOL_GPL(cfg80211_wext_siwmode
);
108 int cfg80211_wext_giwmode(struct net_device
*dev
, struct iw_request_info
*info
,
109 u32
*mode
, char *extra
)
111 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
116 switch (wdev
->iftype
) {
117 case NL80211_IFTYPE_AP
:
118 *mode
= IW_MODE_MASTER
;
120 case NL80211_IFTYPE_STATION
:
121 *mode
= IW_MODE_INFRA
;
123 case NL80211_IFTYPE_ADHOC
:
124 *mode
= IW_MODE_ADHOC
;
126 case NL80211_IFTYPE_MONITOR
:
127 *mode
= IW_MODE_MONITOR
;
129 case NL80211_IFTYPE_WDS
:
130 *mode
= IW_MODE_REPEAT
;
132 case NL80211_IFTYPE_AP_VLAN
:
133 *mode
= IW_MODE_SECOND
; /* FIXME */
136 *mode
= IW_MODE_AUTO
;
141 EXPORT_SYMBOL_GPL(cfg80211_wext_giwmode
);
144 int cfg80211_wext_giwrange(struct net_device
*dev
,
145 struct iw_request_info
*info
,
146 struct iw_point
*data
, char *extra
)
148 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
149 struct iw_range
*range
= (struct iw_range
*) extra
;
150 enum ieee80211_band band
;
156 data
->length
= sizeof(struct iw_range
);
157 memset(range
, 0, sizeof(struct iw_range
));
159 range
->we_version_compiled
= WIRELESS_EXT
;
160 range
->we_version_source
= 21;
161 range
->retry_capa
= IW_RETRY_LIMIT
;
162 range
->retry_flags
= IW_RETRY_LIMIT
;
163 range
->min_retry
= 0;
164 range
->max_retry
= 255;
166 range
->max_rts
= 2347;
167 range
->min_frag
= 256;
168 range
->max_frag
= 2346;
170 range
->max_encoding_tokens
= 4;
172 range
->max_qual
.updated
= IW_QUAL_NOISE_INVALID
;
174 switch (wdev
->wiphy
->signal_type
) {
175 case CFG80211_SIGNAL_TYPE_NONE
:
177 case CFG80211_SIGNAL_TYPE_MBM
:
178 range
->max_qual
.level
= -110;
179 range
->max_qual
.qual
= 70;
180 range
->avg_qual
.qual
= 35;
181 range
->max_qual
.updated
|= IW_QUAL_DBM
;
182 range
->max_qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
183 range
->max_qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
185 case CFG80211_SIGNAL_TYPE_UNSPEC
:
186 range
->max_qual
.level
= 100;
187 range
->max_qual
.qual
= 100;
188 range
->avg_qual
.qual
= 50;
189 range
->max_qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
190 range
->max_qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
194 range
->avg_qual
.level
= range
->max_qual
.level
/ 2;
195 range
->avg_qual
.noise
= range
->max_qual
.noise
/ 2;
196 range
->avg_qual
.updated
= range
->max_qual
.updated
;
198 for (i
= 0; i
< wdev
->wiphy
->n_cipher_suites
; i
++) {
199 switch (wdev
->wiphy
->cipher_suites
[i
]) {
200 case WLAN_CIPHER_SUITE_TKIP
:
201 range
->enc_capa
|= (IW_ENC_CAPA_CIPHER_TKIP
|
205 case WLAN_CIPHER_SUITE_CCMP
:
206 range
->enc_capa
|= (IW_ENC_CAPA_CIPHER_CCMP
|
210 case WLAN_CIPHER_SUITE_WEP40
:
211 range
->encoding_size
[range
->num_encoding_sizes
++] =
215 case WLAN_CIPHER_SUITE_WEP104
:
216 range
->encoding_size
[range
->num_encoding_sizes
++] =
222 for (band
= 0; band
< IEEE80211_NUM_BANDS
; band
++) {
223 struct ieee80211_supported_band
*sband
;
225 sband
= wdev
->wiphy
->bands
[band
];
230 for (i
= 0; i
< sband
->n_channels
&& c
< IW_MAX_FREQUENCIES
; i
++) {
231 struct ieee80211_channel
*chan
= &sband
->channels
[i
];
233 if (!(chan
->flags
& IEEE80211_CHAN_DISABLED
)) {
235 ieee80211_frequency_to_channel(
237 range
->freq
[c
].m
= chan
->center_freq
;
238 range
->freq
[c
].e
= 6;
243 range
->num_channels
= c
;
244 range
->num_frequency
= c
;
246 IW_EVENT_CAPA_SET_KERNEL(range
->event_capa
);
247 IW_EVENT_CAPA_SET(range
->event_capa
, SIOCGIWAP
);
248 IW_EVENT_CAPA_SET(range
->event_capa
, SIOCGIWSCAN
);
250 if (wdev
->wiphy
->max_scan_ssids
> 0)
251 range
->scan_capa
|= IW_SCAN_CAPA_ESSID
;
255 EXPORT_SYMBOL_GPL(cfg80211_wext_giwrange
);
259 * cfg80211_wext_freq - get wext frequency for non-"auto"
261 * @freq: the wext freq encoding
263 * Returns a frequency, or a negative error code, or 0 for auto.
265 int cfg80211_wext_freq(struct wiphy
*wiphy
, struct iw_freq
*freq
)
268 * Parse frequency - return 0 for auto and
269 * -EINVAL for impossible things.
272 enum ieee80211_band band
= IEEE80211_BAND_2GHZ
;
276 band
= IEEE80211_BAND_5GHZ
;
277 return ieee80211_channel_to_frequency(freq
->m
, band
);
279 int i
, div
= 1000000;
280 for (i
= 0; i
< freq
->e
; i
++)
284 return freq
->m
/ div
;
288 int cfg80211_wext_siwrts(struct net_device
*dev
,
289 struct iw_request_info
*info
,
290 struct iw_param
*rts
, char *extra
)
292 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
293 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
294 u32 orts
= wdev
->wiphy
->rts_threshold
;
297 if (rts
->disabled
|| !rts
->fixed
)
298 wdev
->wiphy
->rts_threshold
= (u32
) -1;
299 else if (rts
->value
< 0)
302 wdev
->wiphy
->rts_threshold
= rts
->value
;
304 err
= rdev
->ops
->set_wiphy_params(wdev
->wiphy
,
305 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
->ops
->set_wiphy_params(wdev
->wiphy
,
346 WIPHY_PARAM_FRAG_THRESHOLD
);
348 wdev
->wiphy
->frag_threshold
= ofrag
;
352 EXPORT_SYMBOL_GPL(cfg80211_wext_siwfrag
);
354 int cfg80211_wext_giwfrag(struct net_device
*dev
,
355 struct iw_request_info
*info
,
356 struct iw_param
*frag
, char *extra
)
358 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
360 frag
->value
= wdev
->wiphy
->frag_threshold
;
361 frag
->disabled
= frag
->value
== (u32
) -1;
366 EXPORT_SYMBOL_GPL(cfg80211_wext_giwfrag
);
368 static int cfg80211_wext_siwretry(struct net_device
*dev
,
369 struct iw_request_info
*info
,
370 struct iw_param
*retry
, char *extra
)
372 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
373 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
375 u8 olong
= wdev
->wiphy
->retry_long
;
376 u8 oshort
= wdev
->wiphy
->retry_short
;
379 if (retry
->disabled
||
380 (retry
->flags
& IW_RETRY_TYPE
) != IW_RETRY_LIMIT
)
383 if (retry
->flags
& IW_RETRY_LONG
) {
384 wdev
->wiphy
->retry_long
= retry
->value
;
385 changed
|= WIPHY_PARAM_RETRY_LONG
;
386 } else if (retry
->flags
& IW_RETRY_SHORT
) {
387 wdev
->wiphy
->retry_short
= retry
->value
;
388 changed
|= WIPHY_PARAM_RETRY_SHORT
;
390 wdev
->wiphy
->retry_short
= retry
->value
;
391 wdev
->wiphy
->retry_long
= retry
->value
;
392 changed
|= WIPHY_PARAM_RETRY_LONG
;
393 changed
|= WIPHY_PARAM_RETRY_SHORT
;
399 err
= rdev
->ops
->set_wiphy_params(wdev
->wiphy
, changed
);
401 wdev
->wiphy
->retry_short
= oshort
;
402 wdev
->wiphy
->retry_long
= olong
;
408 int cfg80211_wext_giwretry(struct net_device
*dev
,
409 struct iw_request_info
*info
,
410 struct iw_param
*retry
, char *extra
)
412 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
416 if (retry
->flags
== 0 || (retry
->flags
& IW_RETRY_SHORT
)) {
418 * First return short value, iwconfig will ask long value
421 retry
->flags
|= IW_RETRY_LIMIT
;
422 retry
->value
= wdev
->wiphy
->retry_short
;
423 if (wdev
->wiphy
->retry_long
!= wdev
->wiphy
->retry_short
)
424 retry
->flags
|= IW_RETRY_LONG
;
429 if (retry
->flags
& IW_RETRY_LONG
) {
430 retry
->flags
= IW_RETRY_LIMIT
| IW_RETRY_LONG
;
431 retry
->value
= wdev
->wiphy
->retry_long
;
436 EXPORT_SYMBOL_GPL(cfg80211_wext_giwretry
);
438 static int __cfg80211_set_encryption(struct cfg80211_registered_device
*rdev
,
439 struct net_device
*dev
, bool pairwise
,
440 const u8
*addr
, bool remove
, bool tx_key
,
441 int idx
, struct key_params
*params
)
443 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
447 if (pairwise
&& !addr
)
450 if (!wdev
->wext
.keys
) {
451 wdev
->wext
.keys
= kzalloc(sizeof(*wdev
->wext
.keys
),
453 if (!wdev
->wext
.keys
)
455 for (i
= 0; i
< 6; i
++)
456 wdev
->wext
.keys
->params
[i
].key
=
457 wdev
->wext
.keys
->data
[i
];
460 if (wdev
->iftype
!= NL80211_IFTYPE_ADHOC
&&
461 wdev
->iftype
!= NL80211_IFTYPE_STATION
)
464 if (params
->cipher
== WLAN_CIPHER_SUITE_AES_CMAC
) {
465 if (!wdev
->current_bss
)
468 if (!rdev
->ops
->set_default_mgmt_key
)
471 if (idx
< 4 || idx
> 5)
473 } else if (idx
< 0 || idx
> 3)
478 if (wdev
->current_bss
) {
480 * If removing the current TX key, we will need to
481 * join a new IBSS without the privacy bit clear.
483 if (idx
== wdev
->wext
.default_key
&&
484 wdev
->iftype
== NL80211_IFTYPE_ADHOC
) {
485 __cfg80211_leave_ibss(rdev
, wdev
->netdev
, true);
489 if (!pairwise
&& addr
&&
490 !(rdev
->wiphy
.flags
& WIPHY_FLAG_IBSS_RSN
))
493 err
= rdev
->ops
->del_key(&rdev
->wiphy
, dev
, idx
,
496 wdev
->wext
.connect
.privacy
= false;
498 * Applications using wireless extensions expect to be
499 * able to delete keys that don't exist, so allow that.
505 wdev
->wext
.keys
->params
[idx
].key_len
= 0;
506 wdev
->wext
.keys
->params
[idx
].cipher
= 0;
508 if (idx
== wdev
->wext
.default_key
)
509 wdev
->wext
.default_key
= -1;
510 else if (idx
== wdev
->wext
.default_mgmt_key
)
511 wdev
->wext
.default_mgmt_key
= -1;
515 err
= cfg80211_ibss_wext_join(rdev
, wdev
);
523 if (cfg80211_validate_key_settings(rdev
, params
, idx
, pairwise
, addr
))
527 if (wdev
->current_bss
)
528 err
= rdev
->ops
->add_key(&rdev
->wiphy
, dev
, idx
,
529 pairwise
, addr
, params
);
534 wdev
->wext
.keys
->params
[idx
] = *params
;
535 memcpy(wdev
->wext
.keys
->data
[idx
],
536 params
->key
, params
->key_len
);
537 wdev
->wext
.keys
->params
[idx
].key
=
538 wdev
->wext
.keys
->data
[idx
];
541 if ((params
->cipher
== WLAN_CIPHER_SUITE_WEP40
||
542 params
->cipher
== WLAN_CIPHER_SUITE_WEP104
) &&
543 (tx_key
|| (!addr
&& wdev
->wext
.default_key
== -1))) {
544 if (wdev
->current_bss
) {
546 * If we are getting a new TX key from not having
547 * had one before we need to join a new IBSS with
548 * the privacy bit set.
550 if (wdev
->iftype
== NL80211_IFTYPE_ADHOC
&&
551 wdev
->wext
.default_key
== -1) {
552 __cfg80211_leave_ibss(rdev
, wdev
->netdev
, true);
555 err
= rdev
->ops
->set_default_key(&rdev
->wiphy
, dev
,
559 wdev
->wext
.default_key
= idx
;
561 err
= cfg80211_ibss_wext_join(rdev
, wdev
);
566 if (params
->cipher
== WLAN_CIPHER_SUITE_AES_CMAC
&&
567 (tx_key
|| (!addr
&& wdev
->wext
.default_mgmt_key
== -1))) {
568 if (wdev
->current_bss
)
569 err
= rdev
->ops
->set_default_mgmt_key(&rdev
->wiphy
,
572 wdev
->wext
.default_mgmt_key
= idx
;
579 static int cfg80211_set_encryption(struct cfg80211_registered_device
*rdev
,
580 struct net_device
*dev
, bool pairwise
,
581 const u8
*addr
, bool remove
, bool tx_key
,
582 int idx
, struct key_params
*params
)
586 /* devlist mutex needed for possible IBSS re-join */
587 mutex_lock(&rdev
->devlist_mtx
);
588 wdev_lock(dev
->ieee80211_ptr
);
589 err
= __cfg80211_set_encryption(rdev
, dev
, pairwise
, addr
,
590 remove
, tx_key
, idx
, params
);
591 wdev_unlock(dev
->ieee80211_ptr
);
592 mutex_unlock(&rdev
->devlist_mtx
);
597 static int cfg80211_wext_siwencode(struct net_device
*dev
,
598 struct iw_request_info
*info
,
599 struct iw_point
*erq
, char *keybuf
)
601 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
602 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
605 struct key_params params
;
607 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
608 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
611 /* no use -- only MFP (set_default_mgmt_key) is optional */
612 if (!rdev
->ops
->del_key
||
613 !rdev
->ops
->add_key
||
614 !rdev
->ops
->set_default_key
)
617 idx
= erq
->flags
& IW_ENCODE_INDEX
;
619 idx
= wdev
->wext
.default_key
;
622 } else if (idx
< 1 || idx
> 4)
627 if (erq
->flags
& IW_ENCODE_DISABLED
)
629 else if (erq
->length
== 0) {
630 /* No key data - just set the default TX key index */
633 if (wdev
->current_bss
)
634 err
= rdev
->ops
->set_default_key(&rdev
->wiphy
, dev
,
637 wdev
->wext
.default_key
= idx
;
642 memset(¶ms
, 0, sizeof(params
));
644 params
.key_len
= erq
->length
;
645 if (erq
->length
== 5)
646 params
.cipher
= WLAN_CIPHER_SUITE_WEP40
;
647 else if (erq
->length
== 13)
648 params
.cipher
= WLAN_CIPHER_SUITE_WEP104
;
652 return cfg80211_set_encryption(rdev
, dev
, false, NULL
, remove
,
653 wdev
->wext
.default_key
== -1,
657 static int cfg80211_wext_siwencodeext(struct net_device
*dev
,
658 struct iw_request_info
*info
,
659 struct iw_point
*erq
, char *extra
)
661 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
662 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
663 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*) extra
;
667 struct key_params params
;
670 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
671 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
674 /* no use -- only MFP (set_default_mgmt_key) is optional */
675 if (!rdev
->ops
->del_key
||
676 !rdev
->ops
->add_key
||
677 !rdev
->ops
->set_default_key
)
681 case IW_ENCODE_ALG_NONE
:
685 case IW_ENCODE_ALG_WEP
:
686 if (ext
->key_len
== 5)
687 cipher
= WLAN_CIPHER_SUITE_WEP40
;
688 else if (ext
->key_len
== 13)
689 cipher
= WLAN_CIPHER_SUITE_WEP104
;
693 case IW_ENCODE_ALG_TKIP
:
694 cipher
= WLAN_CIPHER_SUITE_TKIP
;
696 case IW_ENCODE_ALG_CCMP
:
697 cipher
= WLAN_CIPHER_SUITE_CCMP
;
699 case IW_ENCODE_ALG_AES_CMAC
:
700 cipher
= WLAN_CIPHER_SUITE_AES_CMAC
;
706 if (erq
->flags
& IW_ENCODE_DISABLED
)
709 idx
= erq
->flags
& IW_ENCODE_INDEX
;
710 if (cipher
== WLAN_CIPHER_SUITE_AES_CMAC
) {
711 if (idx
< 4 || idx
> 5) {
712 idx
= wdev
->wext
.default_mgmt_key
;
718 if (idx
< 1 || idx
> 4) {
719 idx
= wdev
->wext
.default_key
;
726 addr
= ext
->addr
.sa_data
;
727 if (is_broadcast_ether_addr(addr
))
730 memset(¶ms
, 0, sizeof(params
));
731 params
.key
= ext
->key
;
732 params
.key_len
= ext
->key_len
;
733 params
.cipher
= cipher
;
735 if (ext
->ext_flags
& IW_ENCODE_EXT_RX_SEQ_VALID
) {
736 params
.seq
= ext
->rx_seq
;
740 return cfg80211_set_encryption(
742 !(ext
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
),
744 ext
->ext_flags
& IW_ENCODE_EXT_SET_TX_KEY
,
748 static int cfg80211_wext_giwencode(struct net_device
*dev
,
749 struct iw_request_info
*info
,
750 struct iw_point
*erq
, char *keybuf
)
752 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
755 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
756 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
759 idx
= erq
->flags
& IW_ENCODE_INDEX
;
761 idx
= wdev
->wext
.default_key
;
764 } else if (idx
< 1 || idx
> 4)
769 erq
->flags
= idx
+ 1;
771 if (!wdev
->wext
.keys
|| !wdev
->wext
.keys
->params
[idx
].cipher
) {
772 erq
->flags
|= IW_ENCODE_DISABLED
;
777 erq
->length
= min_t(size_t, erq
->length
,
778 wdev
->wext
.keys
->params
[idx
].key_len
);
779 memcpy(keybuf
, wdev
->wext
.keys
->params
[idx
].key
, erq
->length
);
780 erq
->flags
|= IW_ENCODE_ENABLED
;
785 static int cfg80211_wext_siwfreq(struct net_device
*dev
,
786 struct iw_request_info
*info
,
787 struct iw_freq
*wextfreq
, char *extra
)
789 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
790 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
793 switch (wdev
->iftype
) {
794 case NL80211_IFTYPE_STATION
:
795 return cfg80211_mgd_wext_siwfreq(dev
, info
, wextfreq
, extra
);
796 case NL80211_IFTYPE_ADHOC
:
797 return cfg80211_ibss_wext_siwfreq(dev
, info
, wextfreq
, extra
);
798 case NL80211_IFTYPE_MONITOR
:
799 freq
= cfg80211_wext_freq(wdev
->wiphy
, wextfreq
);
804 mutex_lock(&rdev
->devlist_mtx
);
805 err
= cfg80211_set_monitor_channel(rdev
, freq
, NL80211_CHAN_NO_HT
);
806 mutex_unlock(&rdev
->devlist_mtx
);
808 case NL80211_IFTYPE_MESH_POINT
:
809 freq
= cfg80211_wext_freq(wdev
->wiphy
, wextfreq
);
814 mutex_lock(&rdev
->devlist_mtx
);
815 err
= cfg80211_set_mesh_freq(rdev
, wdev
, freq
,
817 mutex_unlock(&rdev
->devlist_mtx
);
824 static int cfg80211_wext_giwfreq(struct net_device
*dev
,
825 struct iw_request_info
*info
,
826 struct iw_freq
*freq
, char *extra
)
828 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
829 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
831 switch (wdev
->iftype
) {
832 case NL80211_IFTYPE_STATION
:
833 return cfg80211_mgd_wext_giwfreq(dev
, info
, freq
, extra
);
834 case NL80211_IFTYPE_ADHOC
:
835 return cfg80211_ibss_wext_giwfreq(dev
, info
, freq
, extra
);
836 case NL80211_IFTYPE_MONITOR
:
837 if (!rdev
->monitor_channel
)
840 freq
->m
= rdev
->monitor_channel
->center_freq
;
848 static int cfg80211_wext_siwtxpower(struct net_device
*dev
,
849 struct iw_request_info
*info
,
850 union iwreq_data
*data
, char *extra
)
852 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
853 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
854 enum nl80211_tx_power_setting type
;
857 if ((data
->txpower
.flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
)
859 if (data
->txpower
.flags
& IW_TXPOW_RANGE
)
862 if (!rdev
->ops
->set_tx_power
)
865 /* only change when not disabling */
866 if (!data
->txpower
.disabled
) {
867 rfkill_set_sw_state(rdev
->rfkill
, false);
869 if (data
->txpower
.fixed
) {
871 * wext doesn't support negative values, see
872 * below where it's for automatic
874 if (data
->txpower
.value
< 0)
876 dbm
= data
->txpower
.value
;
877 type
= NL80211_TX_POWER_FIXED
;
878 /* TODO: do regulatory check! */
881 * Automatic power level setting, max being the value
882 * passed in from userland.
884 if (data
->txpower
.value
< 0) {
885 type
= NL80211_TX_POWER_AUTOMATIC
;
887 dbm
= data
->txpower
.value
;
888 type
= NL80211_TX_POWER_LIMITED
;
892 rfkill_set_sw_state(rdev
->rfkill
, true);
893 schedule_work(&rdev
->rfkill_sync
);
897 return rdev
->ops
->set_tx_power(wdev
->wiphy
, type
, DBM_TO_MBM(dbm
));
900 static int cfg80211_wext_giwtxpower(struct net_device
*dev
,
901 struct iw_request_info
*info
,
902 union iwreq_data
*data
, char *extra
)
904 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
905 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
908 if ((data
->txpower
.flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
)
910 if (data
->txpower
.flags
& IW_TXPOW_RANGE
)
913 if (!rdev
->ops
->get_tx_power
)
916 err
= rdev
->ops
->get_tx_power(wdev
->wiphy
, &val
);
920 /* well... oh well */
921 data
->txpower
.fixed
= 1;
922 data
->txpower
.disabled
= rfkill_blocked(rdev
->rfkill
);
923 data
->txpower
.value
= val
;
924 data
->txpower
.flags
= IW_TXPOW_DBM
;
929 static int cfg80211_set_auth_alg(struct wireless_dev
*wdev
,
937 if (auth_alg
& ~(IW_AUTH_ALG_OPEN_SYSTEM
|
938 IW_AUTH_ALG_SHARED_KEY
|
942 if (auth_alg
& IW_AUTH_ALG_OPEN_SYSTEM
) {
944 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_OPEN_SYSTEM
;
947 if (auth_alg
& IW_AUTH_ALG_SHARED_KEY
) {
949 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_SHARED_KEY
;
952 if (auth_alg
& IW_AUTH_ALG_LEAP
) {
954 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_NETWORK_EAP
;
958 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_AUTOMATIC
;
963 static int cfg80211_set_wpa_version(struct wireless_dev
*wdev
, u32 wpa_versions
)
965 if (wpa_versions
& ~(IW_AUTH_WPA_VERSION_WPA
|
966 IW_AUTH_WPA_VERSION_WPA2
|
967 IW_AUTH_WPA_VERSION_DISABLED
))
970 if ((wpa_versions
& IW_AUTH_WPA_VERSION_DISABLED
) &&
971 (wpa_versions
& (IW_AUTH_WPA_VERSION_WPA
|
972 IW_AUTH_WPA_VERSION_WPA2
)))
975 if (wpa_versions
& IW_AUTH_WPA_VERSION_DISABLED
)
976 wdev
->wext
.connect
.crypto
.wpa_versions
&=
977 ~(NL80211_WPA_VERSION_1
|NL80211_WPA_VERSION_2
);
979 if (wpa_versions
& IW_AUTH_WPA_VERSION_WPA
)
980 wdev
->wext
.connect
.crypto
.wpa_versions
|=
981 NL80211_WPA_VERSION_1
;
983 if (wpa_versions
& IW_AUTH_WPA_VERSION_WPA2
)
984 wdev
->wext
.connect
.crypto
.wpa_versions
|=
985 NL80211_WPA_VERSION_2
;
990 static int cfg80211_set_cipher_group(struct wireless_dev
*wdev
, u32 cipher
)
992 if (cipher
& IW_AUTH_CIPHER_WEP40
)
993 wdev
->wext
.connect
.crypto
.cipher_group
=
994 WLAN_CIPHER_SUITE_WEP40
;
995 else if (cipher
& IW_AUTH_CIPHER_WEP104
)
996 wdev
->wext
.connect
.crypto
.cipher_group
=
997 WLAN_CIPHER_SUITE_WEP104
;
998 else if (cipher
& IW_AUTH_CIPHER_TKIP
)
999 wdev
->wext
.connect
.crypto
.cipher_group
=
1000 WLAN_CIPHER_SUITE_TKIP
;
1001 else if (cipher
& IW_AUTH_CIPHER_CCMP
)
1002 wdev
->wext
.connect
.crypto
.cipher_group
=
1003 WLAN_CIPHER_SUITE_CCMP
;
1004 else if (cipher
& IW_AUTH_CIPHER_AES_CMAC
)
1005 wdev
->wext
.connect
.crypto
.cipher_group
=
1006 WLAN_CIPHER_SUITE_AES_CMAC
;
1007 else if (cipher
& IW_AUTH_CIPHER_NONE
)
1008 wdev
->wext
.connect
.crypto
.cipher_group
= 0;
1015 static int cfg80211_set_cipher_pairwise(struct wireless_dev
*wdev
, u32 cipher
)
1018 u32
*ciphers_pairwise
= wdev
->wext
.connect
.crypto
.ciphers_pairwise
;
1020 if (cipher
& IW_AUTH_CIPHER_WEP40
) {
1021 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_WEP40
;
1025 if (cipher
& IW_AUTH_CIPHER_WEP104
) {
1026 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_WEP104
;
1030 if (cipher
& IW_AUTH_CIPHER_TKIP
) {
1031 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_TKIP
;
1035 if (cipher
& IW_AUTH_CIPHER_CCMP
) {
1036 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_CCMP
;
1040 if (cipher
& IW_AUTH_CIPHER_AES_CMAC
) {
1041 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_AES_CMAC
;
1045 BUILD_BUG_ON(NL80211_MAX_NR_CIPHER_SUITES
< 5);
1047 wdev
->wext
.connect
.crypto
.n_ciphers_pairwise
= nr_ciphers
;
1053 static int cfg80211_set_key_mgt(struct wireless_dev
*wdev
, u32 key_mgt
)
1055 int nr_akm_suites
= 0;
1057 if (key_mgt
& ~(IW_AUTH_KEY_MGMT_802_1X
|
1058 IW_AUTH_KEY_MGMT_PSK
))
1061 if (key_mgt
& IW_AUTH_KEY_MGMT_802_1X
) {
1062 wdev
->wext
.connect
.crypto
.akm_suites
[nr_akm_suites
] =
1063 WLAN_AKM_SUITE_8021X
;
1067 if (key_mgt
& IW_AUTH_KEY_MGMT_PSK
) {
1068 wdev
->wext
.connect
.crypto
.akm_suites
[nr_akm_suites
] =
1073 wdev
->wext
.connect
.crypto
.n_akm_suites
= nr_akm_suites
;
1078 static int cfg80211_wext_siwauth(struct net_device
*dev
,
1079 struct iw_request_info
*info
,
1080 struct iw_param
*data
, char *extra
)
1082 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1084 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1087 switch (data
->flags
& IW_AUTH_INDEX
) {
1088 case IW_AUTH_PRIVACY_INVOKED
:
1089 wdev
->wext
.connect
.privacy
= data
->value
;
1091 case IW_AUTH_WPA_VERSION
:
1092 return cfg80211_set_wpa_version(wdev
, data
->value
);
1093 case IW_AUTH_CIPHER_GROUP
:
1094 return cfg80211_set_cipher_group(wdev
, data
->value
);
1095 case IW_AUTH_KEY_MGMT
:
1096 return cfg80211_set_key_mgt(wdev
, data
->value
);
1097 case IW_AUTH_CIPHER_PAIRWISE
:
1098 return cfg80211_set_cipher_pairwise(wdev
, data
->value
);
1099 case IW_AUTH_80211_AUTH_ALG
:
1100 return cfg80211_set_auth_alg(wdev
, data
->value
);
1101 case IW_AUTH_WPA_ENABLED
:
1102 case IW_AUTH_RX_UNENCRYPTED_EAPOL
:
1103 case IW_AUTH_DROP_UNENCRYPTED
:
1111 static int cfg80211_wext_giwauth(struct net_device
*dev
,
1112 struct iw_request_info
*info
,
1113 struct iw_param
*data
, char *extra
)
1115 /* XXX: what do we need? */
1120 static int cfg80211_wext_siwpower(struct net_device
*dev
,
1121 struct iw_request_info
*info
,
1122 struct iw_param
*wrq
, char *extra
)
1124 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1125 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1127 int timeout
= wdev
->ps_timeout
;
1130 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1133 if (!rdev
->ops
->set_power_mgmt
)
1136 if (wrq
->disabled
) {
1139 switch (wrq
->flags
& IW_POWER_MODE
) {
1140 case IW_POWER_ON
: /* If not specified */
1141 case IW_POWER_MODE
: /* If set all mask */
1142 case IW_POWER_ALL_R
: /* If explicitely state all */
1145 default: /* Otherwise we ignore */
1149 if (wrq
->flags
& ~(IW_POWER_MODE
| IW_POWER_TIMEOUT
))
1152 if (wrq
->flags
& IW_POWER_TIMEOUT
)
1153 timeout
= wrq
->value
/ 1000;
1156 err
= rdev
->ops
->set_power_mgmt(wdev
->wiphy
, dev
, ps
, timeout
);
1161 wdev
->ps_timeout
= timeout
;
1167 static int cfg80211_wext_giwpower(struct net_device
*dev
,
1168 struct iw_request_info
*info
,
1169 struct iw_param
*wrq
, char *extra
)
1171 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1173 wrq
->disabled
= !wdev
->ps
;
1178 static int cfg80211_wds_wext_siwap(struct net_device
*dev
,
1179 struct iw_request_info
*info
,
1180 struct sockaddr
*addr
, char *extra
)
1182 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1183 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1186 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_WDS
))
1189 if (addr
->sa_family
!= ARPHRD_ETHER
)
1192 if (netif_running(dev
))
1195 if (!rdev
->ops
->set_wds_peer
)
1198 err
= rdev
->ops
->set_wds_peer(wdev
->wiphy
, dev
, (u8
*) &addr
->sa_data
);
1202 memcpy(&wdev
->wext
.bssid
, (u8
*) &addr
->sa_data
, ETH_ALEN
);
1207 static int cfg80211_wds_wext_giwap(struct net_device
*dev
,
1208 struct iw_request_info
*info
,
1209 struct sockaddr
*addr
, char *extra
)
1211 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1213 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_WDS
))
1216 addr
->sa_family
= ARPHRD_ETHER
;
1217 memcpy(&addr
->sa_data
, wdev
->wext
.bssid
, ETH_ALEN
);
1222 static int cfg80211_wext_siwrate(struct net_device
*dev
,
1223 struct iw_request_info
*info
,
1224 struct iw_param
*rate
, char *extra
)
1226 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1227 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1228 struct cfg80211_bitrate_mask mask
;
1230 struct ieee80211_supported_band
*sband
;
1234 if (!rdev
->ops
->set_bitrate_mask
)
1237 memset(&mask
, 0, sizeof(mask
));
1241 if (rate
->value
< 0) {
1243 } else if (rate
->fixed
) {
1244 fixed
= rate
->value
/ 100000;
1246 maxrate
= rate
->value
/ 100000;
1249 for (band
= 0; band
< IEEE80211_NUM_BANDS
; band
++) {
1250 sband
= wdev
->wiphy
->bands
[band
];
1253 for (ridx
= 0; ridx
< sband
->n_bitrates
; ridx
++) {
1254 struct ieee80211_rate
*srate
= &sband
->bitrates
[ridx
];
1255 if (fixed
== srate
->bitrate
) {
1256 mask
.control
[band
].legacy
= 1 << ridx
;
1260 if (srate
->bitrate
<= maxrate
) {
1261 mask
.control
[band
].legacy
|= 1 << ridx
;
1270 return rdev
->ops
->set_bitrate_mask(wdev
->wiphy
, dev
, NULL
, &mask
);
1273 static int cfg80211_wext_giwrate(struct net_device
*dev
,
1274 struct iw_request_info
*info
,
1275 struct iw_param
*rate
, char *extra
)
1277 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1278 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1279 /* we are under RTNL - globally locked - so can use a static struct */
1280 static struct station_info sinfo
;
1284 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1287 if (!rdev
->ops
->get_station
)
1292 if (wdev
->current_bss
)
1293 memcpy(addr
, wdev
->current_bss
->pub
.bssid
, ETH_ALEN
);
1300 err
= rdev
->ops
->get_station(&rdev
->wiphy
, dev
, addr
, &sinfo
);
1304 if (!(sinfo
.filled
& STATION_INFO_TX_BITRATE
))
1307 rate
->value
= 100000 * cfg80211_calculate_bitrate(&sinfo
.txrate
);
1312 /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
1313 static struct iw_statistics
*cfg80211_wireless_stats(struct net_device
*dev
)
1315 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1316 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1317 /* we are under RTNL - globally locked - so can use static structs */
1318 static struct iw_statistics wstats
;
1319 static struct station_info sinfo
;
1322 if (dev
->ieee80211_ptr
->iftype
!= NL80211_IFTYPE_STATION
)
1325 if (!rdev
->ops
->get_station
)
1328 /* Grab BSSID of current BSS, if any */
1330 if (!wdev
->current_bss
) {
1334 memcpy(bssid
, wdev
->current_bss
->pub
.bssid
, ETH_ALEN
);
1337 if (rdev
->ops
->get_station(&rdev
->wiphy
, dev
, bssid
, &sinfo
))
1340 memset(&wstats
, 0, sizeof(wstats
));
1342 switch (rdev
->wiphy
.signal_type
) {
1343 case CFG80211_SIGNAL_TYPE_MBM
:
1344 if (sinfo
.filled
& STATION_INFO_SIGNAL
) {
1345 int sig
= sinfo
.signal
;
1346 wstats
.qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
1347 wstats
.qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
1348 wstats
.qual
.updated
|= IW_QUAL_DBM
;
1349 wstats
.qual
.level
= sig
;
1354 wstats
.qual
.qual
= sig
+ 110;
1357 case CFG80211_SIGNAL_TYPE_UNSPEC
:
1358 if (sinfo
.filled
& STATION_INFO_SIGNAL
) {
1359 wstats
.qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
1360 wstats
.qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
1361 wstats
.qual
.level
= sinfo
.signal
;
1362 wstats
.qual
.qual
= sinfo
.signal
;
1366 wstats
.qual
.updated
|= IW_QUAL_LEVEL_INVALID
;
1367 wstats
.qual
.updated
|= IW_QUAL_QUAL_INVALID
;
1370 wstats
.qual
.updated
|= IW_QUAL_NOISE_INVALID
;
1371 if (sinfo
.filled
& STATION_INFO_RX_DROP_MISC
)
1372 wstats
.discard
.misc
= sinfo
.rx_dropped_misc
;
1373 if (sinfo
.filled
& STATION_INFO_TX_FAILED
)
1374 wstats
.discard
.retries
= sinfo
.tx_failed
;
1379 static int cfg80211_wext_siwap(struct net_device
*dev
,
1380 struct iw_request_info
*info
,
1381 struct sockaddr
*ap_addr
, char *extra
)
1383 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1385 switch (wdev
->iftype
) {
1386 case NL80211_IFTYPE_ADHOC
:
1387 return cfg80211_ibss_wext_siwap(dev
, info
, ap_addr
, extra
);
1388 case NL80211_IFTYPE_STATION
:
1389 return cfg80211_mgd_wext_siwap(dev
, info
, ap_addr
, extra
);
1390 case NL80211_IFTYPE_WDS
:
1391 return cfg80211_wds_wext_siwap(dev
, info
, ap_addr
, extra
);
1397 static int cfg80211_wext_giwap(struct net_device
*dev
,
1398 struct iw_request_info
*info
,
1399 struct sockaddr
*ap_addr
, char *extra
)
1401 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1403 switch (wdev
->iftype
) {
1404 case NL80211_IFTYPE_ADHOC
:
1405 return cfg80211_ibss_wext_giwap(dev
, info
, ap_addr
, extra
);
1406 case NL80211_IFTYPE_STATION
:
1407 return cfg80211_mgd_wext_giwap(dev
, info
, ap_addr
, extra
);
1408 case NL80211_IFTYPE_WDS
:
1409 return cfg80211_wds_wext_giwap(dev
, info
, ap_addr
, extra
);
1415 static int cfg80211_wext_siwessid(struct net_device
*dev
,
1416 struct iw_request_info
*info
,
1417 struct iw_point
*data
, char *ssid
)
1419 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1421 switch (wdev
->iftype
) {
1422 case NL80211_IFTYPE_ADHOC
:
1423 return cfg80211_ibss_wext_siwessid(dev
, info
, data
, ssid
);
1424 case NL80211_IFTYPE_STATION
:
1425 return cfg80211_mgd_wext_siwessid(dev
, info
, data
, ssid
);
1431 static int cfg80211_wext_giwessid(struct net_device
*dev
,
1432 struct iw_request_info
*info
,
1433 struct iw_point
*data
, char *ssid
)
1435 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1440 switch (wdev
->iftype
) {
1441 case NL80211_IFTYPE_ADHOC
:
1442 return cfg80211_ibss_wext_giwessid(dev
, info
, data
, ssid
);
1443 case NL80211_IFTYPE_STATION
:
1444 return cfg80211_mgd_wext_giwessid(dev
, info
, data
, ssid
);
1450 static int cfg80211_wext_siwpmksa(struct net_device
*dev
,
1451 struct iw_request_info
*info
,
1452 struct iw_point
*data
, char *extra
)
1454 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1455 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1456 struct cfg80211_pmksa cfg_pmksa
;
1457 struct iw_pmksa
*pmksa
= (struct iw_pmksa
*)extra
;
1459 memset(&cfg_pmksa
, 0, sizeof(struct cfg80211_pmksa
));
1461 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1464 cfg_pmksa
.bssid
= pmksa
->bssid
.sa_data
;
1465 cfg_pmksa
.pmkid
= pmksa
->pmkid
;
1467 switch (pmksa
->cmd
) {
1469 if (!rdev
->ops
->set_pmksa
)
1472 return rdev
->ops
->set_pmksa(&rdev
->wiphy
, dev
, &cfg_pmksa
);
1474 case IW_PMKSA_REMOVE
:
1475 if (!rdev
->ops
->del_pmksa
)
1478 return rdev
->ops
->del_pmksa(&rdev
->wiphy
, dev
, &cfg_pmksa
);
1480 case IW_PMKSA_FLUSH
:
1481 if (!rdev
->ops
->flush_pmksa
)
1484 return rdev
->ops
->flush_pmksa(&rdev
->wiphy
, dev
);
1491 static const iw_handler cfg80211_handlers
[] = {
1492 [IW_IOCTL_IDX(SIOCGIWNAME
)] = (iw_handler
) cfg80211_wext_giwname
,
1493 [IW_IOCTL_IDX(SIOCSIWFREQ
)] = (iw_handler
) cfg80211_wext_siwfreq
,
1494 [IW_IOCTL_IDX(SIOCGIWFREQ
)] = (iw_handler
) cfg80211_wext_giwfreq
,
1495 [IW_IOCTL_IDX(SIOCSIWMODE
)] = (iw_handler
) cfg80211_wext_siwmode
,
1496 [IW_IOCTL_IDX(SIOCGIWMODE
)] = (iw_handler
) cfg80211_wext_giwmode
,
1497 [IW_IOCTL_IDX(SIOCGIWRANGE
)] = (iw_handler
) cfg80211_wext_giwrange
,
1498 [IW_IOCTL_IDX(SIOCSIWAP
)] = (iw_handler
) cfg80211_wext_siwap
,
1499 [IW_IOCTL_IDX(SIOCGIWAP
)] = (iw_handler
) cfg80211_wext_giwap
,
1500 [IW_IOCTL_IDX(SIOCSIWMLME
)] = (iw_handler
) cfg80211_wext_siwmlme
,
1501 [IW_IOCTL_IDX(SIOCSIWSCAN
)] = (iw_handler
) cfg80211_wext_siwscan
,
1502 [IW_IOCTL_IDX(SIOCGIWSCAN
)] = (iw_handler
) cfg80211_wext_giwscan
,
1503 [IW_IOCTL_IDX(SIOCSIWESSID
)] = (iw_handler
) cfg80211_wext_siwessid
,
1504 [IW_IOCTL_IDX(SIOCGIWESSID
)] = (iw_handler
) cfg80211_wext_giwessid
,
1505 [IW_IOCTL_IDX(SIOCSIWRATE
)] = (iw_handler
) cfg80211_wext_siwrate
,
1506 [IW_IOCTL_IDX(SIOCGIWRATE
)] = (iw_handler
) cfg80211_wext_giwrate
,
1507 [IW_IOCTL_IDX(SIOCSIWRTS
)] = (iw_handler
) cfg80211_wext_siwrts
,
1508 [IW_IOCTL_IDX(SIOCGIWRTS
)] = (iw_handler
) cfg80211_wext_giwrts
,
1509 [IW_IOCTL_IDX(SIOCSIWFRAG
)] = (iw_handler
) cfg80211_wext_siwfrag
,
1510 [IW_IOCTL_IDX(SIOCGIWFRAG
)] = (iw_handler
) cfg80211_wext_giwfrag
,
1511 [IW_IOCTL_IDX(SIOCSIWTXPOW
)] = (iw_handler
) cfg80211_wext_siwtxpower
,
1512 [IW_IOCTL_IDX(SIOCGIWTXPOW
)] = (iw_handler
) cfg80211_wext_giwtxpower
,
1513 [IW_IOCTL_IDX(SIOCSIWRETRY
)] = (iw_handler
) cfg80211_wext_siwretry
,
1514 [IW_IOCTL_IDX(SIOCGIWRETRY
)] = (iw_handler
) cfg80211_wext_giwretry
,
1515 [IW_IOCTL_IDX(SIOCSIWENCODE
)] = (iw_handler
) cfg80211_wext_siwencode
,
1516 [IW_IOCTL_IDX(SIOCGIWENCODE
)] = (iw_handler
) cfg80211_wext_giwencode
,
1517 [IW_IOCTL_IDX(SIOCSIWPOWER
)] = (iw_handler
) cfg80211_wext_siwpower
,
1518 [IW_IOCTL_IDX(SIOCGIWPOWER
)] = (iw_handler
) cfg80211_wext_giwpower
,
1519 [IW_IOCTL_IDX(SIOCSIWGENIE
)] = (iw_handler
) cfg80211_wext_siwgenie
,
1520 [IW_IOCTL_IDX(SIOCSIWAUTH
)] = (iw_handler
) cfg80211_wext_siwauth
,
1521 [IW_IOCTL_IDX(SIOCGIWAUTH
)] = (iw_handler
) cfg80211_wext_giwauth
,
1522 [IW_IOCTL_IDX(SIOCSIWENCODEEXT
)]= (iw_handler
) cfg80211_wext_siwencodeext
,
1523 [IW_IOCTL_IDX(SIOCSIWPMKSA
)] = (iw_handler
) cfg80211_wext_siwpmksa
,
1526 const struct iw_handler_def cfg80211_wext_handler
= {
1527 .num_standard
= ARRAY_SIZE(cfg80211_handlers
),
1528 .standard
= cfg80211_handlers
,
1529 .get_wireless_stats
= cfg80211_wireless_stats
,