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_WDS
;
56 type
= NL80211_IFTYPE_MONITOR
;
62 if (type
== wdev
->iftype
)
65 memset(&vifparams
, 0, sizeof(vifparams
));
67 return cfg80211_change_iface(rdev
, dev
, type
, &vifparams
);
69 EXPORT_WEXT_HANDLER(cfg80211_wext_siwmode
);
71 int cfg80211_wext_giwmode(struct net_device
*dev
, struct iw_request_info
*info
,
72 u32
*mode
, char *extra
)
74 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
79 switch (wdev
->iftype
) {
80 case NL80211_IFTYPE_AP
:
81 *mode
= IW_MODE_MASTER
;
83 case NL80211_IFTYPE_STATION
:
84 *mode
= IW_MODE_INFRA
;
86 case NL80211_IFTYPE_ADHOC
:
87 *mode
= IW_MODE_ADHOC
;
89 case NL80211_IFTYPE_MONITOR
:
90 *mode
= IW_MODE_MONITOR
;
92 case NL80211_IFTYPE_WDS
:
93 *mode
= IW_MODE_REPEAT
;
95 case NL80211_IFTYPE_AP_VLAN
:
96 *mode
= IW_MODE_SECOND
; /* FIXME */
104 EXPORT_WEXT_HANDLER(cfg80211_wext_giwmode
);
107 int cfg80211_wext_giwrange(struct net_device
*dev
,
108 struct iw_request_info
*info
,
109 struct iw_point
*data
, char *extra
)
111 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
112 struct iw_range
*range
= (struct iw_range
*) extra
;
113 enum nl80211_band band
;
119 data
->length
= sizeof(struct iw_range
);
120 memset(range
, 0, sizeof(struct iw_range
));
122 range
->we_version_compiled
= WIRELESS_EXT
;
123 range
->we_version_source
= 21;
124 range
->retry_capa
= IW_RETRY_LIMIT
;
125 range
->retry_flags
= IW_RETRY_LIMIT
;
126 range
->min_retry
= 0;
127 range
->max_retry
= 255;
129 range
->max_rts
= 2347;
130 range
->min_frag
= 256;
131 range
->max_frag
= 2346;
133 range
->max_encoding_tokens
= 4;
135 range
->max_qual
.updated
= IW_QUAL_NOISE_INVALID
;
137 switch (wdev
->wiphy
->signal_type
) {
138 case CFG80211_SIGNAL_TYPE_NONE
:
140 case CFG80211_SIGNAL_TYPE_MBM
:
141 range
->max_qual
.level
= (u8
)-110;
142 range
->max_qual
.qual
= 70;
143 range
->avg_qual
.qual
= 35;
144 range
->max_qual
.updated
|= IW_QUAL_DBM
;
145 range
->max_qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
146 range
->max_qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
148 case CFG80211_SIGNAL_TYPE_UNSPEC
:
149 range
->max_qual
.level
= 100;
150 range
->max_qual
.qual
= 100;
151 range
->avg_qual
.qual
= 50;
152 range
->max_qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
153 range
->max_qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
157 range
->avg_qual
.level
= range
->max_qual
.level
/ 2;
158 range
->avg_qual
.noise
= range
->max_qual
.noise
/ 2;
159 range
->avg_qual
.updated
= range
->max_qual
.updated
;
161 for (i
= 0; i
< wdev
->wiphy
->n_cipher_suites
; i
++) {
162 switch (wdev
->wiphy
->cipher_suites
[i
]) {
163 case WLAN_CIPHER_SUITE_TKIP
:
164 range
->enc_capa
|= (IW_ENC_CAPA_CIPHER_TKIP
|
168 case WLAN_CIPHER_SUITE_CCMP
:
169 range
->enc_capa
|= (IW_ENC_CAPA_CIPHER_CCMP
|
173 case WLAN_CIPHER_SUITE_WEP40
:
174 range
->encoding_size
[range
->num_encoding_sizes
++] =
178 case WLAN_CIPHER_SUITE_WEP104
:
179 range
->encoding_size
[range
->num_encoding_sizes
++] =
185 for (band
= 0; band
< NUM_NL80211_BANDS
; band
++) {
186 struct ieee80211_supported_band
*sband
;
188 sband
= wdev
->wiphy
->bands
[band
];
193 for (i
= 0; i
< sband
->n_channels
&& c
< IW_MAX_FREQUENCIES
; i
++) {
194 struct ieee80211_channel
*chan
= &sband
->channels
[i
];
196 if (!(chan
->flags
& IEEE80211_CHAN_DISABLED
)) {
198 ieee80211_frequency_to_channel(
200 range
->freq
[c
].m
= chan
->center_freq
;
201 range
->freq
[c
].e
= 6;
206 range
->num_channels
= c
;
207 range
->num_frequency
= c
;
209 IW_EVENT_CAPA_SET_KERNEL(range
->event_capa
);
210 IW_EVENT_CAPA_SET(range
->event_capa
, SIOCGIWAP
);
211 IW_EVENT_CAPA_SET(range
->event_capa
, SIOCGIWSCAN
);
213 if (wdev
->wiphy
->max_scan_ssids
> 0)
214 range
->scan_capa
|= IW_SCAN_CAPA_ESSID
;
218 EXPORT_WEXT_HANDLER(cfg80211_wext_giwrange
);
222 * cfg80211_wext_freq - get wext frequency for non-"auto"
223 * @dev: the net device
224 * @freq: the wext freq encoding
226 * Returns a frequency, or a negative error code, or 0 for auto.
228 int cfg80211_wext_freq(struct iw_freq
*freq
)
231 * Parse frequency - return 0 for auto and
232 * -EINVAL for impossible things.
235 enum nl80211_band band
= NL80211_BAND_2GHZ
;
239 band
= NL80211_BAND_5GHZ
;
240 return ieee80211_channel_to_frequency(freq
->m
, band
);
242 int i
, div
= 1000000;
243 for (i
= 0; i
< freq
->e
; i
++)
247 return freq
->m
/ div
;
251 int cfg80211_wext_siwrts(struct net_device
*dev
,
252 struct iw_request_info
*info
,
253 struct iw_param
*rts
, char *extra
)
255 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
256 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
257 u32 orts
= wdev
->wiphy
->rts_threshold
;
260 if (rts
->disabled
|| !rts
->fixed
)
261 wdev
->wiphy
->rts_threshold
= (u32
) -1;
262 else if (rts
->value
< 0)
265 wdev
->wiphy
->rts_threshold
= rts
->value
;
267 err
= rdev_set_wiphy_params(rdev
, WIPHY_PARAM_RTS_THRESHOLD
);
269 wdev
->wiphy
->rts_threshold
= orts
;
273 EXPORT_WEXT_HANDLER(cfg80211_wext_siwrts
);
275 int cfg80211_wext_giwrts(struct net_device
*dev
,
276 struct iw_request_info
*info
,
277 struct iw_param
*rts
, char *extra
)
279 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
281 rts
->value
= wdev
->wiphy
->rts_threshold
;
282 rts
->disabled
= rts
->value
== (u32
) -1;
287 EXPORT_WEXT_HANDLER(cfg80211_wext_giwrts
);
289 int cfg80211_wext_siwfrag(struct net_device
*dev
,
290 struct iw_request_info
*info
,
291 struct iw_param
*frag
, char *extra
)
293 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
294 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
295 u32 ofrag
= wdev
->wiphy
->frag_threshold
;
298 if (frag
->disabled
|| !frag
->fixed
)
299 wdev
->wiphy
->frag_threshold
= (u32
) -1;
300 else if (frag
->value
< 256)
303 /* Fragment length must be even, so strip LSB. */
304 wdev
->wiphy
->frag_threshold
= frag
->value
& ~0x1;
307 err
= rdev_set_wiphy_params(rdev
, WIPHY_PARAM_FRAG_THRESHOLD
);
309 wdev
->wiphy
->frag_threshold
= ofrag
;
313 EXPORT_WEXT_HANDLER(cfg80211_wext_siwfrag
);
315 int cfg80211_wext_giwfrag(struct net_device
*dev
,
316 struct iw_request_info
*info
,
317 struct iw_param
*frag
, char *extra
)
319 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
321 frag
->value
= wdev
->wiphy
->frag_threshold
;
322 frag
->disabled
= frag
->value
== (u32
) -1;
327 EXPORT_WEXT_HANDLER(cfg80211_wext_giwfrag
);
329 static int cfg80211_wext_siwretry(struct net_device
*dev
,
330 struct iw_request_info
*info
,
331 struct iw_param
*retry
, char *extra
)
333 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
334 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
336 u8 olong
= wdev
->wiphy
->retry_long
;
337 u8 oshort
= wdev
->wiphy
->retry_short
;
340 if (retry
->disabled
|| retry
->value
< 1 || retry
->value
> 255 ||
341 (retry
->flags
& IW_RETRY_TYPE
) != IW_RETRY_LIMIT
)
344 if (retry
->flags
& IW_RETRY_LONG
) {
345 wdev
->wiphy
->retry_long
= retry
->value
;
346 changed
|= WIPHY_PARAM_RETRY_LONG
;
347 } else if (retry
->flags
& IW_RETRY_SHORT
) {
348 wdev
->wiphy
->retry_short
= retry
->value
;
349 changed
|= WIPHY_PARAM_RETRY_SHORT
;
351 wdev
->wiphy
->retry_short
= retry
->value
;
352 wdev
->wiphy
->retry_long
= retry
->value
;
353 changed
|= WIPHY_PARAM_RETRY_LONG
;
354 changed
|= WIPHY_PARAM_RETRY_SHORT
;
357 err
= rdev_set_wiphy_params(rdev
, changed
);
359 wdev
->wiphy
->retry_short
= oshort
;
360 wdev
->wiphy
->retry_long
= olong
;
366 int cfg80211_wext_giwretry(struct net_device
*dev
,
367 struct iw_request_info
*info
,
368 struct iw_param
*retry
, char *extra
)
370 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
374 if (retry
->flags
== 0 || (retry
->flags
& IW_RETRY_SHORT
)) {
376 * First return short value, iwconfig will ask long value
379 retry
->flags
|= IW_RETRY_LIMIT
| IW_RETRY_SHORT
;
380 retry
->value
= wdev
->wiphy
->retry_short
;
381 if (wdev
->wiphy
->retry_long
== wdev
->wiphy
->retry_short
)
382 retry
->flags
|= IW_RETRY_LONG
;
387 if (retry
->flags
& IW_RETRY_LONG
) {
388 retry
->flags
= IW_RETRY_LIMIT
| IW_RETRY_LONG
;
389 retry
->value
= wdev
->wiphy
->retry_long
;
394 EXPORT_WEXT_HANDLER(cfg80211_wext_giwretry
);
396 static int __cfg80211_set_encryption(struct cfg80211_registered_device
*rdev
,
397 struct net_device
*dev
, bool pairwise
,
398 const u8
*addr
, bool remove
, bool tx_key
,
399 int idx
, struct key_params
*params
)
401 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
405 if (pairwise
&& !addr
)
409 * In many cases we won't actually need this, but it's better
410 * to do it first in case the allocation fails. Don't use wext.
412 if (!wdev
->wext
.keys
) {
413 wdev
->wext
.keys
= kzalloc(sizeof(*wdev
->wext
.keys
),
415 if (!wdev
->wext
.keys
)
417 for (i
= 0; i
< CFG80211_MAX_WEP_KEYS
; i
++)
418 wdev
->wext
.keys
->params
[i
].key
=
419 wdev
->wext
.keys
->data
[i
];
422 if (wdev
->iftype
!= NL80211_IFTYPE_ADHOC
&&
423 wdev
->iftype
!= NL80211_IFTYPE_STATION
)
426 if (params
->cipher
== WLAN_CIPHER_SUITE_AES_CMAC
) {
427 if (!wdev
->current_bss
)
430 if (!rdev
->ops
->set_default_mgmt_key
)
433 if (idx
< 4 || idx
> 5)
435 } else if (idx
< 0 || idx
> 3)
440 if (wdev
->current_bss
) {
442 * If removing the current TX key, we will need to
443 * join a new IBSS without the privacy bit clear.
445 if (idx
== wdev
->wext
.default_key
&&
446 wdev
->iftype
== NL80211_IFTYPE_ADHOC
) {
447 __cfg80211_leave_ibss(rdev
, wdev
->netdev
, true);
451 if (!pairwise
&& addr
&&
452 !(rdev
->wiphy
.flags
& WIPHY_FLAG_IBSS_RSN
))
455 err
= rdev_del_key(rdev
, dev
, idx
, pairwise
,
458 wdev
->wext
.connect
.privacy
= false;
460 * Applications using wireless extensions expect to be
461 * able to delete keys that don't exist, so allow that.
466 if (!addr
&& idx
< 4) {
467 memset(wdev
->wext
.keys
->data
[idx
], 0,
468 sizeof(wdev
->wext
.keys
->data
[idx
]));
469 wdev
->wext
.keys
->params
[idx
].key_len
= 0;
470 wdev
->wext
.keys
->params
[idx
].cipher
= 0;
472 if (idx
== wdev
->wext
.default_key
)
473 wdev
->wext
.default_key
= -1;
474 else if (idx
== wdev
->wext
.default_mgmt_key
)
475 wdev
->wext
.default_mgmt_key
= -1;
479 err
= cfg80211_ibss_wext_join(rdev
, wdev
);
487 if (cfg80211_validate_key_settings(rdev
, params
, idx
, pairwise
, addr
))
491 if (wdev
->current_bss
)
492 err
= rdev_add_key(rdev
, dev
, idx
, pairwise
, addr
, params
);
493 else if (params
->cipher
!= WLAN_CIPHER_SUITE_WEP40
&&
494 params
->cipher
!= WLAN_CIPHER_SUITE_WEP104
)
500 * We only need to store WEP keys, since they're the only keys that
501 * can be be set before a connection is established and persist after
504 if (!addr
&& (params
->cipher
== WLAN_CIPHER_SUITE_WEP40
||
505 params
->cipher
== WLAN_CIPHER_SUITE_WEP104
)) {
506 wdev
->wext
.keys
->params
[idx
] = *params
;
507 memcpy(wdev
->wext
.keys
->data
[idx
],
508 params
->key
, params
->key_len
);
509 wdev
->wext
.keys
->params
[idx
].key
=
510 wdev
->wext
.keys
->data
[idx
];
513 if ((params
->cipher
== WLAN_CIPHER_SUITE_WEP40
||
514 params
->cipher
== WLAN_CIPHER_SUITE_WEP104
) &&
515 (tx_key
|| (!addr
&& wdev
->wext
.default_key
== -1))) {
516 if (wdev
->current_bss
) {
518 * If we are getting a new TX key from not having
519 * had one before we need to join a new IBSS with
520 * the privacy bit set.
522 if (wdev
->iftype
== NL80211_IFTYPE_ADHOC
&&
523 wdev
->wext
.default_key
== -1) {
524 __cfg80211_leave_ibss(rdev
, wdev
->netdev
, true);
527 err
= rdev_set_default_key(rdev
, dev
, idx
, true, true);
530 wdev
->wext
.default_key
= idx
;
532 err
= cfg80211_ibss_wext_join(rdev
, wdev
);
537 if (params
->cipher
== WLAN_CIPHER_SUITE_AES_CMAC
&&
538 (tx_key
|| (!addr
&& wdev
->wext
.default_mgmt_key
== -1))) {
539 if (wdev
->current_bss
)
540 err
= rdev_set_default_mgmt_key(rdev
, dev
, idx
);
542 wdev
->wext
.default_mgmt_key
= idx
;
549 static int cfg80211_set_encryption(struct cfg80211_registered_device
*rdev
,
550 struct net_device
*dev
, bool pairwise
,
551 const u8
*addr
, bool remove
, bool tx_key
,
552 int idx
, struct key_params
*params
)
556 wdev_lock(dev
->ieee80211_ptr
);
557 err
= __cfg80211_set_encryption(rdev
, dev
, pairwise
, addr
,
558 remove
, tx_key
, idx
, params
);
559 wdev_unlock(dev
->ieee80211_ptr
);
564 static int cfg80211_wext_siwencode(struct net_device
*dev
,
565 struct iw_request_info
*info
,
566 struct iw_point
*erq
, char *keybuf
)
568 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
569 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
572 struct key_params params
;
574 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
575 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
578 /* no use -- only MFP (set_default_mgmt_key) is optional */
579 if (!rdev
->ops
->del_key
||
580 !rdev
->ops
->add_key
||
581 !rdev
->ops
->set_default_key
)
584 idx
= erq
->flags
& IW_ENCODE_INDEX
;
586 idx
= wdev
->wext
.default_key
;
589 } else if (idx
< 1 || idx
> 4)
594 if (erq
->flags
& IW_ENCODE_DISABLED
)
596 else if (erq
->length
== 0) {
597 /* No key data - just set the default TX key index */
600 if (wdev
->current_bss
)
601 err
= rdev_set_default_key(rdev
, dev
, idx
, true,
604 wdev
->wext
.default_key
= idx
;
609 memset(¶ms
, 0, sizeof(params
));
611 params
.key_len
= erq
->length
;
612 if (erq
->length
== 5)
613 params
.cipher
= WLAN_CIPHER_SUITE_WEP40
;
614 else if (erq
->length
== 13)
615 params
.cipher
= WLAN_CIPHER_SUITE_WEP104
;
619 return cfg80211_set_encryption(rdev
, dev
, false, NULL
, remove
,
620 wdev
->wext
.default_key
== -1,
624 static int cfg80211_wext_siwencodeext(struct net_device
*dev
,
625 struct iw_request_info
*info
,
626 struct iw_point
*erq
, char *extra
)
628 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
629 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
630 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*) extra
;
634 struct key_params params
;
637 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
638 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
641 /* no use -- only MFP (set_default_mgmt_key) is optional */
642 if (!rdev
->ops
->del_key
||
643 !rdev
->ops
->add_key
||
644 !rdev
->ops
->set_default_key
)
648 case IW_ENCODE_ALG_NONE
:
652 case IW_ENCODE_ALG_WEP
:
653 if (ext
->key_len
== 5)
654 cipher
= WLAN_CIPHER_SUITE_WEP40
;
655 else if (ext
->key_len
== 13)
656 cipher
= WLAN_CIPHER_SUITE_WEP104
;
660 case IW_ENCODE_ALG_TKIP
:
661 cipher
= WLAN_CIPHER_SUITE_TKIP
;
663 case IW_ENCODE_ALG_CCMP
:
664 cipher
= WLAN_CIPHER_SUITE_CCMP
;
666 case IW_ENCODE_ALG_AES_CMAC
:
667 cipher
= WLAN_CIPHER_SUITE_AES_CMAC
;
673 if (erq
->flags
& IW_ENCODE_DISABLED
)
676 idx
= erq
->flags
& IW_ENCODE_INDEX
;
677 if (cipher
== WLAN_CIPHER_SUITE_AES_CMAC
) {
678 if (idx
< 4 || idx
> 5) {
679 idx
= wdev
->wext
.default_mgmt_key
;
685 if (idx
< 1 || idx
> 4) {
686 idx
= wdev
->wext
.default_key
;
693 addr
= ext
->addr
.sa_data
;
694 if (is_broadcast_ether_addr(addr
))
697 memset(¶ms
, 0, sizeof(params
));
698 params
.key
= ext
->key
;
699 params
.key_len
= ext
->key_len
;
700 params
.cipher
= cipher
;
702 if (ext
->ext_flags
& IW_ENCODE_EXT_RX_SEQ_VALID
) {
703 params
.seq
= ext
->rx_seq
;
707 return cfg80211_set_encryption(
709 !(ext
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
),
711 ext
->ext_flags
& IW_ENCODE_EXT_SET_TX_KEY
,
715 static int cfg80211_wext_giwencode(struct net_device
*dev
,
716 struct iw_request_info
*info
,
717 struct iw_point
*erq
, char *keybuf
)
719 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
722 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
723 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
726 idx
= erq
->flags
& IW_ENCODE_INDEX
;
728 idx
= wdev
->wext
.default_key
;
731 } else if (idx
< 1 || idx
> 4)
736 erq
->flags
= idx
+ 1;
738 if (!wdev
->wext
.keys
|| !wdev
->wext
.keys
->params
[idx
].cipher
) {
739 erq
->flags
|= IW_ENCODE_DISABLED
;
744 erq
->length
= min_t(size_t, erq
->length
,
745 wdev
->wext
.keys
->params
[idx
].key_len
);
746 memcpy(keybuf
, wdev
->wext
.keys
->params
[idx
].key
, erq
->length
);
747 erq
->flags
|= IW_ENCODE_ENABLED
;
752 static int cfg80211_wext_siwfreq(struct net_device
*dev
,
753 struct iw_request_info
*info
,
754 struct iw_freq
*wextfreq
, char *extra
)
756 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
757 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
758 struct cfg80211_chan_def chandef
= {
759 .width
= NL80211_CHAN_WIDTH_20_NOHT
,
763 switch (wdev
->iftype
) {
764 case NL80211_IFTYPE_STATION
:
765 return cfg80211_mgd_wext_siwfreq(dev
, info
, wextfreq
, extra
);
766 case NL80211_IFTYPE_ADHOC
:
767 return cfg80211_ibss_wext_siwfreq(dev
, info
, wextfreq
, extra
);
768 case NL80211_IFTYPE_MONITOR
:
769 freq
= cfg80211_wext_freq(wextfreq
);
774 chandef
.center_freq1
= freq
;
775 chandef
.chan
= ieee80211_get_channel(&rdev
->wiphy
, freq
);
778 return cfg80211_set_monitor_channel(rdev
, &chandef
);
779 case NL80211_IFTYPE_MESH_POINT
:
780 freq
= cfg80211_wext_freq(wextfreq
);
785 chandef
.center_freq1
= freq
;
786 chandef
.chan
= ieee80211_get_channel(&rdev
->wiphy
, freq
);
789 return cfg80211_set_mesh_channel(rdev
, wdev
, &chandef
);
795 static int cfg80211_wext_giwfreq(struct net_device
*dev
,
796 struct iw_request_info
*info
,
797 struct iw_freq
*freq
, char *extra
)
799 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
800 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
801 struct cfg80211_chan_def chandef
= {};
804 switch (wdev
->iftype
) {
805 case NL80211_IFTYPE_STATION
:
806 return cfg80211_mgd_wext_giwfreq(dev
, info
, freq
, extra
);
807 case NL80211_IFTYPE_ADHOC
:
808 return cfg80211_ibss_wext_giwfreq(dev
, info
, freq
, extra
);
809 case NL80211_IFTYPE_MONITOR
:
810 if (!rdev
->ops
->get_channel
)
813 ret
= rdev_get_channel(rdev
, wdev
, &chandef
);
816 freq
->m
= chandef
.chan
->center_freq
;
824 static int cfg80211_wext_siwtxpower(struct net_device
*dev
,
825 struct iw_request_info
*info
,
826 union iwreq_data
*data
, char *extra
)
828 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
829 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
830 enum nl80211_tx_power_setting type
;
833 if ((data
->txpower
.flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
)
835 if (data
->txpower
.flags
& IW_TXPOW_RANGE
)
838 if (!rdev
->ops
->set_tx_power
)
841 /* only change when not disabling */
842 if (!data
->txpower
.disabled
) {
843 rfkill_set_sw_state(rdev
->rfkill
, false);
845 if (data
->txpower
.fixed
) {
847 * wext doesn't support negative values, see
848 * below where it's for automatic
850 if (data
->txpower
.value
< 0)
852 dbm
= data
->txpower
.value
;
853 type
= NL80211_TX_POWER_FIXED
;
854 /* TODO: do regulatory check! */
857 * Automatic power level setting, max being the value
858 * passed in from userland.
860 if (data
->txpower
.value
< 0) {
861 type
= NL80211_TX_POWER_AUTOMATIC
;
863 dbm
= data
->txpower
.value
;
864 type
= NL80211_TX_POWER_LIMITED
;
868 if (rfkill_set_sw_state(rdev
->rfkill
, true))
869 schedule_work(&rdev
->rfkill_block
);
873 return rdev_set_tx_power(rdev
, wdev
, type
, DBM_TO_MBM(dbm
));
876 static int cfg80211_wext_giwtxpower(struct net_device
*dev
,
877 struct iw_request_info
*info
,
878 union iwreq_data
*data
, char *extra
)
880 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
881 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
884 if ((data
->txpower
.flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
)
886 if (data
->txpower
.flags
& IW_TXPOW_RANGE
)
889 if (!rdev
->ops
->get_tx_power
)
892 err
= rdev_get_tx_power(rdev
, wdev
, &val
);
896 /* well... oh well */
897 data
->txpower
.fixed
= 1;
898 data
->txpower
.disabled
= rfkill_blocked(rdev
->rfkill
);
899 data
->txpower
.value
= val
;
900 data
->txpower
.flags
= IW_TXPOW_DBM
;
905 static int cfg80211_set_auth_alg(struct wireless_dev
*wdev
,
913 if (auth_alg
& ~(IW_AUTH_ALG_OPEN_SYSTEM
|
914 IW_AUTH_ALG_SHARED_KEY
|
918 if (auth_alg
& IW_AUTH_ALG_OPEN_SYSTEM
) {
920 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_OPEN_SYSTEM
;
923 if (auth_alg
& IW_AUTH_ALG_SHARED_KEY
) {
925 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_SHARED_KEY
;
928 if (auth_alg
& IW_AUTH_ALG_LEAP
) {
930 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_NETWORK_EAP
;
934 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_AUTOMATIC
;
939 static int cfg80211_set_wpa_version(struct wireless_dev
*wdev
, u32 wpa_versions
)
941 if (wpa_versions
& ~(IW_AUTH_WPA_VERSION_WPA
|
942 IW_AUTH_WPA_VERSION_WPA2
|
943 IW_AUTH_WPA_VERSION_DISABLED
))
946 if ((wpa_versions
& IW_AUTH_WPA_VERSION_DISABLED
) &&
947 (wpa_versions
& (IW_AUTH_WPA_VERSION_WPA
|
948 IW_AUTH_WPA_VERSION_WPA2
)))
951 if (wpa_versions
& IW_AUTH_WPA_VERSION_DISABLED
)
952 wdev
->wext
.connect
.crypto
.wpa_versions
&=
953 ~(NL80211_WPA_VERSION_1
|NL80211_WPA_VERSION_2
);
955 if (wpa_versions
& IW_AUTH_WPA_VERSION_WPA
)
956 wdev
->wext
.connect
.crypto
.wpa_versions
|=
957 NL80211_WPA_VERSION_1
;
959 if (wpa_versions
& IW_AUTH_WPA_VERSION_WPA2
)
960 wdev
->wext
.connect
.crypto
.wpa_versions
|=
961 NL80211_WPA_VERSION_2
;
966 static int cfg80211_set_cipher_group(struct wireless_dev
*wdev
, u32 cipher
)
968 if (cipher
& IW_AUTH_CIPHER_WEP40
)
969 wdev
->wext
.connect
.crypto
.cipher_group
=
970 WLAN_CIPHER_SUITE_WEP40
;
971 else if (cipher
& IW_AUTH_CIPHER_WEP104
)
972 wdev
->wext
.connect
.crypto
.cipher_group
=
973 WLAN_CIPHER_SUITE_WEP104
;
974 else if (cipher
& IW_AUTH_CIPHER_TKIP
)
975 wdev
->wext
.connect
.crypto
.cipher_group
=
976 WLAN_CIPHER_SUITE_TKIP
;
977 else if (cipher
& IW_AUTH_CIPHER_CCMP
)
978 wdev
->wext
.connect
.crypto
.cipher_group
=
979 WLAN_CIPHER_SUITE_CCMP
;
980 else if (cipher
& IW_AUTH_CIPHER_AES_CMAC
)
981 wdev
->wext
.connect
.crypto
.cipher_group
=
982 WLAN_CIPHER_SUITE_AES_CMAC
;
983 else if (cipher
& IW_AUTH_CIPHER_NONE
)
984 wdev
->wext
.connect
.crypto
.cipher_group
= 0;
991 static int cfg80211_set_cipher_pairwise(struct wireless_dev
*wdev
, u32 cipher
)
994 u32
*ciphers_pairwise
= wdev
->wext
.connect
.crypto
.ciphers_pairwise
;
996 if (cipher
& IW_AUTH_CIPHER_WEP40
) {
997 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_WEP40
;
1001 if (cipher
& IW_AUTH_CIPHER_WEP104
) {
1002 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_WEP104
;
1006 if (cipher
& IW_AUTH_CIPHER_TKIP
) {
1007 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_TKIP
;
1011 if (cipher
& IW_AUTH_CIPHER_CCMP
) {
1012 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_CCMP
;
1016 if (cipher
& IW_AUTH_CIPHER_AES_CMAC
) {
1017 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_AES_CMAC
;
1021 BUILD_BUG_ON(NL80211_MAX_NR_CIPHER_SUITES
< 5);
1023 wdev
->wext
.connect
.crypto
.n_ciphers_pairwise
= nr_ciphers
;
1029 static int cfg80211_set_key_mgt(struct wireless_dev
*wdev
, u32 key_mgt
)
1031 int nr_akm_suites
= 0;
1033 if (key_mgt
& ~(IW_AUTH_KEY_MGMT_802_1X
|
1034 IW_AUTH_KEY_MGMT_PSK
))
1037 if (key_mgt
& IW_AUTH_KEY_MGMT_802_1X
) {
1038 wdev
->wext
.connect
.crypto
.akm_suites
[nr_akm_suites
] =
1039 WLAN_AKM_SUITE_8021X
;
1043 if (key_mgt
& IW_AUTH_KEY_MGMT_PSK
) {
1044 wdev
->wext
.connect
.crypto
.akm_suites
[nr_akm_suites
] =
1049 wdev
->wext
.connect
.crypto
.n_akm_suites
= nr_akm_suites
;
1054 static int cfg80211_wext_siwauth(struct net_device
*dev
,
1055 struct iw_request_info
*info
,
1056 struct iw_param
*data
, char *extra
)
1058 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1060 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1063 switch (data
->flags
& IW_AUTH_INDEX
) {
1064 case IW_AUTH_PRIVACY_INVOKED
:
1065 wdev
->wext
.connect
.privacy
= data
->value
;
1067 case IW_AUTH_WPA_VERSION
:
1068 return cfg80211_set_wpa_version(wdev
, data
->value
);
1069 case IW_AUTH_CIPHER_GROUP
:
1070 return cfg80211_set_cipher_group(wdev
, data
->value
);
1071 case IW_AUTH_KEY_MGMT
:
1072 return cfg80211_set_key_mgt(wdev
, data
->value
);
1073 case IW_AUTH_CIPHER_PAIRWISE
:
1074 return cfg80211_set_cipher_pairwise(wdev
, data
->value
);
1075 case IW_AUTH_80211_AUTH_ALG
:
1076 return cfg80211_set_auth_alg(wdev
, data
->value
);
1077 case IW_AUTH_WPA_ENABLED
:
1078 case IW_AUTH_RX_UNENCRYPTED_EAPOL
:
1079 case IW_AUTH_DROP_UNENCRYPTED
:
1087 static int cfg80211_wext_giwauth(struct net_device
*dev
,
1088 struct iw_request_info
*info
,
1089 struct iw_param
*data
, char *extra
)
1091 /* XXX: what do we need? */
1096 static int cfg80211_wext_siwpower(struct net_device
*dev
,
1097 struct iw_request_info
*info
,
1098 struct iw_param
*wrq
, char *extra
)
1100 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1101 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
1103 int timeout
= wdev
->ps_timeout
;
1106 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1109 if (!rdev
->ops
->set_power_mgmt
)
1112 if (wrq
->disabled
) {
1115 switch (wrq
->flags
& IW_POWER_MODE
) {
1116 case IW_POWER_ON
: /* If not specified */
1117 case IW_POWER_MODE
: /* If set all mask */
1118 case IW_POWER_ALL_R
: /* If explicitely state all */
1121 default: /* Otherwise we ignore */
1125 if (wrq
->flags
& ~(IW_POWER_MODE
| IW_POWER_TIMEOUT
))
1128 if (wrq
->flags
& IW_POWER_TIMEOUT
)
1129 timeout
= wrq
->value
/ 1000;
1132 err
= rdev_set_power_mgmt(rdev
, dev
, ps
, timeout
);
1137 wdev
->ps_timeout
= timeout
;
1143 static int cfg80211_wext_giwpower(struct net_device
*dev
,
1144 struct iw_request_info
*info
,
1145 struct iw_param
*wrq
, char *extra
)
1147 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1149 wrq
->disabled
= !wdev
->ps
;
1154 static int cfg80211_wds_wext_siwap(struct net_device
*dev
,
1155 struct iw_request_info
*info
,
1156 struct sockaddr
*addr
, char *extra
)
1158 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1159 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
1162 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_WDS
))
1165 if (addr
->sa_family
!= ARPHRD_ETHER
)
1168 if (netif_running(dev
))
1171 if (!rdev
->ops
->set_wds_peer
)
1174 err
= rdev_set_wds_peer(rdev
, dev
, (u8
*)&addr
->sa_data
);
1178 memcpy(&wdev
->wext
.bssid
, (u8
*) &addr
->sa_data
, ETH_ALEN
);
1183 static int cfg80211_wds_wext_giwap(struct net_device
*dev
,
1184 struct iw_request_info
*info
,
1185 struct sockaddr
*addr
, char *extra
)
1187 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1189 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_WDS
))
1192 addr
->sa_family
= ARPHRD_ETHER
;
1193 memcpy(&addr
->sa_data
, wdev
->wext
.bssid
, ETH_ALEN
);
1198 static int cfg80211_wext_siwrate(struct net_device
*dev
,
1199 struct iw_request_info
*info
,
1200 struct iw_param
*rate
, char *extra
)
1202 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1203 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
1204 struct cfg80211_bitrate_mask mask
;
1206 struct ieee80211_supported_band
*sband
;
1210 if (!rdev
->ops
->set_bitrate_mask
)
1213 memset(&mask
, 0, sizeof(mask
));
1217 if (rate
->value
< 0) {
1219 } else if (rate
->fixed
) {
1220 fixed
= rate
->value
/ 100000;
1222 maxrate
= rate
->value
/ 100000;
1225 for (band
= 0; band
< NUM_NL80211_BANDS
; band
++) {
1226 sband
= wdev
->wiphy
->bands
[band
];
1229 for (ridx
= 0; ridx
< sband
->n_bitrates
; ridx
++) {
1230 struct ieee80211_rate
*srate
= &sband
->bitrates
[ridx
];
1231 if (fixed
== srate
->bitrate
) {
1232 mask
.control
[band
].legacy
= 1 << ridx
;
1236 if (srate
->bitrate
<= maxrate
) {
1237 mask
.control
[band
].legacy
|= 1 << ridx
;
1246 return rdev_set_bitrate_mask(rdev
, dev
, NULL
, &mask
);
1249 static int cfg80211_wext_giwrate(struct net_device
*dev
,
1250 struct iw_request_info
*info
,
1251 struct iw_param
*rate
, char *extra
)
1253 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1254 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
1255 struct station_info sinfo
= {};
1259 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1262 if (!rdev
->ops
->get_station
)
1267 if (wdev
->current_bss
)
1268 memcpy(addr
, wdev
->current_bss
->pub
.bssid
, ETH_ALEN
);
1275 err
= rdev_get_station(rdev
, dev
, addr
, &sinfo
);
1279 if (!(sinfo
.filled
& BIT_ULL(NL80211_STA_INFO_TX_BITRATE
))) {
1284 rate
->value
= 100000 * cfg80211_calculate_bitrate(&sinfo
.txrate
);
1287 cfg80211_sinfo_release_content(&sinfo
);
1291 /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
1292 static struct iw_statistics
*cfg80211_wireless_stats(struct net_device
*dev
)
1294 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1295 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
1296 /* we are under RTNL - globally locked - so can use static structs */
1297 static struct iw_statistics wstats
;
1298 static struct station_info sinfo
= {};
1301 if (dev
->ieee80211_ptr
->iftype
!= NL80211_IFTYPE_STATION
)
1304 if (!rdev
->ops
->get_station
)
1307 /* Grab BSSID of current BSS, if any */
1309 if (!wdev
->current_bss
) {
1313 memcpy(bssid
, wdev
->current_bss
->pub
.bssid
, ETH_ALEN
);
1316 memset(&sinfo
, 0, sizeof(sinfo
));
1318 if (rdev_get_station(rdev
, dev
, bssid
, &sinfo
))
1321 memset(&wstats
, 0, sizeof(wstats
));
1323 switch (rdev
->wiphy
.signal_type
) {
1324 case CFG80211_SIGNAL_TYPE_MBM
:
1325 if (sinfo
.filled
& BIT_ULL(NL80211_STA_INFO_SIGNAL
)) {
1326 int sig
= sinfo
.signal
;
1327 wstats
.qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
1328 wstats
.qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
1329 wstats
.qual
.updated
|= IW_QUAL_DBM
;
1330 wstats
.qual
.level
= sig
;
1335 wstats
.qual
.qual
= sig
+ 110;
1339 case CFG80211_SIGNAL_TYPE_UNSPEC
:
1340 if (sinfo
.filled
& BIT_ULL(NL80211_STA_INFO_SIGNAL
)) {
1341 wstats
.qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
1342 wstats
.qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
1343 wstats
.qual
.level
= sinfo
.signal
;
1344 wstats
.qual
.qual
= sinfo
.signal
;
1349 wstats
.qual
.updated
|= IW_QUAL_LEVEL_INVALID
;
1350 wstats
.qual
.updated
|= IW_QUAL_QUAL_INVALID
;
1353 wstats
.qual
.updated
|= IW_QUAL_NOISE_INVALID
;
1354 if (sinfo
.filled
& BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC
))
1355 wstats
.discard
.misc
= sinfo
.rx_dropped_misc
;
1356 if (sinfo
.filled
& BIT_ULL(NL80211_STA_INFO_TX_FAILED
))
1357 wstats
.discard
.retries
= sinfo
.tx_failed
;
1359 cfg80211_sinfo_release_content(&sinfo
);
1364 static int cfg80211_wext_siwap(struct net_device
*dev
,
1365 struct iw_request_info
*info
,
1366 struct sockaddr
*ap_addr
, char *extra
)
1368 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1370 switch (wdev
->iftype
) {
1371 case NL80211_IFTYPE_ADHOC
:
1372 return cfg80211_ibss_wext_siwap(dev
, info
, ap_addr
, extra
);
1373 case NL80211_IFTYPE_STATION
:
1374 return cfg80211_mgd_wext_siwap(dev
, info
, ap_addr
, extra
);
1375 case NL80211_IFTYPE_WDS
:
1376 return cfg80211_wds_wext_siwap(dev
, info
, ap_addr
, extra
);
1382 static int cfg80211_wext_giwap(struct net_device
*dev
,
1383 struct iw_request_info
*info
,
1384 struct sockaddr
*ap_addr
, char *extra
)
1386 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1388 switch (wdev
->iftype
) {
1389 case NL80211_IFTYPE_ADHOC
:
1390 return cfg80211_ibss_wext_giwap(dev
, info
, ap_addr
, extra
);
1391 case NL80211_IFTYPE_STATION
:
1392 return cfg80211_mgd_wext_giwap(dev
, info
, ap_addr
, extra
);
1393 case NL80211_IFTYPE_WDS
:
1394 return cfg80211_wds_wext_giwap(dev
, info
, ap_addr
, extra
);
1400 static int cfg80211_wext_siwessid(struct net_device
*dev
,
1401 struct iw_request_info
*info
,
1402 struct iw_point
*data
, char *ssid
)
1404 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1406 switch (wdev
->iftype
) {
1407 case NL80211_IFTYPE_ADHOC
:
1408 return cfg80211_ibss_wext_siwessid(dev
, info
, data
, ssid
);
1409 case NL80211_IFTYPE_STATION
:
1410 return cfg80211_mgd_wext_siwessid(dev
, info
, data
, ssid
);
1416 static int cfg80211_wext_giwessid(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
;
1425 switch (wdev
->iftype
) {
1426 case NL80211_IFTYPE_ADHOC
:
1427 return cfg80211_ibss_wext_giwessid(dev
, info
, data
, ssid
);
1428 case NL80211_IFTYPE_STATION
:
1429 return cfg80211_mgd_wext_giwessid(dev
, info
, data
, ssid
);
1435 static int cfg80211_wext_siwpmksa(struct net_device
*dev
,
1436 struct iw_request_info
*info
,
1437 struct iw_point
*data
, char *extra
)
1439 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1440 struct cfg80211_registered_device
*rdev
= wiphy_to_rdev(wdev
->wiphy
);
1441 struct cfg80211_pmksa cfg_pmksa
;
1442 struct iw_pmksa
*pmksa
= (struct iw_pmksa
*)extra
;
1444 memset(&cfg_pmksa
, 0, sizeof(struct cfg80211_pmksa
));
1446 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1449 cfg_pmksa
.bssid
= pmksa
->bssid
.sa_data
;
1450 cfg_pmksa
.pmkid
= pmksa
->pmkid
;
1452 switch (pmksa
->cmd
) {
1454 if (!rdev
->ops
->set_pmksa
)
1457 return rdev_set_pmksa(rdev
, dev
, &cfg_pmksa
);
1459 case IW_PMKSA_REMOVE
:
1460 if (!rdev
->ops
->del_pmksa
)
1463 return rdev_del_pmksa(rdev
, dev
, &cfg_pmksa
);
1465 case IW_PMKSA_FLUSH
:
1466 if (!rdev
->ops
->flush_pmksa
)
1469 return rdev_flush_pmksa(rdev
, dev
);
1476 static const iw_handler cfg80211_handlers
[] = {
1477 [IW_IOCTL_IDX(SIOCGIWNAME
)] = (iw_handler
) cfg80211_wext_giwname
,
1478 [IW_IOCTL_IDX(SIOCSIWFREQ
)] = (iw_handler
) cfg80211_wext_siwfreq
,
1479 [IW_IOCTL_IDX(SIOCGIWFREQ
)] = (iw_handler
) cfg80211_wext_giwfreq
,
1480 [IW_IOCTL_IDX(SIOCSIWMODE
)] = (iw_handler
) cfg80211_wext_siwmode
,
1481 [IW_IOCTL_IDX(SIOCGIWMODE
)] = (iw_handler
) cfg80211_wext_giwmode
,
1482 [IW_IOCTL_IDX(SIOCGIWRANGE
)] = (iw_handler
) cfg80211_wext_giwrange
,
1483 [IW_IOCTL_IDX(SIOCSIWAP
)] = (iw_handler
) cfg80211_wext_siwap
,
1484 [IW_IOCTL_IDX(SIOCGIWAP
)] = (iw_handler
) cfg80211_wext_giwap
,
1485 [IW_IOCTL_IDX(SIOCSIWMLME
)] = (iw_handler
) cfg80211_wext_siwmlme
,
1486 [IW_IOCTL_IDX(SIOCSIWSCAN
)] = (iw_handler
) cfg80211_wext_siwscan
,
1487 [IW_IOCTL_IDX(SIOCGIWSCAN
)] = (iw_handler
) cfg80211_wext_giwscan
,
1488 [IW_IOCTL_IDX(SIOCSIWESSID
)] = (iw_handler
) cfg80211_wext_siwessid
,
1489 [IW_IOCTL_IDX(SIOCGIWESSID
)] = (iw_handler
) cfg80211_wext_giwessid
,
1490 [IW_IOCTL_IDX(SIOCSIWRATE
)] = (iw_handler
) cfg80211_wext_siwrate
,
1491 [IW_IOCTL_IDX(SIOCGIWRATE
)] = (iw_handler
) cfg80211_wext_giwrate
,
1492 [IW_IOCTL_IDX(SIOCSIWRTS
)] = (iw_handler
) cfg80211_wext_siwrts
,
1493 [IW_IOCTL_IDX(SIOCGIWRTS
)] = (iw_handler
) cfg80211_wext_giwrts
,
1494 [IW_IOCTL_IDX(SIOCSIWFRAG
)] = (iw_handler
) cfg80211_wext_siwfrag
,
1495 [IW_IOCTL_IDX(SIOCGIWFRAG
)] = (iw_handler
) cfg80211_wext_giwfrag
,
1496 [IW_IOCTL_IDX(SIOCSIWTXPOW
)] = (iw_handler
) cfg80211_wext_siwtxpower
,
1497 [IW_IOCTL_IDX(SIOCGIWTXPOW
)] = (iw_handler
) cfg80211_wext_giwtxpower
,
1498 [IW_IOCTL_IDX(SIOCSIWRETRY
)] = (iw_handler
) cfg80211_wext_siwretry
,
1499 [IW_IOCTL_IDX(SIOCGIWRETRY
)] = (iw_handler
) cfg80211_wext_giwretry
,
1500 [IW_IOCTL_IDX(SIOCSIWENCODE
)] = (iw_handler
) cfg80211_wext_siwencode
,
1501 [IW_IOCTL_IDX(SIOCGIWENCODE
)] = (iw_handler
) cfg80211_wext_giwencode
,
1502 [IW_IOCTL_IDX(SIOCSIWPOWER
)] = (iw_handler
) cfg80211_wext_siwpower
,
1503 [IW_IOCTL_IDX(SIOCGIWPOWER
)] = (iw_handler
) cfg80211_wext_giwpower
,
1504 [IW_IOCTL_IDX(SIOCSIWGENIE
)] = (iw_handler
) cfg80211_wext_siwgenie
,
1505 [IW_IOCTL_IDX(SIOCSIWAUTH
)] = (iw_handler
) cfg80211_wext_siwauth
,
1506 [IW_IOCTL_IDX(SIOCGIWAUTH
)] = (iw_handler
) cfg80211_wext_giwauth
,
1507 [IW_IOCTL_IDX(SIOCSIWENCODEEXT
)]= (iw_handler
) cfg80211_wext_siwencodeext
,
1508 [IW_IOCTL_IDX(SIOCSIWPMKSA
)] = (iw_handler
) cfg80211_wext_siwpmksa
,
1511 const struct iw_handler_def cfg80211_wext_handler
= {
1512 .num_standard
= ARRAY_SIZE(cfg80211_handlers
),
1513 .standard
= cfg80211_handlers
,
1514 .get_wireless_stats
= cfg80211_wireless_stats
,