2 * cfg80211 - wext compat code
4 * This is temporary code until all wireless functionality is migrated
5 * into cfg80211, when that happens all the exports here go away and
6 * we directly assign the wireless handlers of wireless interfaces.
8 * Copyright 2008-2009 Johannes Berg <johannes@sipsolutions.net>
11 #include <linux/export.h>
12 #include <linux/wireless.h>
13 #include <linux/nl80211.h>
14 #include <linux/if_arp.h>
15 #include <linux/etherdevice.h>
16 #include <linux/slab.h>
17 #include <net/iw_handler.h>
18 #include <net/cfg80211.h>
19 #include <net/cfg80211-wext.h>
20 #include "wext-compat.h"
24 int cfg80211_wext_giwname(struct net_device
*dev
,
25 struct iw_request_info
*info
,
26 char *name
, char *extra
)
28 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
29 struct ieee80211_supported_band
*sband
;
30 bool is_ht
= false, is_a
= false, is_b
= false, is_g
= false;
35 sband
= wdev
->wiphy
->bands
[IEEE80211_BAND_5GHZ
];
38 is_ht
|= sband
->ht_cap
.ht_supported
;
41 sband
= wdev
->wiphy
->bands
[IEEE80211_BAND_2GHZ
];
44 /* Check for mandatory rates */
45 for (i
= 0; i
< sband
->n_bitrates
; i
++) {
46 if (sband
->bitrates
[i
].bitrate
== 10)
48 if (sband
->bitrates
[i
].bitrate
== 60)
51 is_ht
|= sband
->ht_cap
.ht_supported
;
54 strcpy(name
, "IEEE 802.11");
66 EXPORT_WEXT_HANDLER(cfg80211_wext_giwname
);
68 int cfg80211_wext_siwmode(struct net_device
*dev
, struct iw_request_info
*info
,
69 u32
*mode
, char *extra
)
71 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
72 struct cfg80211_registered_device
*rdev
;
73 struct vif_params vifparams
;
74 enum nl80211_iftype type
;
76 rdev
= wiphy_to_rdev(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 return cfg80211_change_iface(rdev
, dev
, type
, NULL
, &vifparams
);
102 EXPORT_WEXT_HANDLER(cfg80211_wext_siwmode
);
104 int cfg80211_wext_giwmode(struct net_device
*dev
, struct iw_request_info
*info
,
105 u32
*mode
, char *extra
)
107 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
112 switch (wdev
->iftype
) {
113 case NL80211_IFTYPE_AP
:
114 *mode
= IW_MODE_MASTER
;
116 case NL80211_IFTYPE_STATION
:
117 *mode
= IW_MODE_INFRA
;
119 case NL80211_IFTYPE_ADHOC
:
120 *mode
= IW_MODE_ADHOC
;
122 case NL80211_IFTYPE_MONITOR
:
123 *mode
= IW_MODE_MONITOR
;
125 case NL80211_IFTYPE_WDS
:
126 *mode
= IW_MODE_REPEAT
;
128 case NL80211_IFTYPE_AP_VLAN
:
129 *mode
= IW_MODE_SECOND
; /* FIXME */
132 *mode
= IW_MODE_AUTO
;
137 EXPORT_WEXT_HANDLER(cfg80211_wext_giwmode
);
140 int cfg80211_wext_giwrange(struct net_device
*dev
,
141 struct iw_request_info
*info
,
142 struct iw_point
*data
, char *extra
)
144 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
145 struct iw_range
*range
= (struct iw_range
*) extra
;
146 enum ieee80211_band band
;
152 data
->length
= sizeof(struct iw_range
);
153 memset(range
, 0, sizeof(struct iw_range
));
155 range
->we_version_compiled
= WIRELESS_EXT
;
156 range
->we_version_source
= 21;
157 range
->retry_capa
= IW_RETRY_LIMIT
;
158 range
->retry_flags
= IW_RETRY_LIMIT
;
159 range
->min_retry
= 0;
160 range
->max_retry
= 255;
162 range
->max_rts
= 2347;
163 range
->min_frag
= 256;
164 range
->max_frag
= 2346;
166 range
->max_encoding_tokens
= 4;
168 range
->max_qual
.updated
= IW_QUAL_NOISE_INVALID
;
170 switch (wdev
->wiphy
->signal_type
) {
171 case CFG80211_SIGNAL_TYPE_NONE
:
173 case CFG80211_SIGNAL_TYPE_MBM
:
174 range
->max_qual
.level
= (u8
)-110;
175 range
->max_qual
.qual
= 70;
176 range
->avg_qual
.qual
= 35;
177 range
->max_qual
.updated
|= IW_QUAL_DBM
;
178 range
->max_qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
179 range
->max_qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
181 case CFG80211_SIGNAL_TYPE_UNSPEC
:
182 range
->max_qual
.level
= 100;
183 range
->max_qual
.qual
= 100;
184 range
->avg_qual
.qual
= 50;
185 range
->max_qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
186 range
->max_qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
190 range
->avg_qual
.level
= range
->max_qual
.level
/ 2;
191 range
->avg_qual
.noise
= range
->max_qual
.noise
/ 2;
192 range
->avg_qual
.updated
= range
->max_qual
.updated
;
194 for (i
= 0; i
< wdev
->wiphy
->n_cipher_suites
; i
++) {
195 switch (wdev
->wiphy
->cipher_suites
[i
]) {
196 case WLAN_CIPHER_SUITE_TKIP
:
197 range
->enc_capa
|= (IW_ENC_CAPA_CIPHER_TKIP
|
201 case WLAN_CIPHER_SUITE_CCMP
:
202 range
->enc_capa
|= (IW_ENC_CAPA_CIPHER_CCMP
|
206 case WLAN_CIPHER_SUITE_WEP40
:
207 range
->encoding_size
[range
->num_encoding_sizes
++] =
211 case WLAN_CIPHER_SUITE_WEP104
:
212 range
->encoding_size
[range
->num_encoding_sizes
++] =
218 for (band
= 0; band
< IEEE80211_NUM_BANDS
; band
++) {
219 struct ieee80211_supported_band
*sband
;
221 sband
= wdev
->wiphy
->bands
[band
];
226 for (i
= 0; i
< sband
->n_channels
&& c
< IW_MAX_FREQUENCIES
; i
++) {
227 struct ieee80211_channel
*chan
= &sband
->channels
[i
];
229 if (!(chan
->flags
& IEEE80211_CHAN_DISABLED
)) {
231 ieee80211_frequency_to_channel(
233 range
->freq
[c
].m
= chan
->center_freq
;
234 range
->freq
[c
].e
= 6;
239 range
->num_channels
= c
;
240 range
->num_frequency
= c
;
242 IW_EVENT_CAPA_SET_KERNEL(range
->event_capa
);
243 IW_EVENT_CAPA_SET(range
->event_capa
, SIOCGIWAP
);
244 IW_EVENT_CAPA_SET(range
->event_capa
, SIOCGIWSCAN
);
246 if (wdev
->wiphy
->max_scan_ssids
> 0)
247 range
->scan_capa
|= IW_SCAN_CAPA_ESSID
;
251 EXPORT_WEXT_HANDLER(cfg80211_wext_giwrange
);
255 * cfg80211_wext_freq - get wext frequency for non-"auto"
256 * @dev: the net device
257 * @freq: the wext freq encoding
259 * Returns a frequency, or a negative error code, or 0 for auto.
261 int cfg80211_wext_freq(struct iw_freq
*freq
)
264 * Parse frequency - return 0 for auto and
265 * -EINVAL for impossible things.
268 enum ieee80211_band band
= IEEE80211_BAND_2GHZ
;
272 band
= IEEE80211_BAND_5GHZ
;
273 return ieee80211_channel_to_frequency(freq
->m
, band
);
275 int i
, div
= 1000000;
276 for (i
= 0; i
< freq
->e
; i
++)
280 return freq
->m
/ div
;
284 int cfg80211_wext_siwrts(struct net_device
*dev
,
285 struct iw_request_info
*info
,
286 struct iw_param
*rts
, char *extra
)
288 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
289 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
290 u32 orts
= wdev
->wiphy
->rts_threshold
;
293 if (rts
->disabled
|| !rts
->fixed
)
294 wdev
->wiphy
->rts_threshold
= (u32
) -1;
295 else if (rts
->value
< 0)
298 wdev
->wiphy
->rts_threshold
= rts
->value
;
300 err
= rdev_set_wiphy_params(rdev
, WIPHY_PARAM_RTS_THRESHOLD
);
302 wdev
->wiphy
->rts_threshold
= orts
;
306 EXPORT_WEXT_HANDLER(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_WEXT_HANDLER(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_rdev(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_set_wiphy_params(rdev
, WIPHY_PARAM_FRAG_THRESHOLD
);
342 wdev
->wiphy
->frag_threshold
= ofrag
;
346 EXPORT_WEXT_HANDLER(cfg80211_wext_siwfrag
);
348 int cfg80211_wext_giwfrag(struct net_device
*dev
,
349 struct iw_request_info
*info
,
350 struct iw_param
*frag
, char *extra
)
352 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
354 frag
->value
= wdev
->wiphy
->frag_threshold
;
355 frag
->disabled
= frag
->value
== (u32
) -1;
360 EXPORT_WEXT_HANDLER(cfg80211_wext_giwfrag
);
362 static int cfg80211_wext_siwretry(struct net_device
*dev
,
363 struct iw_request_info
*info
,
364 struct iw_param
*retry
, char *extra
)
366 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
367 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
369 u8 olong
= wdev
->wiphy
->retry_long
;
370 u8 oshort
= wdev
->wiphy
->retry_short
;
373 if (retry
->disabled
|| retry
->value
< 1 || retry
->value
> 255 ||
374 (retry
->flags
& IW_RETRY_TYPE
) != IW_RETRY_LIMIT
)
377 if (retry
->flags
& IW_RETRY_LONG
) {
378 wdev
->wiphy
->retry_long
= retry
->value
;
379 changed
|= WIPHY_PARAM_RETRY_LONG
;
380 } else if (retry
->flags
& IW_RETRY_SHORT
) {
381 wdev
->wiphy
->retry_short
= retry
->value
;
382 changed
|= WIPHY_PARAM_RETRY_SHORT
;
384 wdev
->wiphy
->retry_short
= retry
->value
;
385 wdev
->wiphy
->retry_long
= retry
->value
;
386 changed
|= WIPHY_PARAM_RETRY_LONG
;
387 changed
|= WIPHY_PARAM_RETRY_SHORT
;
393 err
= rdev_set_wiphy_params(rdev
, changed
);
395 wdev
->wiphy
->retry_short
= oshort
;
396 wdev
->wiphy
->retry_long
= olong
;
402 int cfg80211_wext_giwretry(struct net_device
*dev
,
403 struct iw_request_info
*info
,
404 struct iw_param
*retry
, char *extra
)
406 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
410 if (retry
->flags
== 0 || (retry
->flags
& IW_RETRY_SHORT
)) {
412 * First return short value, iwconfig will ask long value
415 retry
->flags
|= IW_RETRY_LIMIT
| IW_RETRY_SHORT
;
416 retry
->value
= wdev
->wiphy
->retry_short
;
417 if (wdev
->wiphy
->retry_long
== wdev
->wiphy
->retry_short
)
418 retry
->flags
|= IW_RETRY_LONG
;
423 if (retry
->flags
& IW_RETRY_LONG
) {
424 retry
->flags
= IW_RETRY_LIMIT
| IW_RETRY_LONG
;
425 retry
->value
= wdev
->wiphy
->retry_long
;
430 EXPORT_WEXT_HANDLER(cfg80211_wext_giwretry
);
432 static int __cfg80211_set_encryption(struct cfg80211_registered_device
*rdev
,
433 struct net_device
*dev
, bool pairwise
,
434 const u8
*addr
, bool remove
, bool tx_key
,
435 int idx
, struct key_params
*params
)
437 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
441 if (pairwise
&& !addr
)
444 if (!wdev
->wext
.keys
) {
445 wdev
->wext
.keys
= kzalloc(sizeof(*wdev
->wext
.keys
),
447 if (!wdev
->wext
.keys
)
449 for (i
= 0; i
< 6; i
++)
450 wdev
->wext
.keys
->params
[i
].key
=
451 wdev
->wext
.keys
->data
[i
];
454 if (wdev
->iftype
!= NL80211_IFTYPE_ADHOC
&&
455 wdev
->iftype
!= NL80211_IFTYPE_STATION
)
458 if (params
->cipher
== WLAN_CIPHER_SUITE_AES_CMAC
) {
459 if (!wdev
->current_bss
)
462 if (!rdev
->ops
->set_default_mgmt_key
)
465 if (idx
< 4 || idx
> 5)
467 } else if (idx
< 0 || idx
> 3)
472 if (wdev
->current_bss
) {
474 * If removing the current TX key, we will need to
475 * join a new IBSS without the privacy bit clear.
477 if (idx
== wdev
->wext
.default_key
&&
478 wdev
->iftype
== NL80211_IFTYPE_ADHOC
) {
479 __cfg80211_leave_ibss(rdev
, wdev
->netdev
, true);
483 if (!pairwise
&& addr
&&
484 !(rdev
->wiphy
.flags
& WIPHY_FLAG_IBSS_RSN
))
487 err
= rdev_del_key(rdev
, dev
, idx
, pairwise
,
490 wdev
->wext
.connect
.privacy
= false;
492 * Applications using wireless extensions expect to be
493 * able to delete keys that don't exist, so allow that.
499 memset(wdev
->wext
.keys
->data
[idx
], 0,
500 sizeof(wdev
->wext
.keys
->data
[idx
]));
501 wdev
->wext
.keys
->params
[idx
].key_len
= 0;
502 wdev
->wext
.keys
->params
[idx
].cipher
= 0;
504 if (idx
== wdev
->wext
.default_key
)
505 wdev
->wext
.default_key
= -1;
506 else if (idx
== wdev
->wext
.default_mgmt_key
)
507 wdev
->wext
.default_mgmt_key
= -1;
511 err
= cfg80211_ibss_wext_join(rdev
, wdev
);
519 if (cfg80211_validate_key_settings(rdev
, params
, idx
, pairwise
, addr
))
523 if (wdev
->current_bss
)
524 err
= rdev_add_key(rdev
, dev
, idx
, pairwise
, addr
, params
);
529 wdev
->wext
.keys
->params
[idx
] = *params
;
530 memcpy(wdev
->wext
.keys
->data
[idx
],
531 params
->key
, params
->key_len
);
532 wdev
->wext
.keys
->params
[idx
].key
=
533 wdev
->wext
.keys
->data
[idx
];
536 if ((params
->cipher
== WLAN_CIPHER_SUITE_WEP40
||
537 params
->cipher
== WLAN_CIPHER_SUITE_WEP104
) &&
538 (tx_key
|| (!addr
&& wdev
->wext
.default_key
== -1))) {
539 if (wdev
->current_bss
) {
541 * If we are getting a new TX key from not having
542 * had one before we need to join a new IBSS with
543 * the privacy bit set.
545 if (wdev
->iftype
== NL80211_IFTYPE_ADHOC
&&
546 wdev
->wext
.default_key
== -1) {
547 __cfg80211_leave_ibss(rdev
, wdev
->netdev
, true);
550 err
= rdev_set_default_key(rdev
, dev
, idx
, true, true);
553 wdev
->wext
.default_key
= idx
;
555 err
= cfg80211_ibss_wext_join(rdev
, wdev
);
560 if (params
->cipher
== WLAN_CIPHER_SUITE_AES_CMAC
&&
561 (tx_key
|| (!addr
&& wdev
->wext
.default_mgmt_key
== -1))) {
562 if (wdev
->current_bss
)
563 err
= rdev_set_default_mgmt_key(rdev
, dev
, idx
);
565 wdev
->wext
.default_mgmt_key
= idx
;
572 static int cfg80211_set_encryption(struct cfg80211_registered_device
*rdev
,
573 struct net_device
*dev
, bool pairwise
,
574 const u8
*addr
, bool remove
, bool tx_key
,
575 int idx
, struct key_params
*params
)
579 wdev_lock(dev
->ieee80211_ptr
);
580 err
= __cfg80211_set_encryption(rdev
, dev
, pairwise
, addr
,
581 remove
, tx_key
, idx
, params
);
582 wdev_unlock(dev
->ieee80211_ptr
);
587 static int cfg80211_wext_siwencode(struct net_device
*dev
,
588 struct iw_request_info
*info
,
589 struct iw_point
*erq
, char *keybuf
)
591 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
592 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
595 struct key_params params
;
597 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
598 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
601 /* no use -- only MFP (set_default_mgmt_key) is optional */
602 if (!rdev
->ops
->del_key
||
603 !rdev
->ops
->add_key
||
604 !rdev
->ops
->set_default_key
)
607 idx
= erq
->flags
& IW_ENCODE_INDEX
;
609 idx
= wdev
->wext
.default_key
;
612 } else if (idx
< 1 || idx
> 4)
617 if (erq
->flags
& IW_ENCODE_DISABLED
)
619 else if (erq
->length
== 0) {
620 /* No key data - just set the default TX key index */
623 if (wdev
->current_bss
)
624 err
= rdev_set_default_key(rdev
, dev
, idx
, true,
627 wdev
->wext
.default_key
= idx
;
632 memset(¶ms
, 0, sizeof(params
));
634 params
.key_len
= erq
->length
;
635 if (erq
->length
== 5)
636 params
.cipher
= WLAN_CIPHER_SUITE_WEP40
;
637 else if (erq
->length
== 13)
638 params
.cipher
= WLAN_CIPHER_SUITE_WEP104
;
642 return cfg80211_set_encryption(rdev
, dev
, false, NULL
, remove
,
643 wdev
->wext
.default_key
== -1,
647 static int cfg80211_wext_siwencodeext(struct net_device
*dev
,
648 struct iw_request_info
*info
,
649 struct iw_point
*erq
, char *extra
)
651 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
652 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
653 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*) extra
;
657 struct key_params params
;
660 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
661 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
664 /* no use -- only MFP (set_default_mgmt_key) is optional */
665 if (!rdev
->ops
->del_key
||
666 !rdev
->ops
->add_key
||
667 !rdev
->ops
->set_default_key
)
671 case IW_ENCODE_ALG_NONE
:
675 case IW_ENCODE_ALG_WEP
:
676 if (ext
->key_len
== 5)
677 cipher
= WLAN_CIPHER_SUITE_WEP40
;
678 else if (ext
->key_len
== 13)
679 cipher
= WLAN_CIPHER_SUITE_WEP104
;
683 case IW_ENCODE_ALG_TKIP
:
684 cipher
= WLAN_CIPHER_SUITE_TKIP
;
686 case IW_ENCODE_ALG_CCMP
:
687 cipher
= WLAN_CIPHER_SUITE_CCMP
;
689 case IW_ENCODE_ALG_AES_CMAC
:
690 cipher
= WLAN_CIPHER_SUITE_AES_CMAC
;
696 if (erq
->flags
& IW_ENCODE_DISABLED
)
699 idx
= erq
->flags
& IW_ENCODE_INDEX
;
700 if (cipher
== WLAN_CIPHER_SUITE_AES_CMAC
) {
701 if (idx
< 4 || idx
> 5) {
702 idx
= wdev
->wext
.default_mgmt_key
;
708 if (idx
< 1 || idx
> 4) {
709 idx
= wdev
->wext
.default_key
;
716 addr
= ext
->addr
.sa_data
;
717 if (is_broadcast_ether_addr(addr
))
720 memset(¶ms
, 0, sizeof(params
));
721 params
.key
= ext
->key
;
722 params
.key_len
= ext
->key_len
;
723 params
.cipher
= cipher
;
725 if (ext
->ext_flags
& IW_ENCODE_EXT_RX_SEQ_VALID
) {
726 params
.seq
= ext
->rx_seq
;
730 return cfg80211_set_encryption(
732 !(ext
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
),
734 ext
->ext_flags
& IW_ENCODE_EXT_SET_TX_KEY
,
738 static int cfg80211_wext_giwencode(struct net_device
*dev
,
739 struct iw_request_info
*info
,
740 struct iw_point
*erq
, char *keybuf
)
742 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
745 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
746 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
749 idx
= erq
->flags
& IW_ENCODE_INDEX
;
751 idx
= wdev
->wext
.default_key
;
754 } else if (idx
< 1 || idx
> 4)
759 erq
->flags
= idx
+ 1;
761 if (!wdev
->wext
.keys
|| !wdev
->wext
.keys
->params
[idx
].cipher
) {
762 erq
->flags
|= IW_ENCODE_DISABLED
;
767 erq
->length
= min_t(size_t, erq
->length
,
768 wdev
->wext
.keys
->params
[idx
].key_len
);
769 memcpy(keybuf
, wdev
->wext
.keys
->params
[idx
].key
, erq
->length
);
770 erq
->flags
|= IW_ENCODE_ENABLED
;
775 static int cfg80211_wext_siwfreq(struct net_device
*dev
,
776 struct iw_request_info
*info
,
777 struct iw_freq
*wextfreq
, char *extra
)
779 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
780 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
781 struct cfg80211_chan_def chandef
= {
782 .width
= NL80211_CHAN_WIDTH_20_NOHT
,
786 switch (wdev
->iftype
) {
787 case NL80211_IFTYPE_STATION
:
788 return cfg80211_mgd_wext_siwfreq(dev
, info
, wextfreq
, extra
);
789 case NL80211_IFTYPE_ADHOC
:
790 return cfg80211_ibss_wext_siwfreq(dev
, info
, wextfreq
, extra
);
791 case NL80211_IFTYPE_MONITOR
:
792 freq
= cfg80211_wext_freq(wextfreq
);
797 chandef
.center_freq1
= freq
;
798 chandef
.chan
= ieee80211_get_channel(&rdev
->wiphy
, freq
);
801 return cfg80211_set_monitor_channel(rdev
, &chandef
);
802 case NL80211_IFTYPE_MESH_POINT
:
803 freq
= cfg80211_wext_freq(wextfreq
);
808 chandef
.center_freq1
= freq
;
809 chandef
.chan
= ieee80211_get_channel(&rdev
->wiphy
, freq
);
812 return cfg80211_set_mesh_channel(rdev
, wdev
, &chandef
);
818 static int cfg80211_wext_giwfreq(struct net_device
*dev
,
819 struct iw_request_info
*info
,
820 struct iw_freq
*freq
, char *extra
)
822 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
823 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
824 struct cfg80211_chan_def chandef
;
827 switch (wdev
->iftype
) {
828 case NL80211_IFTYPE_STATION
:
829 return cfg80211_mgd_wext_giwfreq(dev
, info
, freq
, extra
);
830 case NL80211_IFTYPE_ADHOC
:
831 return cfg80211_ibss_wext_giwfreq(dev
, info
, freq
, extra
);
832 case NL80211_IFTYPE_MONITOR
:
833 if (!rdev
->ops
->get_channel
)
836 ret
= rdev_get_channel(rdev
, wdev
, &chandef
);
839 freq
->m
= chandef
.chan
->center_freq
;
847 static int cfg80211_wext_siwtxpower(struct net_device
*dev
,
848 struct iw_request_info
*info
,
849 union iwreq_data
*data
, char *extra
)
851 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
852 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
853 enum nl80211_tx_power_setting type
;
856 if ((data
->txpower
.flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
)
858 if (data
->txpower
.flags
& IW_TXPOW_RANGE
)
861 if (!rdev
->ops
->set_tx_power
)
864 /* only change when not disabling */
865 if (!data
->txpower
.disabled
) {
866 rfkill_set_sw_state(rdev
->rfkill
, false);
868 if (data
->txpower
.fixed
) {
870 * wext doesn't support negative values, see
871 * below where it's for automatic
873 if (data
->txpower
.value
< 0)
875 dbm
= data
->txpower
.value
;
876 type
= NL80211_TX_POWER_FIXED
;
877 /* TODO: do regulatory check! */
880 * Automatic power level setting, max being the value
881 * passed in from userland.
883 if (data
->txpower
.value
< 0) {
884 type
= NL80211_TX_POWER_AUTOMATIC
;
886 dbm
= data
->txpower
.value
;
887 type
= NL80211_TX_POWER_LIMITED
;
891 rfkill_set_sw_state(rdev
->rfkill
, true);
892 schedule_work(&rdev
->rfkill_sync
);
896 return rdev_set_tx_power(rdev
, wdev
, type
, DBM_TO_MBM(dbm
));
899 static int cfg80211_wext_giwtxpower(struct net_device
*dev
,
900 struct iw_request_info
*info
,
901 union iwreq_data
*data
, char *extra
)
903 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
904 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
907 if ((data
->txpower
.flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
)
909 if (data
->txpower
.flags
& IW_TXPOW_RANGE
)
912 if (!rdev
->ops
->get_tx_power
)
915 err
= rdev_get_tx_power(rdev
, wdev
, &val
);
919 /* well... oh well */
920 data
->txpower
.fixed
= 1;
921 data
->txpower
.disabled
= rfkill_blocked(rdev
->rfkill
);
922 data
->txpower
.value
= val
;
923 data
->txpower
.flags
= IW_TXPOW_DBM
;
928 static int cfg80211_set_auth_alg(struct wireless_dev
*wdev
,
936 if (auth_alg
& ~(IW_AUTH_ALG_OPEN_SYSTEM
|
937 IW_AUTH_ALG_SHARED_KEY
|
941 if (auth_alg
& IW_AUTH_ALG_OPEN_SYSTEM
) {
943 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_OPEN_SYSTEM
;
946 if (auth_alg
& IW_AUTH_ALG_SHARED_KEY
) {
948 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_SHARED_KEY
;
951 if (auth_alg
& IW_AUTH_ALG_LEAP
) {
953 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_NETWORK_EAP
;
957 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_AUTOMATIC
;
962 static int cfg80211_set_wpa_version(struct wireless_dev
*wdev
, u32 wpa_versions
)
964 if (wpa_versions
& ~(IW_AUTH_WPA_VERSION_WPA
|
965 IW_AUTH_WPA_VERSION_WPA2
|
966 IW_AUTH_WPA_VERSION_DISABLED
))
969 if ((wpa_versions
& IW_AUTH_WPA_VERSION_DISABLED
) &&
970 (wpa_versions
& (IW_AUTH_WPA_VERSION_WPA
|
971 IW_AUTH_WPA_VERSION_WPA2
)))
974 if (wpa_versions
& IW_AUTH_WPA_VERSION_DISABLED
)
975 wdev
->wext
.connect
.crypto
.wpa_versions
&=
976 ~(NL80211_WPA_VERSION_1
|NL80211_WPA_VERSION_2
);
978 if (wpa_versions
& IW_AUTH_WPA_VERSION_WPA
)
979 wdev
->wext
.connect
.crypto
.wpa_versions
|=
980 NL80211_WPA_VERSION_1
;
982 if (wpa_versions
& IW_AUTH_WPA_VERSION_WPA2
)
983 wdev
->wext
.connect
.crypto
.wpa_versions
|=
984 NL80211_WPA_VERSION_2
;
989 static int cfg80211_set_cipher_group(struct wireless_dev
*wdev
, u32 cipher
)
991 if (cipher
& IW_AUTH_CIPHER_WEP40
)
992 wdev
->wext
.connect
.crypto
.cipher_group
=
993 WLAN_CIPHER_SUITE_WEP40
;
994 else if (cipher
& IW_AUTH_CIPHER_WEP104
)
995 wdev
->wext
.connect
.crypto
.cipher_group
=
996 WLAN_CIPHER_SUITE_WEP104
;
997 else if (cipher
& IW_AUTH_CIPHER_TKIP
)
998 wdev
->wext
.connect
.crypto
.cipher_group
=
999 WLAN_CIPHER_SUITE_TKIP
;
1000 else if (cipher
& IW_AUTH_CIPHER_CCMP
)
1001 wdev
->wext
.connect
.crypto
.cipher_group
=
1002 WLAN_CIPHER_SUITE_CCMP
;
1003 else if (cipher
& IW_AUTH_CIPHER_AES_CMAC
)
1004 wdev
->wext
.connect
.crypto
.cipher_group
=
1005 WLAN_CIPHER_SUITE_AES_CMAC
;
1006 else if (cipher
& IW_AUTH_CIPHER_NONE
)
1007 wdev
->wext
.connect
.crypto
.cipher_group
= 0;
1014 static int cfg80211_set_cipher_pairwise(struct wireless_dev
*wdev
, u32 cipher
)
1017 u32
*ciphers_pairwise
= wdev
->wext
.connect
.crypto
.ciphers_pairwise
;
1019 if (cipher
& IW_AUTH_CIPHER_WEP40
) {
1020 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_WEP40
;
1024 if (cipher
& IW_AUTH_CIPHER_WEP104
) {
1025 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_WEP104
;
1029 if (cipher
& IW_AUTH_CIPHER_TKIP
) {
1030 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_TKIP
;
1034 if (cipher
& IW_AUTH_CIPHER_CCMP
) {
1035 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_CCMP
;
1039 if (cipher
& IW_AUTH_CIPHER_AES_CMAC
) {
1040 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_AES_CMAC
;
1044 BUILD_BUG_ON(NL80211_MAX_NR_CIPHER_SUITES
< 5);
1046 wdev
->wext
.connect
.crypto
.n_ciphers_pairwise
= nr_ciphers
;
1052 static int cfg80211_set_key_mgt(struct wireless_dev
*wdev
, u32 key_mgt
)
1054 int nr_akm_suites
= 0;
1056 if (key_mgt
& ~(IW_AUTH_KEY_MGMT_802_1X
|
1057 IW_AUTH_KEY_MGMT_PSK
))
1060 if (key_mgt
& IW_AUTH_KEY_MGMT_802_1X
) {
1061 wdev
->wext
.connect
.crypto
.akm_suites
[nr_akm_suites
] =
1062 WLAN_AKM_SUITE_8021X
;
1066 if (key_mgt
& IW_AUTH_KEY_MGMT_PSK
) {
1067 wdev
->wext
.connect
.crypto
.akm_suites
[nr_akm_suites
] =
1072 wdev
->wext
.connect
.crypto
.n_akm_suites
= nr_akm_suites
;
1077 static int cfg80211_wext_siwauth(struct net_device
*dev
,
1078 struct iw_request_info
*info
,
1079 struct iw_param
*data
, char *extra
)
1081 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1083 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1086 switch (data
->flags
& IW_AUTH_INDEX
) {
1087 case IW_AUTH_PRIVACY_INVOKED
:
1088 wdev
->wext
.connect
.privacy
= data
->value
;
1090 case IW_AUTH_WPA_VERSION
:
1091 return cfg80211_set_wpa_version(wdev
, data
->value
);
1092 case IW_AUTH_CIPHER_GROUP
:
1093 return cfg80211_set_cipher_group(wdev
, data
->value
);
1094 case IW_AUTH_KEY_MGMT
:
1095 return cfg80211_set_key_mgt(wdev
, data
->value
);
1096 case IW_AUTH_CIPHER_PAIRWISE
:
1097 return cfg80211_set_cipher_pairwise(wdev
, data
->value
);
1098 case IW_AUTH_80211_AUTH_ALG
:
1099 return cfg80211_set_auth_alg(wdev
, data
->value
);
1100 case IW_AUTH_WPA_ENABLED
:
1101 case IW_AUTH_RX_UNENCRYPTED_EAPOL
:
1102 case IW_AUTH_DROP_UNENCRYPTED
:
1110 static int cfg80211_wext_giwauth(struct net_device
*dev
,
1111 struct iw_request_info
*info
,
1112 struct iw_param
*data
, char *extra
)
1114 /* XXX: what do we need? */
1119 static int cfg80211_wext_siwpower(struct net_device
*dev
,
1120 struct iw_request_info
*info
,
1121 struct iw_param
*wrq
, char *extra
)
1123 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1124 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
1126 int timeout
= wdev
->ps_timeout
;
1129 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1132 if (!rdev
->ops
->set_power_mgmt
)
1135 if (wrq
->disabled
) {
1138 switch (wrq
->flags
& IW_POWER_MODE
) {
1139 case IW_POWER_ON
: /* If not specified */
1140 case IW_POWER_MODE
: /* If set all mask */
1141 case IW_POWER_ALL_R
: /* If explicitely state all */
1144 default: /* Otherwise we ignore */
1148 if (wrq
->flags
& ~(IW_POWER_MODE
| IW_POWER_TIMEOUT
))
1151 if (wrq
->flags
& IW_POWER_TIMEOUT
)
1152 timeout
= wrq
->value
/ 1000;
1155 err
= rdev_set_power_mgmt(rdev
, dev
, ps
, timeout
);
1160 wdev
->ps_timeout
= timeout
;
1166 static int cfg80211_wext_giwpower(struct net_device
*dev
,
1167 struct iw_request_info
*info
,
1168 struct iw_param
*wrq
, char *extra
)
1170 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1172 wrq
->disabled
= !wdev
->ps
;
1177 static int cfg80211_wds_wext_siwap(struct net_device
*dev
,
1178 struct iw_request_info
*info
,
1179 struct sockaddr
*addr
, char *extra
)
1181 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1182 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
1185 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_WDS
))
1188 if (addr
->sa_family
!= ARPHRD_ETHER
)
1191 if (netif_running(dev
))
1194 if (!rdev
->ops
->set_wds_peer
)
1197 err
= rdev_set_wds_peer(rdev
, dev
, (u8
*)&addr
->sa_data
);
1201 memcpy(&wdev
->wext
.bssid
, (u8
*) &addr
->sa_data
, ETH_ALEN
);
1206 static int cfg80211_wds_wext_giwap(struct net_device
*dev
,
1207 struct iw_request_info
*info
,
1208 struct sockaddr
*addr
, char *extra
)
1210 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1212 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_WDS
))
1215 addr
->sa_family
= ARPHRD_ETHER
;
1216 memcpy(&addr
->sa_data
, wdev
->wext
.bssid
, ETH_ALEN
);
1221 static int cfg80211_wext_siwrate(struct net_device
*dev
,
1222 struct iw_request_info
*info
,
1223 struct iw_param
*rate
, char *extra
)
1225 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1226 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
1227 struct cfg80211_bitrate_mask mask
;
1229 struct ieee80211_supported_band
*sband
;
1233 if (!rdev
->ops
->set_bitrate_mask
)
1236 memset(&mask
, 0, sizeof(mask
));
1240 if (rate
->value
< 0) {
1242 } else if (rate
->fixed
) {
1243 fixed
= rate
->value
/ 100000;
1245 maxrate
= rate
->value
/ 100000;
1248 for (band
= 0; band
< IEEE80211_NUM_BANDS
; band
++) {
1249 sband
= wdev
->wiphy
->bands
[band
];
1252 for (ridx
= 0; ridx
< sband
->n_bitrates
; ridx
++) {
1253 struct ieee80211_rate
*srate
= &sband
->bitrates
[ridx
];
1254 if (fixed
== srate
->bitrate
) {
1255 mask
.control
[band
].legacy
= 1 << ridx
;
1259 if (srate
->bitrate
<= maxrate
) {
1260 mask
.control
[band
].legacy
|= 1 << ridx
;
1269 return rdev_set_bitrate_mask(rdev
, dev
, NULL
, &mask
);
1272 static int cfg80211_wext_giwrate(struct net_device
*dev
,
1273 struct iw_request_info
*info
,
1274 struct iw_param
*rate
, char *extra
)
1276 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1277 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
1278 /* we are under RTNL - globally locked - so can use a static struct */
1279 static struct station_info sinfo
;
1283 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1286 if (!rdev
->ops
->get_station
)
1291 if (wdev
->current_bss
)
1292 memcpy(addr
, wdev
->current_bss
->pub
.bssid
, ETH_ALEN
);
1299 err
= rdev_get_station(rdev
, dev
, addr
, &sinfo
);
1303 if (!(sinfo
.filled
& BIT(NL80211_STA_INFO_TX_BITRATE
)))
1306 rate
->value
= 100000 * cfg80211_calculate_bitrate(&sinfo
.txrate
);
1311 /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
1312 static struct iw_statistics
*cfg80211_wireless_stats(struct net_device
*dev
)
1314 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1315 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
1316 /* we are under RTNL - globally locked - so can use static structs */
1317 static struct iw_statistics wstats
;
1318 static struct station_info sinfo
;
1321 if (dev
->ieee80211_ptr
->iftype
!= NL80211_IFTYPE_STATION
)
1324 if (!rdev
->ops
->get_station
)
1327 /* Grab BSSID of current BSS, if any */
1329 if (!wdev
->current_bss
) {
1333 memcpy(bssid
, wdev
->current_bss
->pub
.bssid
, ETH_ALEN
);
1336 memset(&sinfo
, 0, sizeof(sinfo
));
1338 if (rdev_get_station(rdev
, dev
, bssid
, &sinfo
))
1341 memset(&wstats
, 0, sizeof(wstats
));
1343 switch (rdev
->wiphy
.signal_type
) {
1344 case CFG80211_SIGNAL_TYPE_MBM
:
1345 if (sinfo
.filled
& BIT(NL80211_STA_INFO_SIGNAL
)) {
1346 int sig
= sinfo
.signal
;
1347 wstats
.qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
1348 wstats
.qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
1349 wstats
.qual
.updated
|= IW_QUAL_DBM
;
1350 wstats
.qual
.level
= sig
;
1355 wstats
.qual
.qual
= sig
+ 110;
1358 case CFG80211_SIGNAL_TYPE_UNSPEC
:
1359 if (sinfo
.filled
& BIT(NL80211_STA_INFO_SIGNAL
)) {
1360 wstats
.qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
1361 wstats
.qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
1362 wstats
.qual
.level
= sinfo
.signal
;
1363 wstats
.qual
.qual
= sinfo
.signal
;
1367 wstats
.qual
.updated
|= IW_QUAL_LEVEL_INVALID
;
1368 wstats
.qual
.updated
|= IW_QUAL_QUAL_INVALID
;
1371 wstats
.qual
.updated
|= IW_QUAL_NOISE_INVALID
;
1372 if (sinfo
.filled
& BIT(NL80211_STA_INFO_RX_DROP_MISC
))
1373 wstats
.discard
.misc
= sinfo
.rx_dropped_misc
;
1374 if (sinfo
.filled
& BIT(NL80211_STA_INFO_TX_FAILED
))
1375 wstats
.discard
.retries
= sinfo
.tx_failed
;
1380 static int cfg80211_wext_siwap(struct net_device
*dev
,
1381 struct iw_request_info
*info
,
1382 struct sockaddr
*ap_addr
, char *extra
)
1384 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1386 switch (wdev
->iftype
) {
1387 case NL80211_IFTYPE_ADHOC
:
1388 return cfg80211_ibss_wext_siwap(dev
, info
, ap_addr
, extra
);
1389 case NL80211_IFTYPE_STATION
:
1390 return cfg80211_mgd_wext_siwap(dev
, info
, ap_addr
, extra
);
1391 case NL80211_IFTYPE_WDS
:
1392 return cfg80211_wds_wext_siwap(dev
, info
, ap_addr
, extra
);
1398 static int cfg80211_wext_giwap(struct net_device
*dev
,
1399 struct iw_request_info
*info
,
1400 struct sockaddr
*ap_addr
, char *extra
)
1402 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1404 switch (wdev
->iftype
) {
1405 case NL80211_IFTYPE_ADHOC
:
1406 return cfg80211_ibss_wext_giwap(dev
, info
, ap_addr
, extra
);
1407 case NL80211_IFTYPE_STATION
:
1408 return cfg80211_mgd_wext_giwap(dev
, info
, ap_addr
, extra
);
1409 case NL80211_IFTYPE_WDS
:
1410 return cfg80211_wds_wext_giwap(dev
, info
, ap_addr
, extra
);
1416 static int cfg80211_wext_siwessid(struct net_device
*dev
,
1417 struct iw_request_info
*info
,
1418 struct iw_point
*data
, char *ssid
)
1420 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1422 switch (wdev
->iftype
) {
1423 case NL80211_IFTYPE_ADHOC
:
1424 return cfg80211_ibss_wext_siwessid(dev
, info
, data
, ssid
);
1425 case NL80211_IFTYPE_STATION
:
1426 return cfg80211_mgd_wext_siwessid(dev
, info
, data
, ssid
);
1432 static int cfg80211_wext_giwessid(struct net_device
*dev
,
1433 struct iw_request_info
*info
,
1434 struct iw_point
*data
, char *ssid
)
1436 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1441 switch (wdev
->iftype
) {
1442 case NL80211_IFTYPE_ADHOC
:
1443 return cfg80211_ibss_wext_giwessid(dev
, info
, data
, ssid
);
1444 case NL80211_IFTYPE_STATION
:
1445 return cfg80211_mgd_wext_giwessid(dev
, info
, data
, ssid
);
1451 static int cfg80211_wext_siwpmksa(struct net_device
*dev
,
1452 struct iw_request_info
*info
,
1453 struct iw_point
*data
, char *extra
)
1455 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1456 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
1457 struct cfg80211_pmksa cfg_pmksa
;
1458 struct iw_pmksa
*pmksa
= (struct iw_pmksa
*)extra
;
1460 memset(&cfg_pmksa
, 0, sizeof(struct cfg80211_pmksa
));
1462 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1465 cfg_pmksa
.bssid
= pmksa
->bssid
.sa_data
;
1466 cfg_pmksa
.pmkid
= pmksa
->pmkid
;
1468 switch (pmksa
->cmd
) {
1470 if (!rdev
->ops
->set_pmksa
)
1473 return rdev_set_pmksa(rdev
, dev
, &cfg_pmksa
);
1475 case IW_PMKSA_REMOVE
:
1476 if (!rdev
->ops
->del_pmksa
)
1479 return rdev_del_pmksa(rdev
, dev
, &cfg_pmksa
);
1481 case IW_PMKSA_FLUSH
:
1482 if (!rdev
->ops
->flush_pmksa
)
1485 return rdev_flush_pmksa(rdev
, dev
);
1492 static const iw_handler cfg80211_handlers
[] = {
1493 [IW_IOCTL_IDX(SIOCGIWNAME
)] = (iw_handler
) cfg80211_wext_giwname
,
1494 [IW_IOCTL_IDX(SIOCSIWFREQ
)] = (iw_handler
) cfg80211_wext_siwfreq
,
1495 [IW_IOCTL_IDX(SIOCGIWFREQ
)] = (iw_handler
) cfg80211_wext_giwfreq
,
1496 [IW_IOCTL_IDX(SIOCSIWMODE
)] = (iw_handler
) cfg80211_wext_siwmode
,
1497 [IW_IOCTL_IDX(SIOCGIWMODE
)] = (iw_handler
) cfg80211_wext_giwmode
,
1498 [IW_IOCTL_IDX(SIOCGIWRANGE
)] = (iw_handler
) cfg80211_wext_giwrange
,
1499 [IW_IOCTL_IDX(SIOCSIWAP
)] = (iw_handler
) cfg80211_wext_siwap
,
1500 [IW_IOCTL_IDX(SIOCGIWAP
)] = (iw_handler
) cfg80211_wext_giwap
,
1501 [IW_IOCTL_IDX(SIOCSIWMLME
)] = (iw_handler
) cfg80211_wext_siwmlme
,
1502 [IW_IOCTL_IDX(SIOCSIWSCAN
)] = (iw_handler
) cfg80211_wext_siwscan
,
1503 [IW_IOCTL_IDX(SIOCGIWSCAN
)] = (iw_handler
) cfg80211_wext_giwscan
,
1504 [IW_IOCTL_IDX(SIOCSIWESSID
)] = (iw_handler
) cfg80211_wext_siwessid
,
1505 [IW_IOCTL_IDX(SIOCGIWESSID
)] = (iw_handler
) cfg80211_wext_giwessid
,
1506 [IW_IOCTL_IDX(SIOCSIWRATE
)] = (iw_handler
) cfg80211_wext_siwrate
,
1507 [IW_IOCTL_IDX(SIOCGIWRATE
)] = (iw_handler
) cfg80211_wext_giwrate
,
1508 [IW_IOCTL_IDX(SIOCSIWRTS
)] = (iw_handler
) cfg80211_wext_siwrts
,
1509 [IW_IOCTL_IDX(SIOCGIWRTS
)] = (iw_handler
) cfg80211_wext_giwrts
,
1510 [IW_IOCTL_IDX(SIOCSIWFRAG
)] = (iw_handler
) cfg80211_wext_siwfrag
,
1511 [IW_IOCTL_IDX(SIOCGIWFRAG
)] = (iw_handler
) cfg80211_wext_giwfrag
,
1512 [IW_IOCTL_IDX(SIOCSIWTXPOW
)] = (iw_handler
) cfg80211_wext_siwtxpower
,
1513 [IW_IOCTL_IDX(SIOCGIWTXPOW
)] = (iw_handler
) cfg80211_wext_giwtxpower
,
1514 [IW_IOCTL_IDX(SIOCSIWRETRY
)] = (iw_handler
) cfg80211_wext_siwretry
,
1515 [IW_IOCTL_IDX(SIOCGIWRETRY
)] = (iw_handler
) cfg80211_wext_giwretry
,
1516 [IW_IOCTL_IDX(SIOCSIWENCODE
)] = (iw_handler
) cfg80211_wext_siwencode
,
1517 [IW_IOCTL_IDX(SIOCGIWENCODE
)] = (iw_handler
) cfg80211_wext_giwencode
,
1518 [IW_IOCTL_IDX(SIOCSIWPOWER
)] = (iw_handler
) cfg80211_wext_siwpower
,
1519 [IW_IOCTL_IDX(SIOCGIWPOWER
)] = (iw_handler
) cfg80211_wext_giwpower
,
1520 [IW_IOCTL_IDX(SIOCSIWGENIE
)] = (iw_handler
) cfg80211_wext_siwgenie
,
1521 [IW_IOCTL_IDX(SIOCSIWAUTH
)] = (iw_handler
) cfg80211_wext_siwauth
,
1522 [IW_IOCTL_IDX(SIOCGIWAUTH
)] = (iw_handler
) cfg80211_wext_giwauth
,
1523 [IW_IOCTL_IDX(SIOCSIWENCODEEXT
)]= (iw_handler
) cfg80211_wext_siwencodeext
,
1524 [IW_IOCTL_IDX(SIOCSIWPMKSA
)] = (iw_handler
) cfg80211_wext_siwpmksa
,
1527 const struct iw_handler_def cfg80211_wext_handler
= {
1528 .num_standard
= ARRAY_SIZE(cfg80211_handlers
),
1529 .standard
= cfg80211_handlers
,
1530 .get_wireless_stats
= cfg80211_wireless_stats
,