1 // SPDX-License-Identifier: GPL-2.0
3 * cfg80211 - wext compat code
5 * This is temporary code until all wireless functionality is migrated
6 * into cfg80211, when that happens all the exports here go away and
7 * we directly assign the wireless handlers of wireless interfaces.
9 * Copyright 2008-2009 Johannes Berg <johannes@sipsolutions.net>
10 * Copyright (C) 2019 Intel Corporation
13 #include <linux/export.h>
14 #include <linux/wireless.h>
15 #include <linux/nl80211.h>
16 #include <linux/if_arp.h>
17 #include <linux/etherdevice.h>
18 #include <linux/slab.h>
19 #include <net/iw_handler.h>
20 #include <net/cfg80211.h>
21 #include <net/cfg80211-wext.h>
22 #include "wext-compat.h"
26 int cfg80211_wext_giwname(struct net_device
*dev
,
27 struct iw_request_info
*info
,
28 char *name
, char *extra
)
30 strcpy(name
, "IEEE 802.11");
33 EXPORT_WEXT_HANDLER(cfg80211_wext_giwname
);
35 int cfg80211_wext_siwmode(struct net_device
*dev
, struct iw_request_info
*info
,
36 u32
*mode
, char *extra
)
38 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
39 struct cfg80211_registered_device
*rdev
;
40 struct vif_params vifparams
;
41 enum nl80211_iftype type
;
43 rdev
= wiphy_to_rdev(wdev
->wiphy
);
47 type
= NL80211_IFTYPE_STATION
;
50 type
= NL80211_IFTYPE_ADHOC
;
53 type
= NL80211_IFTYPE_MONITOR
;
59 if (type
== wdev
->iftype
)
62 memset(&vifparams
, 0, sizeof(vifparams
));
64 return cfg80211_change_iface(rdev
, dev
, type
, &vifparams
);
66 EXPORT_WEXT_HANDLER(cfg80211_wext_siwmode
);
68 int cfg80211_wext_giwmode(struct net_device
*dev
, struct iw_request_info
*info
,
69 u32
*mode
, char *extra
)
71 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
76 switch (wdev
->iftype
) {
77 case NL80211_IFTYPE_AP
:
78 *mode
= IW_MODE_MASTER
;
80 case NL80211_IFTYPE_STATION
:
81 *mode
= IW_MODE_INFRA
;
83 case NL80211_IFTYPE_ADHOC
:
84 *mode
= IW_MODE_ADHOC
;
86 case NL80211_IFTYPE_MONITOR
:
87 *mode
= IW_MODE_MONITOR
;
89 case NL80211_IFTYPE_WDS
:
90 *mode
= IW_MODE_REPEAT
;
92 case NL80211_IFTYPE_AP_VLAN
:
93 *mode
= IW_MODE_SECOND
; /* FIXME */
101 EXPORT_WEXT_HANDLER(cfg80211_wext_giwmode
);
104 int cfg80211_wext_giwrange(struct net_device
*dev
,
105 struct iw_request_info
*info
,
106 struct iw_point
*data
, char *extra
)
108 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
109 struct iw_range
*range
= (struct iw_range
*) extra
;
110 enum nl80211_band band
;
116 data
->length
= sizeof(struct iw_range
);
117 memset(range
, 0, sizeof(struct iw_range
));
119 range
->we_version_compiled
= WIRELESS_EXT
;
120 range
->we_version_source
= 21;
121 range
->retry_capa
= IW_RETRY_LIMIT
;
122 range
->retry_flags
= IW_RETRY_LIMIT
;
123 range
->min_retry
= 0;
124 range
->max_retry
= 255;
126 range
->max_rts
= 2347;
127 range
->min_frag
= 256;
128 range
->max_frag
= 2346;
130 range
->max_encoding_tokens
= 4;
132 range
->max_qual
.updated
= IW_QUAL_NOISE_INVALID
;
134 switch (wdev
->wiphy
->signal_type
) {
135 case CFG80211_SIGNAL_TYPE_NONE
:
137 case CFG80211_SIGNAL_TYPE_MBM
:
138 range
->max_qual
.level
= (u8
)-110;
139 range
->max_qual
.qual
= 70;
140 range
->avg_qual
.qual
= 35;
141 range
->max_qual
.updated
|= IW_QUAL_DBM
;
142 range
->max_qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
143 range
->max_qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
145 case CFG80211_SIGNAL_TYPE_UNSPEC
:
146 range
->max_qual
.level
= 100;
147 range
->max_qual
.qual
= 100;
148 range
->avg_qual
.qual
= 50;
149 range
->max_qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
150 range
->max_qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
154 range
->avg_qual
.level
= range
->max_qual
.level
/ 2;
155 range
->avg_qual
.noise
= range
->max_qual
.noise
/ 2;
156 range
->avg_qual
.updated
= range
->max_qual
.updated
;
158 for (i
= 0; i
< wdev
->wiphy
->n_cipher_suites
; i
++) {
159 switch (wdev
->wiphy
->cipher_suites
[i
]) {
160 case WLAN_CIPHER_SUITE_TKIP
:
161 range
->enc_capa
|= (IW_ENC_CAPA_CIPHER_TKIP
|
165 case WLAN_CIPHER_SUITE_CCMP
:
166 range
->enc_capa
|= (IW_ENC_CAPA_CIPHER_CCMP
|
170 case WLAN_CIPHER_SUITE_WEP40
:
171 range
->encoding_size
[range
->num_encoding_sizes
++] =
175 case WLAN_CIPHER_SUITE_WEP104
:
176 range
->encoding_size
[range
->num_encoding_sizes
++] =
182 for (band
= 0; band
< NUM_NL80211_BANDS
; band
++) {
183 struct ieee80211_supported_band
*sband
;
185 sband
= wdev
->wiphy
->bands
[band
];
190 for (i
= 0; i
< sband
->n_channels
&& c
< IW_MAX_FREQUENCIES
; i
++) {
191 struct ieee80211_channel
*chan
= &sband
->channels
[i
];
193 if (!(chan
->flags
& IEEE80211_CHAN_DISABLED
)) {
195 ieee80211_frequency_to_channel(
197 range
->freq
[c
].m
= chan
->center_freq
;
198 range
->freq
[c
].e
= 6;
203 range
->num_channels
= c
;
204 range
->num_frequency
= c
;
206 IW_EVENT_CAPA_SET_KERNEL(range
->event_capa
);
207 IW_EVENT_CAPA_SET(range
->event_capa
, SIOCGIWAP
);
208 IW_EVENT_CAPA_SET(range
->event_capa
, SIOCGIWSCAN
);
210 if (wdev
->wiphy
->max_scan_ssids
> 0)
211 range
->scan_capa
|= IW_SCAN_CAPA_ESSID
;
215 EXPORT_WEXT_HANDLER(cfg80211_wext_giwrange
);
219 * cfg80211_wext_freq - get wext frequency for non-"auto"
220 * @freq: the wext freq encoding
222 * Returns a frequency, or a negative error code, or 0 for auto.
224 int cfg80211_wext_freq(struct iw_freq
*freq
)
227 * Parse frequency - return 0 for auto and
228 * -EINVAL for impossible things.
231 enum nl80211_band band
= NL80211_BAND_2GHZ
;
235 band
= NL80211_BAND_5GHZ
;
236 return ieee80211_channel_to_frequency(freq
->m
, band
);
238 int i
, div
= 1000000;
239 for (i
= 0; i
< freq
->e
; i
++)
243 return freq
->m
/ div
;
247 int cfg80211_wext_siwrts(struct net_device
*dev
,
248 struct iw_request_info
*info
,
249 struct iw_param
*rts
, char *extra
)
251 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
252 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
253 u32 orts
= wdev
->wiphy
->rts_threshold
;
256 if (rts
->disabled
|| !rts
->fixed
)
257 wdev
->wiphy
->rts_threshold
= (u32
) -1;
258 else if (rts
->value
< 0)
261 wdev
->wiphy
->rts_threshold
= rts
->value
;
263 err
= rdev_set_wiphy_params(rdev
, WIPHY_PARAM_RTS_THRESHOLD
);
265 wdev
->wiphy
->rts_threshold
= orts
;
269 EXPORT_WEXT_HANDLER(cfg80211_wext_siwrts
);
271 int cfg80211_wext_giwrts(struct net_device
*dev
,
272 struct iw_request_info
*info
,
273 struct iw_param
*rts
, char *extra
)
275 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
277 rts
->value
= wdev
->wiphy
->rts_threshold
;
278 rts
->disabled
= rts
->value
== (u32
) -1;
283 EXPORT_WEXT_HANDLER(cfg80211_wext_giwrts
);
285 int cfg80211_wext_siwfrag(struct net_device
*dev
,
286 struct iw_request_info
*info
,
287 struct iw_param
*frag
, char *extra
)
289 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
290 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
291 u32 ofrag
= wdev
->wiphy
->frag_threshold
;
294 if (frag
->disabled
|| !frag
->fixed
)
295 wdev
->wiphy
->frag_threshold
= (u32
) -1;
296 else if (frag
->value
< 256)
299 /* Fragment length must be even, so strip LSB. */
300 wdev
->wiphy
->frag_threshold
= frag
->value
& ~0x1;
303 err
= rdev_set_wiphy_params(rdev
, WIPHY_PARAM_FRAG_THRESHOLD
);
305 wdev
->wiphy
->frag_threshold
= ofrag
;
309 EXPORT_WEXT_HANDLER(cfg80211_wext_siwfrag
);
311 int cfg80211_wext_giwfrag(struct net_device
*dev
,
312 struct iw_request_info
*info
,
313 struct iw_param
*frag
, char *extra
)
315 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
317 frag
->value
= wdev
->wiphy
->frag_threshold
;
318 frag
->disabled
= frag
->value
== (u32
) -1;
323 EXPORT_WEXT_HANDLER(cfg80211_wext_giwfrag
);
325 static int cfg80211_wext_siwretry(struct net_device
*dev
,
326 struct iw_request_info
*info
,
327 struct iw_param
*retry
, char *extra
)
329 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
330 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
332 u8 olong
= wdev
->wiphy
->retry_long
;
333 u8 oshort
= wdev
->wiphy
->retry_short
;
336 if (retry
->disabled
|| retry
->value
< 1 || retry
->value
> 255 ||
337 (retry
->flags
& IW_RETRY_TYPE
) != IW_RETRY_LIMIT
)
340 if (retry
->flags
& IW_RETRY_LONG
) {
341 wdev
->wiphy
->retry_long
= retry
->value
;
342 changed
|= WIPHY_PARAM_RETRY_LONG
;
343 } else if (retry
->flags
& IW_RETRY_SHORT
) {
344 wdev
->wiphy
->retry_short
= retry
->value
;
345 changed
|= WIPHY_PARAM_RETRY_SHORT
;
347 wdev
->wiphy
->retry_short
= retry
->value
;
348 wdev
->wiphy
->retry_long
= retry
->value
;
349 changed
|= WIPHY_PARAM_RETRY_LONG
;
350 changed
|= WIPHY_PARAM_RETRY_SHORT
;
353 err
= rdev_set_wiphy_params(rdev
, changed
);
355 wdev
->wiphy
->retry_short
= oshort
;
356 wdev
->wiphy
->retry_long
= olong
;
362 int cfg80211_wext_giwretry(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
;
370 if (retry
->flags
== 0 || (retry
->flags
& IW_RETRY_SHORT
)) {
372 * First return short value, iwconfig will ask long value
375 retry
->flags
|= IW_RETRY_LIMIT
| IW_RETRY_SHORT
;
376 retry
->value
= wdev
->wiphy
->retry_short
;
377 if (wdev
->wiphy
->retry_long
== wdev
->wiphy
->retry_short
)
378 retry
->flags
|= IW_RETRY_LONG
;
383 if (retry
->flags
& IW_RETRY_LONG
) {
384 retry
->flags
= IW_RETRY_LIMIT
| IW_RETRY_LONG
;
385 retry
->value
= wdev
->wiphy
->retry_long
;
390 EXPORT_WEXT_HANDLER(cfg80211_wext_giwretry
);
392 static int __cfg80211_set_encryption(struct cfg80211_registered_device
*rdev
,
393 struct net_device
*dev
, bool pairwise
,
394 const u8
*addr
, bool remove
, bool tx_key
,
395 int idx
, struct key_params
*params
)
397 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
401 if (pairwise
&& !addr
)
405 * In many cases we won't actually need this, but it's better
406 * to do it first in case the allocation fails. Don't use wext.
408 if (!wdev
->wext
.keys
) {
409 wdev
->wext
.keys
= kzalloc(sizeof(*wdev
->wext
.keys
),
411 if (!wdev
->wext
.keys
)
413 for (i
= 0; i
< CFG80211_MAX_WEP_KEYS
; i
++)
414 wdev
->wext
.keys
->params
[i
].key
=
415 wdev
->wext
.keys
->data
[i
];
418 if (wdev
->iftype
!= NL80211_IFTYPE_ADHOC
&&
419 wdev
->iftype
!= NL80211_IFTYPE_STATION
)
422 if (params
->cipher
== WLAN_CIPHER_SUITE_AES_CMAC
) {
423 if (!wdev
->current_bss
)
426 if (!rdev
->ops
->set_default_mgmt_key
)
429 if (idx
< 4 || idx
> 5)
431 } else if (idx
< 0 || idx
> 3)
436 if (wdev
->current_bss
) {
438 * If removing the current TX key, we will need to
439 * join a new IBSS without the privacy bit clear.
441 if (idx
== wdev
->wext
.default_key
&&
442 wdev
->iftype
== NL80211_IFTYPE_ADHOC
) {
443 __cfg80211_leave_ibss(rdev
, wdev
->netdev
, true);
447 if (!pairwise
&& addr
&&
448 !(rdev
->wiphy
.flags
& WIPHY_FLAG_IBSS_RSN
))
451 err
= rdev_del_key(rdev
, dev
, idx
, pairwise
,
454 wdev
->wext
.connect
.privacy
= false;
456 * Applications using wireless extensions expect to be
457 * able to delete keys that don't exist, so allow that.
462 if (!addr
&& idx
< 4) {
463 memset(wdev
->wext
.keys
->data
[idx
], 0,
464 sizeof(wdev
->wext
.keys
->data
[idx
]));
465 wdev
->wext
.keys
->params
[idx
].key_len
= 0;
466 wdev
->wext
.keys
->params
[idx
].cipher
= 0;
468 if (idx
== wdev
->wext
.default_key
)
469 wdev
->wext
.default_key
= -1;
470 else if (idx
== wdev
->wext
.default_mgmt_key
)
471 wdev
->wext
.default_mgmt_key
= -1;
475 err
= cfg80211_ibss_wext_join(rdev
, wdev
);
483 if (cfg80211_validate_key_settings(rdev
, params
, idx
, pairwise
, addr
))
487 if (wdev
->current_bss
)
488 err
= rdev_add_key(rdev
, dev
, idx
, pairwise
, addr
, params
);
489 else if (params
->cipher
!= WLAN_CIPHER_SUITE_WEP40
&&
490 params
->cipher
!= WLAN_CIPHER_SUITE_WEP104
)
496 * We only need to store WEP keys, since they're the only keys that
497 * can be set before a connection is established and persist after
500 if (!addr
&& (params
->cipher
== WLAN_CIPHER_SUITE_WEP40
||
501 params
->cipher
== WLAN_CIPHER_SUITE_WEP104
)) {
502 wdev
->wext
.keys
->params
[idx
] = *params
;
503 memcpy(wdev
->wext
.keys
->data
[idx
],
504 params
->key
, params
->key_len
);
505 wdev
->wext
.keys
->params
[idx
].key
=
506 wdev
->wext
.keys
->data
[idx
];
509 if ((params
->cipher
== WLAN_CIPHER_SUITE_WEP40
||
510 params
->cipher
== WLAN_CIPHER_SUITE_WEP104
) &&
511 (tx_key
|| (!addr
&& wdev
->wext
.default_key
== -1))) {
512 if (wdev
->current_bss
) {
514 * If we are getting a new TX key from not having
515 * had one before we need to join a new IBSS with
516 * the privacy bit set.
518 if (wdev
->iftype
== NL80211_IFTYPE_ADHOC
&&
519 wdev
->wext
.default_key
== -1) {
520 __cfg80211_leave_ibss(rdev
, wdev
->netdev
, true);
523 err
= rdev_set_default_key(rdev
, dev
, idx
, true, true);
526 wdev
->wext
.default_key
= idx
;
528 err
= cfg80211_ibss_wext_join(rdev
, wdev
);
533 if (params
->cipher
== WLAN_CIPHER_SUITE_AES_CMAC
&&
534 (tx_key
|| (!addr
&& wdev
->wext
.default_mgmt_key
== -1))) {
535 if (wdev
->current_bss
)
536 err
= rdev_set_default_mgmt_key(rdev
, dev
, idx
);
538 wdev
->wext
.default_mgmt_key
= idx
;
545 static int cfg80211_set_encryption(struct cfg80211_registered_device
*rdev
,
546 struct net_device
*dev
, bool pairwise
,
547 const u8
*addr
, bool remove
, bool tx_key
,
548 int idx
, struct key_params
*params
)
552 wdev_lock(dev
->ieee80211_ptr
);
553 err
= __cfg80211_set_encryption(rdev
, dev
, pairwise
, addr
,
554 remove
, tx_key
, idx
, params
);
555 wdev_unlock(dev
->ieee80211_ptr
);
560 static int cfg80211_wext_siwencode(struct net_device
*dev
,
561 struct iw_request_info
*info
,
562 struct iw_point
*erq
, char *keybuf
)
564 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
565 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
568 struct key_params params
;
570 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
571 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
574 /* no use -- only MFP (set_default_mgmt_key) is optional */
575 if (!rdev
->ops
->del_key
||
576 !rdev
->ops
->add_key
||
577 !rdev
->ops
->set_default_key
)
580 idx
= erq
->flags
& IW_ENCODE_INDEX
;
582 idx
= wdev
->wext
.default_key
;
585 } else if (idx
< 1 || idx
> 4)
590 if (erq
->flags
& IW_ENCODE_DISABLED
)
592 else if (erq
->length
== 0) {
593 /* No key data - just set the default TX key index */
596 if (wdev
->current_bss
)
597 err
= rdev_set_default_key(rdev
, dev
, idx
, true,
600 wdev
->wext
.default_key
= idx
;
605 memset(¶ms
, 0, sizeof(params
));
607 params
.key_len
= erq
->length
;
608 if (erq
->length
== 5)
609 params
.cipher
= WLAN_CIPHER_SUITE_WEP40
;
610 else if (erq
->length
== 13)
611 params
.cipher
= WLAN_CIPHER_SUITE_WEP104
;
615 return cfg80211_set_encryption(rdev
, dev
, false, NULL
, remove
,
616 wdev
->wext
.default_key
== -1,
620 static int cfg80211_wext_siwencodeext(struct net_device
*dev
,
621 struct iw_request_info
*info
,
622 struct iw_point
*erq
, char *extra
)
624 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
625 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
626 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*) extra
;
630 struct key_params params
;
633 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
634 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
637 /* no use -- only MFP (set_default_mgmt_key) is optional */
638 if (!rdev
->ops
->del_key
||
639 !rdev
->ops
->add_key
||
640 !rdev
->ops
->set_default_key
)
644 case IW_ENCODE_ALG_NONE
:
648 case IW_ENCODE_ALG_WEP
:
649 if (ext
->key_len
== 5)
650 cipher
= WLAN_CIPHER_SUITE_WEP40
;
651 else if (ext
->key_len
== 13)
652 cipher
= WLAN_CIPHER_SUITE_WEP104
;
656 case IW_ENCODE_ALG_TKIP
:
657 cipher
= WLAN_CIPHER_SUITE_TKIP
;
659 case IW_ENCODE_ALG_CCMP
:
660 cipher
= WLAN_CIPHER_SUITE_CCMP
;
662 case IW_ENCODE_ALG_AES_CMAC
:
663 cipher
= WLAN_CIPHER_SUITE_AES_CMAC
;
669 if (erq
->flags
& IW_ENCODE_DISABLED
)
672 idx
= erq
->flags
& IW_ENCODE_INDEX
;
673 if (cipher
== WLAN_CIPHER_SUITE_AES_CMAC
) {
674 if (idx
< 4 || idx
> 5) {
675 idx
= wdev
->wext
.default_mgmt_key
;
681 if (idx
< 1 || idx
> 4) {
682 idx
= wdev
->wext
.default_key
;
689 addr
= ext
->addr
.sa_data
;
690 if (is_broadcast_ether_addr(addr
))
693 memset(¶ms
, 0, sizeof(params
));
694 params
.key
= ext
->key
;
695 params
.key_len
= ext
->key_len
;
696 params
.cipher
= cipher
;
698 if (ext
->ext_flags
& IW_ENCODE_EXT_RX_SEQ_VALID
) {
699 params
.seq
= ext
->rx_seq
;
703 return cfg80211_set_encryption(
705 !(ext
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
),
707 ext
->ext_flags
& IW_ENCODE_EXT_SET_TX_KEY
,
711 static int cfg80211_wext_giwencode(struct net_device
*dev
,
712 struct iw_request_info
*info
,
713 struct iw_point
*erq
, char *keybuf
)
715 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
718 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
719 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
722 idx
= erq
->flags
& IW_ENCODE_INDEX
;
724 idx
= wdev
->wext
.default_key
;
727 } else if (idx
< 1 || idx
> 4)
732 erq
->flags
= idx
+ 1;
734 if (!wdev
->wext
.keys
|| !wdev
->wext
.keys
->params
[idx
].cipher
) {
735 erq
->flags
|= IW_ENCODE_DISABLED
;
740 erq
->length
= min_t(size_t, erq
->length
,
741 wdev
->wext
.keys
->params
[idx
].key_len
);
742 memcpy(keybuf
, wdev
->wext
.keys
->params
[idx
].key
, erq
->length
);
743 erq
->flags
|= IW_ENCODE_ENABLED
;
748 static int cfg80211_wext_siwfreq(struct net_device
*dev
,
749 struct iw_request_info
*info
,
750 struct iw_freq
*wextfreq
, char *extra
)
752 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
753 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
754 struct cfg80211_chan_def chandef
= {
755 .width
= NL80211_CHAN_WIDTH_20_NOHT
,
759 switch (wdev
->iftype
) {
760 case NL80211_IFTYPE_STATION
:
761 return cfg80211_mgd_wext_siwfreq(dev
, info
, wextfreq
, extra
);
762 case NL80211_IFTYPE_ADHOC
:
763 return cfg80211_ibss_wext_siwfreq(dev
, info
, wextfreq
, extra
);
764 case NL80211_IFTYPE_MONITOR
:
765 freq
= cfg80211_wext_freq(wextfreq
);
770 chandef
.center_freq1
= freq
;
771 chandef
.chan
= ieee80211_get_channel(&rdev
->wiphy
, freq
);
774 return cfg80211_set_monitor_channel(rdev
, &chandef
);
775 case NL80211_IFTYPE_MESH_POINT
:
776 freq
= cfg80211_wext_freq(wextfreq
);
781 chandef
.center_freq1
= freq
;
782 chandef
.chan
= ieee80211_get_channel(&rdev
->wiphy
, freq
);
785 return cfg80211_set_mesh_channel(rdev
, wdev
, &chandef
);
791 static int cfg80211_wext_giwfreq(struct net_device
*dev
,
792 struct iw_request_info
*info
,
793 struct iw_freq
*freq
, char *extra
)
795 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
796 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
797 struct cfg80211_chan_def chandef
= {};
800 switch (wdev
->iftype
) {
801 case NL80211_IFTYPE_STATION
:
802 return cfg80211_mgd_wext_giwfreq(dev
, info
, freq
, extra
);
803 case NL80211_IFTYPE_ADHOC
:
804 return cfg80211_ibss_wext_giwfreq(dev
, info
, freq
, extra
);
805 case NL80211_IFTYPE_MONITOR
:
806 if (!rdev
->ops
->get_channel
)
809 ret
= rdev_get_channel(rdev
, wdev
, &chandef
);
812 freq
->m
= chandef
.chan
->center_freq
;
820 static int cfg80211_wext_siwtxpower(struct net_device
*dev
,
821 struct iw_request_info
*info
,
822 union iwreq_data
*data
, char *extra
)
824 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
825 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
826 enum nl80211_tx_power_setting type
;
829 if ((data
->txpower
.flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
)
831 if (data
->txpower
.flags
& IW_TXPOW_RANGE
)
834 if (!rdev
->ops
->set_tx_power
)
837 /* only change when not disabling */
838 if (!data
->txpower
.disabled
) {
839 rfkill_set_sw_state(rdev
->rfkill
, false);
841 if (data
->txpower
.fixed
) {
843 * wext doesn't support negative values, see
844 * below where it's for automatic
846 if (data
->txpower
.value
< 0)
848 dbm
= data
->txpower
.value
;
849 type
= NL80211_TX_POWER_FIXED
;
850 /* TODO: do regulatory check! */
853 * Automatic power level setting, max being the value
854 * passed in from userland.
856 if (data
->txpower
.value
< 0) {
857 type
= NL80211_TX_POWER_AUTOMATIC
;
859 dbm
= data
->txpower
.value
;
860 type
= NL80211_TX_POWER_LIMITED
;
864 if (rfkill_set_sw_state(rdev
->rfkill
, true))
865 schedule_work(&rdev
->rfkill_block
);
869 return rdev_set_tx_power(rdev
, wdev
, type
, DBM_TO_MBM(dbm
));
872 static int cfg80211_wext_giwtxpower(struct net_device
*dev
,
873 struct iw_request_info
*info
,
874 union iwreq_data
*data
, char *extra
)
876 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
877 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
880 if ((data
->txpower
.flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
)
882 if (data
->txpower
.flags
& IW_TXPOW_RANGE
)
885 if (!rdev
->ops
->get_tx_power
)
888 err
= rdev_get_tx_power(rdev
, wdev
, &val
);
892 /* well... oh well */
893 data
->txpower
.fixed
= 1;
894 data
->txpower
.disabled
= rfkill_blocked(rdev
->rfkill
);
895 data
->txpower
.value
= val
;
896 data
->txpower
.flags
= IW_TXPOW_DBM
;
901 static int cfg80211_set_auth_alg(struct wireless_dev
*wdev
,
909 if (auth_alg
& ~(IW_AUTH_ALG_OPEN_SYSTEM
|
910 IW_AUTH_ALG_SHARED_KEY
|
914 if (auth_alg
& IW_AUTH_ALG_OPEN_SYSTEM
) {
916 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_OPEN_SYSTEM
;
919 if (auth_alg
& IW_AUTH_ALG_SHARED_KEY
) {
921 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_SHARED_KEY
;
924 if (auth_alg
& IW_AUTH_ALG_LEAP
) {
926 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_NETWORK_EAP
;
930 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_AUTOMATIC
;
935 static int cfg80211_set_wpa_version(struct wireless_dev
*wdev
, u32 wpa_versions
)
937 if (wpa_versions
& ~(IW_AUTH_WPA_VERSION_WPA
|
938 IW_AUTH_WPA_VERSION_WPA2
|
939 IW_AUTH_WPA_VERSION_DISABLED
))
942 if ((wpa_versions
& IW_AUTH_WPA_VERSION_DISABLED
) &&
943 (wpa_versions
& (IW_AUTH_WPA_VERSION_WPA
|
944 IW_AUTH_WPA_VERSION_WPA2
)))
947 if (wpa_versions
& IW_AUTH_WPA_VERSION_DISABLED
)
948 wdev
->wext
.connect
.crypto
.wpa_versions
&=
949 ~(NL80211_WPA_VERSION_1
|NL80211_WPA_VERSION_2
);
951 if (wpa_versions
& IW_AUTH_WPA_VERSION_WPA
)
952 wdev
->wext
.connect
.crypto
.wpa_versions
|=
953 NL80211_WPA_VERSION_1
;
955 if (wpa_versions
& IW_AUTH_WPA_VERSION_WPA2
)
956 wdev
->wext
.connect
.crypto
.wpa_versions
|=
957 NL80211_WPA_VERSION_2
;
962 static int cfg80211_set_cipher_group(struct wireless_dev
*wdev
, u32 cipher
)
964 if (cipher
& IW_AUTH_CIPHER_WEP40
)
965 wdev
->wext
.connect
.crypto
.cipher_group
=
966 WLAN_CIPHER_SUITE_WEP40
;
967 else if (cipher
& IW_AUTH_CIPHER_WEP104
)
968 wdev
->wext
.connect
.crypto
.cipher_group
=
969 WLAN_CIPHER_SUITE_WEP104
;
970 else if (cipher
& IW_AUTH_CIPHER_TKIP
)
971 wdev
->wext
.connect
.crypto
.cipher_group
=
972 WLAN_CIPHER_SUITE_TKIP
;
973 else if (cipher
& IW_AUTH_CIPHER_CCMP
)
974 wdev
->wext
.connect
.crypto
.cipher_group
=
975 WLAN_CIPHER_SUITE_CCMP
;
976 else if (cipher
& IW_AUTH_CIPHER_AES_CMAC
)
977 wdev
->wext
.connect
.crypto
.cipher_group
=
978 WLAN_CIPHER_SUITE_AES_CMAC
;
979 else if (cipher
& IW_AUTH_CIPHER_NONE
)
980 wdev
->wext
.connect
.crypto
.cipher_group
= 0;
987 static int cfg80211_set_cipher_pairwise(struct wireless_dev
*wdev
, u32 cipher
)
990 u32
*ciphers_pairwise
= wdev
->wext
.connect
.crypto
.ciphers_pairwise
;
992 if (cipher
& IW_AUTH_CIPHER_WEP40
) {
993 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_WEP40
;
997 if (cipher
& IW_AUTH_CIPHER_WEP104
) {
998 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_WEP104
;
1002 if (cipher
& IW_AUTH_CIPHER_TKIP
) {
1003 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_TKIP
;
1007 if (cipher
& IW_AUTH_CIPHER_CCMP
) {
1008 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_CCMP
;
1012 if (cipher
& IW_AUTH_CIPHER_AES_CMAC
) {
1013 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_AES_CMAC
;
1017 BUILD_BUG_ON(NL80211_MAX_NR_CIPHER_SUITES
< 5);
1019 wdev
->wext
.connect
.crypto
.n_ciphers_pairwise
= nr_ciphers
;
1025 static int cfg80211_set_key_mgt(struct wireless_dev
*wdev
, u32 key_mgt
)
1027 int nr_akm_suites
= 0;
1029 if (key_mgt
& ~(IW_AUTH_KEY_MGMT_802_1X
|
1030 IW_AUTH_KEY_MGMT_PSK
))
1033 if (key_mgt
& IW_AUTH_KEY_MGMT_802_1X
) {
1034 wdev
->wext
.connect
.crypto
.akm_suites
[nr_akm_suites
] =
1035 WLAN_AKM_SUITE_8021X
;
1039 if (key_mgt
& IW_AUTH_KEY_MGMT_PSK
) {
1040 wdev
->wext
.connect
.crypto
.akm_suites
[nr_akm_suites
] =
1045 wdev
->wext
.connect
.crypto
.n_akm_suites
= nr_akm_suites
;
1050 static int cfg80211_wext_siwauth(struct net_device
*dev
,
1051 struct iw_request_info
*info
,
1052 struct iw_param
*data
, char *extra
)
1054 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1056 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1059 switch (data
->flags
& IW_AUTH_INDEX
) {
1060 case IW_AUTH_PRIVACY_INVOKED
:
1061 wdev
->wext
.connect
.privacy
= data
->value
;
1063 case IW_AUTH_WPA_VERSION
:
1064 return cfg80211_set_wpa_version(wdev
, data
->value
);
1065 case IW_AUTH_CIPHER_GROUP
:
1066 return cfg80211_set_cipher_group(wdev
, data
->value
);
1067 case IW_AUTH_KEY_MGMT
:
1068 return cfg80211_set_key_mgt(wdev
, data
->value
);
1069 case IW_AUTH_CIPHER_PAIRWISE
:
1070 return cfg80211_set_cipher_pairwise(wdev
, data
->value
);
1071 case IW_AUTH_80211_AUTH_ALG
:
1072 return cfg80211_set_auth_alg(wdev
, data
->value
);
1073 case IW_AUTH_WPA_ENABLED
:
1074 case IW_AUTH_RX_UNENCRYPTED_EAPOL
:
1075 case IW_AUTH_DROP_UNENCRYPTED
:
1083 static int cfg80211_wext_giwauth(struct net_device
*dev
,
1084 struct iw_request_info
*info
,
1085 struct iw_param
*data
, char *extra
)
1087 /* XXX: what do we need? */
1092 static int cfg80211_wext_siwpower(struct net_device
*dev
,
1093 struct iw_request_info
*info
,
1094 struct iw_param
*wrq
, char *extra
)
1096 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1097 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
1099 int timeout
= wdev
->ps_timeout
;
1102 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1105 if (!rdev
->ops
->set_power_mgmt
)
1108 if (wrq
->disabled
) {
1111 switch (wrq
->flags
& IW_POWER_MODE
) {
1112 case IW_POWER_ON
: /* If not specified */
1113 case IW_POWER_MODE
: /* If set all mask */
1114 case IW_POWER_ALL_R
: /* If explicitely state all */
1117 default: /* Otherwise we ignore */
1121 if (wrq
->flags
& ~(IW_POWER_MODE
| IW_POWER_TIMEOUT
))
1124 if (wrq
->flags
& IW_POWER_TIMEOUT
)
1125 timeout
= wrq
->value
/ 1000;
1128 err
= rdev_set_power_mgmt(rdev
, dev
, ps
, timeout
);
1133 wdev
->ps_timeout
= timeout
;
1139 static int cfg80211_wext_giwpower(struct net_device
*dev
,
1140 struct iw_request_info
*info
,
1141 struct iw_param
*wrq
, char *extra
)
1143 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1145 wrq
->disabled
= !wdev
->ps
;
1150 static int cfg80211_wext_siwrate(struct net_device
*dev
,
1151 struct iw_request_info
*info
,
1152 struct iw_param
*rate
, char *extra
)
1154 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1155 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
1156 struct cfg80211_bitrate_mask mask
;
1158 struct ieee80211_supported_band
*sband
;
1162 if (!rdev
->ops
->set_bitrate_mask
)
1165 memset(&mask
, 0, sizeof(mask
));
1169 if (rate
->value
< 0) {
1171 } else if (rate
->fixed
) {
1172 fixed
= rate
->value
/ 100000;
1174 maxrate
= rate
->value
/ 100000;
1177 for (band
= 0; band
< NUM_NL80211_BANDS
; band
++) {
1178 sband
= wdev
->wiphy
->bands
[band
];
1181 for (ridx
= 0; ridx
< sband
->n_bitrates
; ridx
++) {
1182 struct ieee80211_rate
*srate
= &sband
->bitrates
[ridx
];
1183 if (fixed
== srate
->bitrate
) {
1184 mask
.control
[band
].legacy
= 1 << ridx
;
1188 if (srate
->bitrate
<= maxrate
) {
1189 mask
.control
[band
].legacy
|= 1 << ridx
;
1198 return rdev_set_bitrate_mask(rdev
, dev
, NULL
, &mask
);
1201 static int cfg80211_wext_giwrate(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_rdev(wdev
->wiphy
);
1207 struct station_info sinfo
= {};
1211 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1214 if (!rdev
->ops
->get_station
)
1219 if (wdev
->current_bss
)
1220 memcpy(addr
, wdev
->current_bss
->pub
.bssid
, ETH_ALEN
);
1227 err
= rdev_get_station(rdev
, dev
, addr
, &sinfo
);
1231 if (!(sinfo
.filled
& BIT_ULL(NL80211_STA_INFO_TX_BITRATE
))) {
1236 rate
->value
= 100000 * cfg80211_calculate_bitrate(&sinfo
.txrate
);
1239 cfg80211_sinfo_release_content(&sinfo
);
1243 /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
1244 static struct iw_statistics
*cfg80211_wireless_stats(struct net_device
*dev
)
1246 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1247 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
1248 /* we are under RTNL - globally locked - so can use static structs */
1249 static struct iw_statistics wstats
;
1250 static struct station_info sinfo
= {};
1253 if (dev
->ieee80211_ptr
->iftype
!= NL80211_IFTYPE_STATION
)
1256 if (!rdev
->ops
->get_station
)
1259 /* Grab BSSID of current BSS, if any */
1261 if (!wdev
->current_bss
) {
1265 memcpy(bssid
, wdev
->current_bss
->pub
.bssid
, ETH_ALEN
);
1268 memset(&sinfo
, 0, sizeof(sinfo
));
1270 if (rdev_get_station(rdev
, dev
, bssid
, &sinfo
))
1273 memset(&wstats
, 0, sizeof(wstats
));
1275 switch (rdev
->wiphy
.signal_type
) {
1276 case CFG80211_SIGNAL_TYPE_MBM
:
1277 if (sinfo
.filled
& BIT_ULL(NL80211_STA_INFO_SIGNAL
)) {
1278 int sig
= sinfo
.signal
;
1279 wstats
.qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
1280 wstats
.qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
1281 wstats
.qual
.updated
|= IW_QUAL_DBM
;
1282 wstats
.qual
.level
= sig
;
1287 wstats
.qual
.qual
= sig
+ 110;
1291 case CFG80211_SIGNAL_TYPE_UNSPEC
:
1292 if (sinfo
.filled
& BIT_ULL(NL80211_STA_INFO_SIGNAL
)) {
1293 wstats
.qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
1294 wstats
.qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
1295 wstats
.qual
.level
= sinfo
.signal
;
1296 wstats
.qual
.qual
= sinfo
.signal
;
1301 wstats
.qual
.updated
|= IW_QUAL_LEVEL_INVALID
;
1302 wstats
.qual
.updated
|= IW_QUAL_QUAL_INVALID
;
1305 wstats
.qual
.updated
|= IW_QUAL_NOISE_INVALID
;
1306 if (sinfo
.filled
& BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC
))
1307 wstats
.discard
.misc
= sinfo
.rx_dropped_misc
;
1308 if (sinfo
.filled
& BIT_ULL(NL80211_STA_INFO_TX_FAILED
))
1309 wstats
.discard
.retries
= sinfo
.tx_failed
;
1311 cfg80211_sinfo_release_content(&sinfo
);
1316 static int cfg80211_wext_siwap(struct net_device
*dev
,
1317 struct iw_request_info
*info
,
1318 struct sockaddr
*ap_addr
, char *extra
)
1320 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1322 switch (wdev
->iftype
) {
1323 case NL80211_IFTYPE_ADHOC
:
1324 return cfg80211_ibss_wext_siwap(dev
, info
, ap_addr
, extra
);
1325 case NL80211_IFTYPE_STATION
:
1326 return cfg80211_mgd_wext_siwap(dev
, info
, ap_addr
, extra
);
1332 static int cfg80211_wext_giwap(struct net_device
*dev
,
1333 struct iw_request_info
*info
,
1334 struct sockaddr
*ap_addr
, char *extra
)
1336 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1338 switch (wdev
->iftype
) {
1339 case NL80211_IFTYPE_ADHOC
:
1340 return cfg80211_ibss_wext_giwap(dev
, info
, ap_addr
, extra
);
1341 case NL80211_IFTYPE_STATION
:
1342 return cfg80211_mgd_wext_giwap(dev
, info
, ap_addr
, extra
);
1348 static int cfg80211_wext_siwessid(struct net_device
*dev
,
1349 struct iw_request_info
*info
,
1350 struct iw_point
*data
, char *ssid
)
1352 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1354 switch (wdev
->iftype
) {
1355 case NL80211_IFTYPE_ADHOC
:
1356 return cfg80211_ibss_wext_siwessid(dev
, info
, data
, ssid
);
1357 case NL80211_IFTYPE_STATION
:
1358 return cfg80211_mgd_wext_siwessid(dev
, info
, data
, ssid
);
1364 static int cfg80211_wext_giwessid(struct net_device
*dev
,
1365 struct iw_request_info
*info
,
1366 struct iw_point
*data
, char *ssid
)
1368 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1373 switch (wdev
->iftype
) {
1374 case NL80211_IFTYPE_ADHOC
:
1375 return cfg80211_ibss_wext_giwessid(dev
, info
, data
, ssid
);
1376 case NL80211_IFTYPE_STATION
:
1377 return cfg80211_mgd_wext_giwessid(dev
, info
, data
, ssid
);
1383 static int cfg80211_wext_siwpmksa(struct net_device
*dev
,
1384 struct iw_request_info
*info
,
1385 struct iw_point
*data
, char *extra
)
1387 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1388 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
1389 struct cfg80211_pmksa cfg_pmksa
;
1390 struct iw_pmksa
*pmksa
= (struct iw_pmksa
*)extra
;
1392 memset(&cfg_pmksa
, 0, sizeof(struct cfg80211_pmksa
));
1394 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1397 cfg_pmksa
.bssid
= pmksa
->bssid
.sa_data
;
1398 cfg_pmksa
.pmkid
= pmksa
->pmkid
;
1400 switch (pmksa
->cmd
) {
1402 if (!rdev
->ops
->set_pmksa
)
1405 return rdev_set_pmksa(rdev
, dev
, &cfg_pmksa
);
1407 case IW_PMKSA_REMOVE
:
1408 if (!rdev
->ops
->del_pmksa
)
1411 return rdev_del_pmksa(rdev
, dev
, &cfg_pmksa
);
1413 case IW_PMKSA_FLUSH
:
1414 if (!rdev
->ops
->flush_pmksa
)
1417 return rdev_flush_pmksa(rdev
, dev
);
1424 #define DEFINE_WEXT_COMPAT_STUB(func, type) \
1425 static int __ ## func(struct net_device *dev, \
1426 struct iw_request_info *info, \
1427 union iwreq_data *wrqu, \
1430 return func(dev, info, (type *)wrqu, extra); \
1433 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwname
, char)
1434 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwfreq
, struct iw_freq
)
1435 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwfreq
, struct iw_freq
)
1436 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwmode
, u32
)
1437 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwmode
, u32
)
1438 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwrange
, struct iw_point
)
1439 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwap
, struct sockaddr
)
1440 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwap
, struct sockaddr
)
1441 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwmlme
, struct iw_point
)
1442 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwscan
, struct iw_point
)
1443 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwessid
, struct iw_point
)
1444 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwessid
, struct iw_point
)
1445 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwrate
, struct iw_param
)
1446 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwrate
, struct iw_param
)
1447 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwrts
, struct iw_param
)
1448 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwrts
, struct iw_param
)
1449 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwfrag
, struct iw_param
)
1450 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwfrag
, struct iw_param
)
1451 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwretry
, struct iw_param
)
1452 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwretry
, struct iw_param
)
1453 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwencode
, struct iw_point
)
1454 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwencode
, struct iw_point
)
1455 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwpower
, struct iw_param
)
1456 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwpower
, struct iw_param
)
1457 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwgenie
, struct iw_point
)
1458 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwauth
, struct iw_param
)
1459 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwauth
, struct iw_param
)
1460 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwencodeext
, struct iw_point
)
1461 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwpmksa
, struct iw_point
)
1463 static const iw_handler cfg80211_handlers
[] = {
1464 [IW_IOCTL_IDX(SIOCGIWNAME
)] = __cfg80211_wext_giwname
,
1465 [IW_IOCTL_IDX(SIOCSIWFREQ
)] = __cfg80211_wext_siwfreq
,
1466 [IW_IOCTL_IDX(SIOCGIWFREQ
)] = __cfg80211_wext_giwfreq
,
1467 [IW_IOCTL_IDX(SIOCSIWMODE
)] = __cfg80211_wext_siwmode
,
1468 [IW_IOCTL_IDX(SIOCGIWMODE
)] = __cfg80211_wext_giwmode
,
1469 [IW_IOCTL_IDX(SIOCGIWRANGE
)] = __cfg80211_wext_giwrange
,
1470 [IW_IOCTL_IDX(SIOCSIWAP
)] = __cfg80211_wext_siwap
,
1471 [IW_IOCTL_IDX(SIOCGIWAP
)] = __cfg80211_wext_giwap
,
1472 [IW_IOCTL_IDX(SIOCSIWMLME
)] = __cfg80211_wext_siwmlme
,
1473 [IW_IOCTL_IDX(SIOCSIWSCAN
)] = cfg80211_wext_siwscan
,
1474 [IW_IOCTL_IDX(SIOCGIWSCAN
)] = __cfg80211_wext_giwscan
,
1475 [IW_IOCTL_IDX(SIOCSIWESSID
)] = __cfg80211_wext_siwessid
,
1476 [IW_IOCTL_IDX(SIOCGIWESSID
)] = __cfg80211_wext_giwessid
,
1477 [IW_IOCTL_IDX(SIOCSIWRATE
)] = __cfg80211_wext_siwrate
,
1478 [IW_IOCTL_IDX(SIOCGIWRATE
)] = __cfg80211_wext_giwrate
,
1479 [IW_IOCTL_IDX(SIOCSIWRTS
)] = __cfg80211_wext_siwrts
,
1480 [IW_IOCTL_IDX(SIOCGIWRTS
)] = __cfg80211_wext_giwrts
,
1481 [IW_IOCTL_IDX(SIOCSIWFRAG
)] = __cfg80211_wext_siwfrag
,
1482 [IW_IOCTL_IDX(SIOCGIWFRAG
)] = __cfg80211_wext_giwfrag
,
1483 [IW_IOCTL_IDX(SIOCSIWTXPOW
)] = cfg80211_wext_siwtxpower
,
1484 [IW_IOCTL_IDX(SIOCGIWTXPOW
)] = cfg80211_wext_giwtxpower
,
1485 [IW_IOCTL_IDX(SIOCSIWRETRY
)] = __cfg80211_wext_siwretry
,
1486 [IW_IOCTL_IDX(SIOCGIWRETRY
)] = __cfg80211_wext_giwretry
,
1487 [IW_IOCTL_IDX(SIOCSIWENCODE
)] = __cfg80211_wext_siwencode
,
1488 [IW_IOCTL_IDX(SIOCGIWENCODE
)] = __cfg80211_wext_giwencode
,
1489 [IW_IOCTL_IDX(SIOCSIWPOWER
)] = __cfg80211_wext_siwpower
,
1490 [IW_IOCTL_IDX(SIOCGIWPOWER
)] = __cfg80211_wext_giwpower
,
1491 [IW_IOCTL_IDX(SIOCSIWGENIE
)] = __cfg80211_wext_siwgenie
,
1492 [IW_IOCTL_IDX(SIOCSIWAUTH
)] = __cfg80211_wext_siwauth
,
1493 [IW_IOCTL_IDX(SIOCGIWAUTH
)] = __cfg80211_wext_giwauth
,
1494 [IW_IOCTL_IDX(SIOCSIWENCODEEXT
)]= __cfg80211_wext_siwencodeext
,
1495 [IW_IOCTL_IDX(SIOCSIWPMKSA
)] = __cfg80211_wext_siwpmksa
,
1498 const struct iw_handler_def cfg80211_wext_handler
= {
1499 .num_standard
= ARRAY_SIZE(cfg80211_handlers
),
1500 .standard
= cfg80211_handlers
,
1501 .get_wireless_stats
= cfg80211_wireless_stats
,