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-2022 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;
44 rdev = wiphy_to_rdev(wdev->wiphy);
48 type = NL80211_IFTYPE_STATION;
51 type = NL80211_IFTYPE_ADHOC;
54 type = NL80211_IFTYPE_MONITOR;
60 if (type == wdev->iftype)
63 memset(&vifparams, 0, sizeof(vifparams));
65 wiphy_lock(wdev->wiphy);
66 ret = cfg80211_change_iface(rdev, dev, type, &vifparams);
67 wiphy_unlock(wdev->wiphy);
71 EXPORT_WEXT_HANDLER(cfg80211_wext_siwmode);
73 int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
74 u32 *mode, char *extra)
76 struct wireless_dev *wdev = dev->ieee80211_ptr;
81 switch (wdev->iftype) {
82 case NL80211_IFTYPE_AP:
83 *mode = IW_MODE_MASTER;
85 case NL80211_IFTYPE_STATION:
86 *mode = IW_MODE_INFRA;
88 case NL80211_IFTYPE_ADHOC:
89 *mode = IW_MODE_ADHOC;
91 case NL80211_IFTYPE_MONITOR:
92 *mode = IW_MODE_MONITOR;
94 case NL80211_IFTYPE_WDS:
95 *mode = IW_MODE_REPEAT;
97 case NL80211_IFTYPE_AP_VLAN:
98 *mode = IW_MODE_SECOND; /* FIXME */
101 *mode = IW_MODE_AUTO;
106 EXPORT_WEXT_HANDLER(cfg80211_wext_giwmode);
109 int cfg80211_wext_giwrange(struct net_device *dev,
110 struct iw_request_info *info,
111 struct iw_point *data, char *extra)
113 struct wireless_dev *wdev = dev->ieee80211_ptr;
114 struct iw_range *range = (struct iw_range *) extra;
115 enum nl80211_band band;
121 data->length = sizeof(struct iw_range);
122 memset(range, 0, sizeof(struct iw_range));
124 range->we_version_compiled = WIRELESS_EXT;
125 range->we_version_source = 21;
126 range->retry_capa = IW_RETRY_LIMIT;
127 range->retry_flags = IW_RETRY_LIMIT;
128 range->min_retry = 0;
129 range->max_retry = 255;
131 range->max_rts = 2347;
132 range->min_frag = 256;
133 range->max_frag = 2346;
135 range->max_encoding_tokens = 4;
137 range->max_qual.updated = IW_QUAL_NOISE_INVALID;
139 switch (wdev->wiphy->signal_type) {
140 case CFG80211_SIGNAL_TYPE_NONE:
142 case CFG80211_SIGNAL_TYPE_MBM:
143 range->max_qual.level = (u8)-110;
144 range->max_qual.qual = 70;
145 range->avg_qual.qual = 35;
146 range->max_qual.updated |= IW_QUAL_DBM;
147 range->max_qual.updated |= IW_QUAL_QUAL_UPDATED;
148 range->max_qual.updated |= IW_QUAL_LEVEL_UPDATED;
150 case CFG80211_SIGNAL_TYPE_UNSPEC:
151 range->max_qual.level = 100;
152 range->max_qual.qual = 100;
153 range->avg_qual.qual = 50;
154 range->max_qual.updated |= IW_QUAL_QUAL_UPDATED;
155 range->max_qual.updated |= IW_QUAL_LEVEL_UPDATED;
159 range->avg_qual.level = range->max_qual.level / 2;
160 range->avg_qual.noise = range->max_qual.noise / 2;
161 range->avg_qual.updated = range->max_qual.updated;
163 for (i = 0; i < wdev->wiphy->n_cipher_suites; i++) {
164 switch (wdev->wiphy->cipher_suites[i]) {
165 case WLAN_CIPHER_SUITE_TKIP:
166 range->enc_capa |= (IW_ENC_CAPA_CIPHER_TKIP |
170 case WLAN_CIPHER_SUITE_CCMP:
171 range->enc_capa |= (IW_ENC_CAPA_CIPHER_CCMP |
175 case WLAN_CIPHER_SUITE_WEP40:
176 range->encoding_size[range->num_encoding_sizes++] =
180 case WLAN_CIPHER_SUITE_WEP104:
181 range->encoding_size[range->num_encoding_sizes++] =
187 for (band = 0; band < NUM_NL80211_BANDS; band ++) {
188 struct ieee80211_supported_band *sband;
190 sband = wdev->wiphy->bands[band];
195 for (i = 0; i < sband->n_channels && c < IW_MAX_FREQUENCIES; i++) {
196 struct ieee80211_channel *chan = &sband->channels[i];
198 if (!(chan->flags & IEEE80211_CHAN_DISABLED)) {
200 ieee80211_frequency_to_channel(
202 range->freq[c].m = chan->center_freq;
203 range->freq[c].e = 6;
208 range->num_channels = c;
209 range->num_frequency = c;
211 IW_EVENT_CAPA_SET_KERNEL(range->event_capa);
212 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP);
213 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN);
215 if (wdev->wiphy->max_scan_ssids > 0)
216 range->scan_capa |= IW_SCAN_CAPA_ESSID;
220 EXPORT_WEXT_HANDLER(cfg80211_wext_giwrange);
224 * cfg80211_wext_freq - get wext frequency for non-"auto"
225 * @freq: the wext freq encoding
227 * Returns a frequency, or a negative error code, or 0 for auto.
229 int cfg80211_wext_freq(struct iw_freq *freq)
232 * Parse frequency - return 0 for auto and
233 * -EINVAL for impossible things.
236 enum nl80211_band band = NL80211_BAND_2GHZ;
240 band = NL80211_BAND_5GHZ;
241 return ieee80211_channel_to_frequency(freq->m, band);
243 int i, div = 1000000;
244 for (i = 0; i < freq->e; i++)
248 return freq->m / div;
252 int cfg80211_wext_siwrts(struct net_device *dev,
253 struct iw_request_info *info,
254 struct iw_param *rts, char *extra)
256 struct wireless_dev *wdev = dev->ieee80211_ptr;
257 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
258 u32 orts = wdev->wiphy->rts_threshold;
261 wiphy_lock(&rdev->wiphy);
262 if (rts->disabled || !rts->fixed) {
263 wdev->wiphy->rts_threshold = (u32) -1;
264 } else if (rts->value < 0) {
268 wdev->wiphy->rts_threshold = rts->value;
271 err = rdev_set_wiphy_params(rdev, WIPHY_PARAM_RTS_THRESHOLD);
274 wdev->wiphy->rts_threshold = orts;
277 wiphy_unlock(&rdev->wiphy);
280 EXPORT_WEXT_HANDLER(cfg80211_wext_siwrts);
282 int cfg80211_wext_giwrts(struct net_device *dev,
283 struct iw_request_info *info,
284 struct iw_param *rts, char *extra)
286 struct wireless_dev *wdev = dev->ieee80211_ptr;
288 rts->value = wdev->wiphy->rts_threshold;
289 rts->disabled = rts->value == (u32) -1;
294 EXPORT_WEXT_HANDLER(cfg80211_wext_giwrts);
296 int cfg80211_wext_siwfrag(struct net_device *dev,
297 struct iw_request_info *info,
298 struct iw_param *frag, char *extra)
300 struct wireless_dev *wdev = dev->ieee80211_ptr;
301 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
302 u32 ofrag = wdev->wiphy->frag_threshold;
305 wiphy_lock(&rdev->wiphy);
306 if (frag->disabled || !frag->fixed) {
307 wdev->wiphy->frag_threshold = (u32) -1;
308 } else if (frag->value < 256) {
312 /* Fragment length must be even, so strip LSB. */
313 wdev->wiphy->frag_threshold = frag->value & ~0x1;
316 err = rdev_set_wiphy_params(rdev, WIPHY_PARAM_FRAG_THRESHOLD);
318 wdev->wiphy->frag_threshold = ofrag;
320 wiphy_unlock(&rdev->wiphy);
324 EXPORT_WEXT_HANDLER(cfg80211_wext_siwfrag);
326 int cfg80211_wext_giwfrag(struct net_device *dev,
327 struct iw_request_info *info,
328 struct iw_param *frag, char *extra)
330 struct wireless_dev *wdev = dev->ieee80211_ptr;
332 frag->value = wdev->wiphy->frag_threshold;
333 frag->disabled = frag->value == (u32) -1;
338 EXPORT_WEXT_HANDLER(cfg80211_wext_giwfrag);
340 static int cfg80211_wext_siwretry(struct net_device *dev,
341 struct iw_request_info *info,
342 struct iw_param *retry, char *extra)
344 struct wireless_dev *wdev = dev->ieee80211_ptr;
345 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
347 u8 olong = wdev->wiphy->retry_long;
348 u8 oshort = wdev->wiphy->retry_short;
351 if (retry->disabled || retry->value < 1 || retry->value > 255 ||
352 (retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT)
355 wiphy_lock(&rdev->wiphy);
356 if (retry->flags & IW_RETRY_LONG) {
357 wdev->wiphy->retry_long = retry->value;
358 changed |= WIPHY_PARAM_RETRY_LONG;
359 } else if (retry->flags & IW_RETRY_SHORT) {
360 wdev->wiphy->retry_short = retry->value;
361 changed |= WIPHY_PARAM_RETRY_SHORT;
363 wdev->wiphy->retry_short = retry->value;
364 wdev->wiphy->retry_long = retry->value;
365 changed |= WIPHY_PARAM_RETRY_LONG;
366 changed |= WIPHY_PARAM_RETRY_SHORT;
369 err = rdev_set_wiphy_params(rdev, changed);
371 wdev->wiphy->retry_short = oshort;
372 wdev->wiphy->retry_long = olong;
374 wiphy_unlock(&rdev->wiphy);
379 int cfg80211_wext_giwretry(struct net_device *dev,
380 struct iw_request_info *info,
381 struct iw_param *retry, char *extra)
383 struct wireless_dev *wdev = dev->ieee80211_ptr;
387 if (retry->flags == 0 || (retry->flags & IW_RETRY_SHORT)) {
389 * First return short value, iwconfig will ask long value
392 retry->flags |= IW_RETRY_LIMIT | IW_RETRY_SHORT;
393 retry->value = wdev->wiphy->retry_short;
394 if (wdev->wiphy->retry_long == wdev->wiphy->retry_short)
395 retry->flags |= IW_RETRY_LONG;
400 if (retry->flags & IW_RETRY_LONG) {
401 retry->flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
402 retry->value = wdev->wiphy->retry_long;
407 EXPORT_WEXT_HANDLER(cfg80211_wext_giwretry);
409 static int __cfg80211_set_encryption(struct cfg80211_registered_device *rdev,
410 struct net_device *dev, bool pairwise,
411 const u8 *addr, bool remove, bool tx_key,
412 int idx, struct key_params *params)
414 struct wireless_dev *wdev = dev->ieee80211_ptr;
418 if (wdev->valid_links)
421 if (pairwise && !addr)
425 * In many cases we won't actually need this, but it's better
426 * to do it first in case the allocation fails. Don't use wext.
428 if (!wdev->wext.keys) {
429 wdev->wext.keys = kzalloc(sizeof(*wdev->wext.keys),
431 if (!wdev->wext.keys)
433 for (i = 0; i < CFG80211_MAX_WEP_KEYS; i++)
434 wdev->wext.keys->params[i].key =
435 wdev->wext.keys->data[i];
438 if (wdev->iftype != NL80211_IFTYPE_ADHOC &&
439 wdev->iftype != NL80211_IFTYPE_STATION)
442 if (params->cipher == WLAN_CIPHER_SUITE_AES_CMAC) {
443 if (!wdev->connected)
446 if (!rdev->ops->set_default_mgmt_key)
449 if (idx < 4 || idx > 5)
451 } else if (idx < 0 || idx > 3)
456 if (wdev->connected ||
457 (wdev->iftype == NL80211_IFTYPE_ADHOC &&
458 wdev->u.ibss.current_bss)) {
460 * If removing the current TX key, we will need to
461 * join a new IBSS without the privacy bit clear.
463 if (idx == wdev->wext.default_key &&
464 wdev->iftype == NL80211_IFTYPE_ADHOC) {
465 __cfg80211_leave_ibss(rdev, wdev->netdev, true);
469 if (!pairwise && addr &&
470 !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN))
473 err = rdev_del_key(rdev, dev, -1, idx, pairwise,
476 wdev->wext.connect.privacy = false;
478 * Applications using wireless extensions expect to be
479 * able to delete keys that don't exist, so allow that.
484 if (!addr && idx < 4) {
485 memset(wdev->wext.keys->data[idx], 0,
486 sizeof(wdev->wext.keys->data[idx]));
487 wdev->wext.keys->params[idx].key_len = 0;
488 wdev->wext.keys->params[idx].cipher = 0;
490 if (idx == wdev->wext.default_key)
491 wdev->wext.default_key = -1;
492 else if (idx == wdev->wext.default_mgmt_key)
493 wdev->wext.default_mgmt_key = -1;
497 err = cfg80211_ibss_wext_join(rdev, wdev);
505 if (cfg80211_validate_key_settings(rdev, params, idx, pairwise, addr))
509 if (wdev->connected ||
510 (wdev->iftype == NL80211_IFTYPE_ADHOC &&
511 wdev->u.ibss.current_bss))
512 err = rdev_add_key(rdev, dev, -1, idx, pairwise, addr, params);
513 else if (params->cipher != WLAN_CIPHER_SUITE_WEP40 &&
514 params->cipher != WLAN_CIPHER_SUITE_WEP104)
520 * We only need to store WEP keys, since they're the only keys that
521 * can be set before a connection is established and persist after
524 if (!addr && (params->cipher == WLAN_CIPHER_SUITE_WEP40 ||
525 params->cipher == WLAN_CIPHER_SUITE_WEP104)) {
526 wdev->wext.keys->params[idx] = *params;
527 memcpy(wdev->wext.keys->data[idx],
528 params->key, params->key_len);
529 wdev->wext.keys->params[idx].key =
530 wdev->wext.keys->data[idx];
533 if ((params->cipher == WLAN_CIPHER_SUITE_WEP40 ||
534 params->cipher == WLAN_CIPHER_SUITE_WEP104) &&
535 (tx_key || (!addr && wdev->wext.default_key == -1))) {
536 if (wdev->connected ||
537 (wdev->iftype == NL80211_IFTYPE_ADHOC &&
538 wdev->u.ibss.current_bss)) {
540 * If we are getting a new TX key from not having
541 * had one before we need to join a new IBSS with
542 * the privacy bit set.
544 if (wdev->iftype == NL80211_IFTYPE_ADHOC &&
545 wdev->wext.default_key == -1) {
546 __cfg80211_leave_ibss(rdev, wdev->netdev, true);
549 err = rdev_set_default_key(rdev, dev, -1, idx, 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->connected ||
563 (wdev->iftype == NL80211_IFTYPE_ADHOC &&
564 wdev->u.ibss.current_bss))
565 err = rdev_set_default_mgmt_key(rdev, dev, -1, idx);
567 wdev->wext.default_mgmt_key = idx;
574 static int cfg80211_set_encryption(struct cfg80211_registered_device *rdev,
575 struct net_device *dev, bool pairwise,
576 const u8 *addr, bool remove, bool tx_key,
577 int idx, struct key_params *params)
581 wdev_lock(dev->ieee80211_ptr);
582 err = __cfg80211_set_encryption(rdev, dev, pairwise, addr,
583 remove, tx_key, idx, params);
584 wdev_unlock(dev->ieee80211_ptr);
589 static int cfg80211_wext_siwencode(struct net_device *dev,
590 struct iw_request_info *info,
591 struct iw_point *erq, char *keybuf)
593 struct wireless_dev *wdev = dev->ieee80211_ptr;
594 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
597 struct key_params params;
599 if (wdev->iftype != NL80211_IFTYPE_STATION &&
600 wdev->iftype != NL80211_IFTYPE_ADHOC)
603 /* no use -- only MFP (set_default_mgmt_key) is optional */
604 if (!rdev->ops->del_key ||
605 !rdev->ops->add_key ||
606 !rdev->ops->set_default_key)
609 wiphy_lock(&rdev->wiphy);
610 if (wdev->valid_links) {
615 idx = erq->flags & IW_ENCODE_INDEX;
617 idx = wdev->wext.default_key;
620 } else if (idx < 1 || idx > 4) {
627 if (erq->flags & IW_ENCODE_DISABLED)
629 else if (erq->length == 0) {
630 /* No key data - just set the default TX key index */
633 if (wdev->connected ||
634 (wdev->iftype == NL80211_IFTYPE_ADHOC &&
635 wdev->u.ibss.current_bss))
636 err = rdev_set_default_key(rdev, dev, -1, idx, true,
639 wdev->wext.default_key = idx;
644 memset(¶ms, 0, sizeof(params));
646 params.key_len = erq->length;
647 if (erq->length == 5) {
648 params.cipher = WLAN_CIPHER_SUITE_WEP40;
649 } else if (erq->length == 13) {
650 params.cipher = WLAN_CIPHER_SUITE_WEP104;
651 } else if (!remove) {
656 err = cfg80211_set_encryption(rdev, dev, false, NULL, remove,
657 wdev->wext.default_key == -1,
660 wiphy_unlock(&rdev->wiphy);
665 static int cfg80211_wext_siwencodeext(struct net_device *dev,
666 struct iw_request_info *info,
667 struct iw_point *erq, char *extra)
669 struct wireless_dev *wdev = dev->ieee80211_ptr;
670 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
671 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
675 struct key_params params;
679 if (wdev->iftype != NL80211_IFTYPE_STATION &&
680 wdev->iftype != NL80211_IFTYPE_ADHOC)
683 /* no use -- only MFP (set_default_mgmt_key) is optional */
684 if (!rdev->ops->del_key ||
685 !rdev->ops->add_key ||
686 !rdev->ops->set_default_key)
690 if (wdev->valid_links) {
697 case IW_ENCODE_ALG_NONE:
701 case IW_ENCODE_ALG_WEP:
702 if (ext->key_len == 5)
703 cipher = WLAN_CIPHER_SUITE_WEP40;
704 else if (ext->key_len == 13)
705 cipher = WLAN_CIPHER_SUITE_WEP104;
709 case IW_ENCODE_ALG_TKIP:
710 cipher = WLAN_CIPHER_SUITE_TKIP;
712 case IW_ENCODE_ALG_CCMP:
713 cipher = WLAN_CIPHER_SUITE_CCMP;
715 case IW_ENCODE_ALG_AES_CMAC:
716 cipher = WLAN_CIPHER_SUITE_AES_CMAC;
722 if (erq->flags & IW_ENCODE_DISABLED)
725 idx = erq->flags & IW_ENCODE_INDEX;
726 if (cipher == WLAN_CIPHER_SUITE_AES_CMAC) {
727 if (idx < 4 || idx > 5) {
728 idx = wdev->wext.default_mgmt_key;
734 if (idx < 1 || idx > 4) {
735 idx = wdev->wext.default_key;
742 addr = ext->addr.sa_data;
743 if (is_broadcast_ether_addr(addr))
746 memset(¶ms, 0, sizeof(params));
747 params.key = ext->key;
748 params.key_len = ext->key_len;
749 params.cipher = cipher;
751 if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
752 params.seq = ext->rx_seq;
756 wiphy_lock(wdev->wiphy);
757 ret = cfg80211_set_encryption(
759 !(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY),
761 ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY,
763 wiphy_unlock(wdev->wiphy);
768 static int cfg80211_wext_giwencode(struct net_device *dev,
769 struct iw_request_info *info,
770 struct iw_point *erq, char *keybuf)
772 struct wireless_dev *wdev = dev->ieee80211_ptr;
775 if (wdev->iftype != NL80211_IFTYPE_STATION &&
776 wdev->iftype != NL80211_IFTYPE_ADHOC)
779 idx = erq->flags & IW_ENCODE_INDEX;
781 idx = wdev->wext.default_key;
784 } else if (idx < 1 || idx > 4)
789 erq->flags = idx + 1;
791 if (!wdev->wext.keys || !wdev->wext.keys->params[idx].cipher) {
792 erq->flags |= IW_ENCODE_DISABLED;
797 erq->length = min_t(size_t, erq->length,
798 wdev->wext.keys->params[idx].key_len);
799 memcpy(keybuf, wdev->wext.keys->params[idx].key, erq->length);
800 erq->flags |= IW_ENCODE_ENABLED;
805 static int cfg80211_wext_siwfreq(struct net_device *dev,
806 struct iw_request_info *info,
807 struct iw_freq *wextfreq, char *extra)
809 struct wireless_dev *wdev = dev->ieee80211_ptr;
810 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
811 struct cfg80211_chan_def chandef = {
812 .width = NL80211_CHAN_WIDTH_20_NOHT,
816 wiphy_lock(&rdev->wiphy);
818 switch (wdev->iftype) {
819 case NL80211_IFTYPE_STATION:
820 ret = cfg80211_mgd_wext_siwfreq(dev, info, wextfreq, extra);
822 case NL80211_IFTYPE_ADHOC:
823 ret = cfg80211_ibss_wext_siwfreq(dev, info, wextfreq, extra);
825 case NL80211_IFTYPE_MONITOR:
826 freq = cfg80211_wext_freq(wextfreq);
835 chandef.center_freq1 = freq;
836 chandef.chan = ieee80211_get_channel(&rdev->wiphy, freq);
841 ret = cfg80211_set_monitor_channel(rdev, &chandef);
843 case NL80211_IFTYPE_MESH_POINT:
844 freq = cfg80211_wext_freq(wextfreq);
853 chandef.center_freq1 = freq;
854 chandef.chan = ieee80211_get_channel(&rdev->wiphy, freq);
859 ret = cfg80211_set_mesh_channel(rdev, wdev, &chandef);
866 wiphy_unlock(&rdev->wiphy);
871 static int cfg80211_wext_giwfreq(struct net_device *dev,
872 struct iw_request_info *info,
873 struct iw_freq *freq, char *extra)
875 struct wireless_dev *wdev = dev->ieee80211_ptr;
876 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
877 struct cfg80211_chan_def chandef = {};
880 wiphy_lock(&rdev->wiphy);
881 switch (wdev->iftype) {
882 case NL80211_IFTYPE_STATION:
883 ret = cfg80211_mgd_wext_giwfreq(dev, info, freq, extra);
885 case NL80211_IFTYPE_ADHOC:
886 ret = cfg80211_ibss_wext_giwfreq(dev, info, freq, extra);
888 case NL80211_IFTYPE_MONITOR:
889 if (!rdev->ops->get_channel) {
894 ret = rdev_get_channel(rdev, wdev, 0, &chandef);
897 freq->m = chandef.chan->center_freq;
906 wiphy_unlock(&rdev->wiphy);
911 static int cfg80211_wext_siwtxpower(struct net_device *dev,
912 struct iw_request_info *info,
913 union iwreq_data *data, char *extra)
915 struct wireless_dev *wdev = dev->ieee80211_ptr;
916 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
917 enum nl80211_tx_power_setting type;
921 if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM)
923 if (data->txpower.flags & IW_TXPOW_RANGE)
926 if (!rdev->ops->set_tx_power)
929 /* only change when not disabling */
930 if (!data->txpower.disabled) {
931 rfkill_set_sw_state(rdev->wiphy.rfkill, false);
933 if (data->txpower.fixed) {
935 * wext doesn't support negative values, see
936 * below where it's for automatic
938 if (data->txpower.value < 0)
940 dbm = data->txpower.value;
941 type = NL80211_TX_POWER_FIXED;
942 /* TODO: do regulatory check! */
945 * Automatic power level setting, max being the value
946 * passed in from userland.
948 if (data->txpower.value < 0) {
949 type = NL80211_TX_POWER_AUTOMATIC;
951 dbm = data->txpower.value;
952 type = NL80211_TX_POWER_LIMITED;
956 if (rfkill_set_sw_state(rdev->wiphy.rfkill, true))
957 schedule_work(&rdev->rfkill_block);
961 wiphy_lock(&rdev->wiphy);
962 ret = rdev_set_tx_power(rdev, wdev, type, DBM_TO_MBM(dbm));
963 wiphy_unlock(&rdev->wiphy);
968 static int cfg80211_wext_giwtxpower(struct net_device *dev,
969 struct iw_request_info *info,
970 union iwreq_data *data, char *extra)
972 struct wireless_dev *wdev = dev->ieee80211_ptr;
973 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
976 if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM)
978 if (data->txpower.flags & IW_TXPOW_RANGE)
981 if (!rdev->ops->get_tx_power)
984 wiphy_lock(&rdev->wiphy);
985 err = rdev_get_tx_power(rdev, wdev, &val);
986 wiphy_unlock(&rdev->wiphy);
990 /* well... oh well */
991 data->txpower.fixed = 1;
992 data->txpower.disabled = rfkill_blocked(rdev->wiphy.rfkill);
993 data->txpower.value = val;
994 data->txpower.flags = IW_TXPOW_DBM;
999 static int cfg80211_set_auth_alg(struct wireless_dev *wdev,
1007 if (auth_alg & ~(IW_AUTH_ALG_OPEN_SYSTEM |
1008 IW_AUTH_ALG_SHARED_KEY |
1012 if (auth_alg & IW_AUTH_ALG_OPEN_SYSTEM) {
1014 wdev->wext.connect.auth_type = NL80211_AUTHTYPE_OPEN_SYSTEM;
1017 if (auth_alg & IW_AUTH_ALG_SHARED_KEY) {
1019 wdev->wext.connect.auth_type = NL80211_AUTHTYPE_SHARED_KEY;
1022 if (auth_alg & IW_AUTH_ALG_LEAP) {
1024 wdev->wext.connect.auth_type = NL80211_AUTHTYPE_NETWORK_EAP;
1028 wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
1033 static int cfg80211_set_wpa_version(struct wireless_dev *wdev, u32 wpa_versions)
1035 if (wpa_versions & ~(IW_AUTH_WPA_VERSION_WPA |
1036 IW_AUTH_WPA_VERSION_WPA2|
1037 IW_AUTH_WPA_VERSION_DISABLED))
1040 if ((wpa_versions & IW_AUTH_WPA_VERSION_DISABLED) &&
1041 (wpa_versions & (IW_AUTH_WPA_VERSION_WPA|
1042 IW_AUTH_WPA_VERSION_WPA2)))
1045 if (wpa_versions & IW_AUTH_WPA_VERSION_DISABLED)
1046 wdev->wext.connect.crypto.wpa_versions &=
1047 ~(NL80211_WPA_VERSION_1|NL80211_WPA_VERSION_2);
1049 if (wpa_versions & IW_AUTH_WPA_VERSION_WPA)
1050 wdev->wext.connect.crypto.wpa_versions |=
1051 NL80211_WPA_VERSION_1;
1053 if (wpa_versions & IW_AUTH_WPA_VERSION_WPA2)
1054 wdev->wext.connect.crypto.wpa_versions |=
1055 NL80211_WPA_VERSION_2;
1060 static int cfg80211_set_cipher_group(struct wireless_dev *wdev, u32 cipher)
1062 if (cipher & IW_AUTH_CIPHER_WEP40)
1063 wdev->wext.connect.crypto.cipher_group =
1064 WLAN_CIPHER_SUITE_WEP40;
1065 else if (cipher & IW_AUTH_CIPHER_WEP104)
1066 wdev->wext.connect.crypto.cipher_group =
1067 WLAN_CIPHER_SUITE_WEP104;
1068 else if (cipher & IW_AUTH_CIPHER_TKIP)
1069 wdev->wext.connect.crypto.cipher_group =
1070 WLAN_CIPHER_SUITE_TKIP;
1071 else if (cipher & IW_AUTH_CIPHER_CCMP)
1072 wdev->wext.connect.crypto.cipher_group =
1073 WLAN_CIPHER_SUITE_CCMP;
1074 else if (cipher & IW_AUTH_CIPHER_AES_CMAC)
1075 wdev->wext.connect.crypto.cipher_group =
1076 WLAN_CIPHER_SUITE_AES_CMAC;
1077 else if (cipher & IW_AUTH_CIPHER_NONE)
1078 wdev->wext.connect.crypto.cipher_group = 0;
1085 static int cfg80211_set_cipher_pairwise(struct wireless_dev *wdev, u32 cipher)
1088 u32 *ciphers_pairwise = wdev->wext.connect.crypto.ciphers_pairwise;
1090 if (cipher & IW_AUTH_CIPHER_WEP40) {
1091 ciphers_pairwise[nr_ciphers] = WLAN_CIPHER_SUITE_WEP40;
1095 if (cipher & IW_AUTH_CIPHER_WEP104) {
1096 ciphers_pairwise[nr_ciphers] = WLAN_CIPHER_SUITE_WEP104;
1100 if (cipher & IW_AUTH_CIPHER_TKIP) {
1101 ciphers_pairwise[nr_ciphers] = WLAN_CIPHER_SUITE_TKIP;
1105 if (cipher & IW_AUTH_CIPHER_CCMP) {
1106 ciphers_pairwise[nr_ciphers] = WLAN_CIPHER_SUITE_CCMP;
1110 if (cipher & IW_AUTH_CIPHER_AES_CMAC) {
1111 ciphers_pairwise[nr_ciphers] = WLAN_CIPHER_SUITE_AES_CMAC;
1115 BUILD_BUG_ON(NL80211_MAX_NR_CIPHER_SUITES < 5);
1117 wdev->wext.connect.crypto.n_ciphers_pairwise = nr_ciphers;
1123 static int cfg80211_set_key_mgt(struct wireless_dev *wdev, u32 key_mgt)
1125 int nr_akm_suites = 0;
1127 if (key_mgt & ~(IW_AUTH_KEY_MGMT_802_1X |
1128 IW_AUTH_KEY_MGMT_PSK))
1131 if (key_mgt & IW_AUTH_KEY_MGMT_802_1X) {
1132 wdev->wext.connect.crypto.akm_suites[nr_akm_suites] =
1133 WLAN_AKM_SUITE_8021X;
1137 if (key_mgt & IW_AUTH_KEY_MGMT_PSK) {
1138 wdev->wext.connect.crypto.akm_suites[nr_akm_suites] =
1143 wdev->wext.connect.crypto.n_akm_suites = nr_akm_suites;
1148 static int cfg80211_wext_siwauth(struct net_device *dev,
1149 struct iw_request_info *info,
1150 struct iw_param *data, char *extra)
1152 struct wireless_dev *wdev = dev->ieee80211_ptr;
1154 if (wdev->iftype != NL80211_IFTYPE_STATION)
1157 switch (data->flags & IW_AUTH_INDEX) {
1158 case IW_AUTH_PRIVACY_INVOKED:
1159 wdev->wext.connect.privacy = data->value;
1161 case IW_AUTH_WPA_VERSION:
1162 return cfg80211_set_wpa_version(wdev, data->value);
1163 case IW_AUTH_CIPHER_GROUP:
1164 return cfg80211_set_cipher_group(wdev, data->value);
1165 case IW_AUTH_KEY_MGMT:
1166 return cfg80211_set_key_mgt(wdev, data->value);
1167 case IW_AUTH_CIPHER_PAIRWISE:
1168 return cfg80211_set_cipher_pairwise(wdev, data->value);
1169 case IW_AUTH_80211_AUTH_ALG:
1170 return cfg80211_set_auth_alg(wdev, data->value);
1171 case IW_AUTH_WPA_ENABLED:
1172 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
1173 case IW_AUTH_DROP_UNENCRYPTED:
1181 static int cfg80211_wext_giwauth(struct net_device *dev,
1182 struct iw_request_info *info,
1183 struct iw_param *data, char *extra)
1185 /* XXX: what do we need? */
1190 static int cfg80211_wext_siwpower(struct net_device *dev,
1191 struct iw_request_info *info,
1192 struct iw_param *wrq, char *extra)
1194 struct wireless_dev *wdev = dev->ieee80211_ptr;
1195 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1197 int timeout = wdev->ps_timeout;
1200 if (wdev->iftype != NL80211_IFTYPE_STATION)
1203 if (!rdev->ops->set_power_mgmt)
1206 if (wrq->disabled) {
1209 switch (wrq->flags & IW_POWER_MODE) {
1210 case IW_POWER_ON: /* If not specified */
1211 case IW_POWER_MODE: /* If set all mask */
1212 case IW_POWER_ALL_R: /* If explicitely state all */
1215 default: /* Otherwise we ignore */
1219 if (wrq->flags & ~(IW_POWER_MODE | IW_POWER_TIMEOUT))
1222 if (wrq->flags & IW_POWER_TIMEOUT)
1223 timeout = wrq->value / 1000;
1226 wiphy_lock(&rdev->wiphy);
1227 err = rdev_set_power_mgmt(rdev, dev, ps, timeout);
1228 wiphy_unlock(&rdev->wiphy);
1233 wdev->ps_timeout = timeout;
1239 static int cfg80211_wext_giwpower(struct net_device *dev,
1240 struct iw_request_info *info,
1241 struct iw_param *wrq, char *extra)
1243 struct wireless_dev *wdev = dev->ieee80211_ptr;
1245 wrq->disabled = !wdev->ps;
1250 static int cfg80211_wext_siwrate(struct net_device *dev,
1251 struct iw_request_info *info,
1252 struct iw_param *rate, char *extra)
1254 struct wireless_dev *wdev = dev->ieee80211_ptr;
1255 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1256 struct cfg80211_bitrate_mask mask;
1258 struct ieee80211_supported_band *sband;
1259 int band, ridx, ret;
1262 if (!rdev->ops->set_bitrate_mask)
1265 memset(&mask, 0, sizeof(mask));
1269 if (rate->value < 0) {
1271 } else if (rate->fixed) {
1272 fixed = rate->value / 100000;
1274 maxrate = rate->value / 100000;
1277 for (band = 0; band < NUM_NL80211_BANDS; band++) {
1278 sband = wdev->wiphy->bands[band];
1281 for (ridx = 0; ridx < sband->n_bitrates; ridx++) {
1282 struct ieee80211_rate *srate = &sband->bitrates[ridx];
1283 if (fixed == srate->bitrate) {
1284 mask.control[band].legacy = 1 << ridx;
1288 if (srate->bitrate <= maxrate) {
1289 mask.control[band].legacy |= 1 << ridx;
1298 wiphy_lock(&rdev->wiphy);
1299 if (dev->ieee80211_ptr->valid_links)
1302 ret = rdev_set_bitrate_mask(rdev, dev, 0, NULL, &mask);
1303 wiphy_unlock(&rdev->wiphy);
1308 static int cfg80211_wext_giwrate(struct net_device *dev,
1309 struct iw_request_info *info,
1310 struct iw_param *rate, char *extra)
1312 struct wireless_dev *wdev = dev->ieee80211_ptr;
1313 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1314 struct station_info sinfo = {};
1318 if (wdev->iftype != NL80211_IFTYPE_STATION)
1321 if (!rdev->ops->get_station)
1326 if (!wdev->valid_links && wdev->links[0].client.current_bss)
1327 memcpy(addr, wdev->links[0].client.current_bss->pub.bssid,
1335 wiphy_lock(&rdev->wiphy);
1336 err = rdev_get_station(rdev, dev, addr, &sinfo);
1337 wiphy_unlock(&rdev->wiphy);
1341 if (!(sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE))) {
1346 rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.txrate);
1349 cfg80211_sinfo_release_content(&sinfo);
1353 /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
1354 static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
1356 struct wireless_dev *wdev = dev->ieee80211_ptr;
1357 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1358 /* we are under RTNL - globally locked - so can use static structs */
1359 static struct iw_statistics wstats;
1360 static struct station_info sinfo = {};
1364 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION)
1367 if (!rdev->ops->get_station)
1370 /* Grab BSSID of current BSS, if any */
1372 if (wdev->valid_links || !wdev->links[0].client.current_bss) {
1376 memcpy(bssid, wdev->links[0].client.current_bss->pub.bssid, ETH_ALEN);
1379 memset(&sinfo, 0, sizeof(sinfo));
1381 wiphy_lock(&rdev->wiphy);
1382 ret = rdev_get_station(rdev, dev, bssid, &sinfo);
1383 wiphy_unlock(&rdev->wiphy);
1388 memset(&wstats, 0, sizeof(wstats));
1390 switch (rdev->wiphy.signal_type) {
1391 case CFG80211_SIGNAL_TYPE_MBM:
1392 if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_SIGNAL)) {
1393 int sig = sinfo.signal;
1394 wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED;
1395 wstats.qual.updated |= IW_QUAL_QUAL_UPDATED;
1396 wstats.qual.updated |= IW_QUAL_DBM;
1397 wstats.qual.level = sig;
1402 wstats.qual.qual = sig + 110;
1406 case CFG80211_SIGNAL_TYPE_UNSPEC:
1407 if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_SIGNAL)) {
1408 wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED;
1409 wstats.qual.updated |= IW_QUAL_QUAL_UPDATED;
1410 wstats.qual.level = sinfo.signal;
1411 wstats.qual.qual = sinfo.signal;
1416 wstats.qual.updated |= IW_QUAL_LEVEL_INVALID;
1417 wstats.qual.updated |= IW_QUAL_QUAL_INVALID;
1420 wstats.qual.updated |= IW_QUAL_NOISE_INVALID;
1421 if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC))
1422 wstats.discard.misc = sinfo.rx_dropped_misc;
1423 if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_FAILED))
1424 wstats.discard.retries = sinfo.tx_failed;
1426 cfg80211_sinfo_release_content(&sinfo);
1431 static int cfg80211_wext_siwap(struct net_device *dev,
1432 struct iw_request_info *info,
1433 struct sockaddr *ap_addr, char *extra)
1435 struct wireless_dev *wdev = dev->ieee80211_ptr;
1436 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1439 wiphy_lock(&rdev->wiphy);
1440 switch (wdev->iftype) {
1441 case NL80211_IFTYPE_ADHOC:
1442 ret = cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra);
1444 case NL80211_IFTYPE_STATION:
1445 ret = cfg80211_mgd_wext_siwap(dev, info, ap_addr, extra);
1451 wiphy_unlock(&rdev->wiphy);
1456 static int cfg80211_wext_giwap(struct net_device *dev,
1457 struct iw_request_info *info,
1458 struct sockaddr *ap_addr, char *extra)
1460 struct wireless_dev *wdev = dev->ieee80211_ptr;
1461 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1464 wiphy_lock(&rdev->wiphy);
1465 switch (wdev->iftype) {
1466 case NL80211_IFTYPE_ADHOC:
1467 ret = cfg80211_ibss_wext_giwap(dev, info, ap_addr, extra);
1469 case NL80211_IFTYPE_STATION:
1470 ret = cfg80211_mgd_wext_giwap(dev, info, ap_addr, extra);
1476 wiphy_unlock(&rdev->wiphy);
1481 static int cfg80211_wext_siwessid(struct net_device *dev,
1482 struct iw_request_info *info,
1483 struct iw_point *data, char *ssid)
1485 struct wireless_dev *wdev = dev->ieee80211_ptr;
1486 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1489 wiphy_lock(&rdev->wiphy);
1490 switch (wdev->iftype) {
1491 case NL80211_IFTYPE_ADHOC:
1492 ret = cfg80211_ibss_wext_siwessid(dev, info, data, ssid);
1494 case NL80211_IFTYPE_STATION:
1495 ret = cfg80211_mgd_wext_siwessid(dev, info, data, ssid);
1501 wiphy_unlock(&rdev->wiphy);
1506 static int cfg80211_wext_giwessid(struct net_device *dev,
1507 struct iw_request_info *info,
1508 struct iw_point *data, char *ssid)
1510 struct wireless_dev *wdev = dev->ieee80211_ptr;
1511 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1517 wiphy_lock(&rdev->wiphy);
1518 switch (wdev->iftype) {
1519 case NL80211_IFTYPE_ADHOC:
1520 ret = cfg80211_ibss_wext_giwessid(dev, info, data, ssid);
1522 case NL80211_IFTYPE_STATION:
1523 ret = cfg80211_mgd_wext_giwessid(dev, info, data, ssid);
1529 wiphy_unlock(&rdev->wiphy);
1534 static int cfg80211_wext_siwpmksa(struct net_device *dev,
1535 struct iw_request_info *info,
1536 struct iw_point *data, char *extra)
1538 struct wireless_dev *wdev = dev->ieee80211_ptr;
1539 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1540 struct cfg80211_pmksa cfg_pmksa;
1541 struct iw_pmksa *pmksa = (struct iw_pmksa *)extra;
1544 memset(&cfg_pmksa, 0, sizeof(struct cfg80211_pmksa));
1546 if (wdev->iftype != NL80211_IFTYPE_STATION)
1549 cfg_pmksa.bssid = pmksa->bssid.sa_data;
1550 cfg_pmksa.pmkid = pmksa->pmkid;
1552 wiphy_lock(&rdev->wiphy);
1553 switch (pmksa->cmd) {
1555 if (!rdev->ops->set_pmksa) {
1560 ret = rdev_set_pmksa(rdev, dev, &cfg_pmksa);
1562 case IW_PMKSA_REMOVE:
1563 if (!rdev->ops->del_pmksa) {
1568 ret = rdev_del_pmksa(rdev, dev, &cfg_pmksa);
1570 case IW_PMKSA_FLUSH:
1571 if (!rdev->ops->flush_pmksa) {
1576 ret = rdev_flush_pmksa(rdev, dev);
1582 wiphy_unlock(&rdev->wiphy);
1587 #define DEFINE_WEXT_COMPAT_STUB(func, type) \
1588 static int __ ## func(struct net_device *dev, \
1589 struct iw_request_info *info, \
1590 union iwreq_data *wrqu, \
1593 return func(dev, info, (type *)wrqu, extra); \
1596 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwname, char)
1597 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwfreq, struct iw_freq)
1598 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwfreq, struct iw_freq)
1599 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwmode, u32)
1600 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwmode, u32)
1601 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwrange, struct iw_point)
1602 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwap, struct sockaddr)
1603 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwap, struct sockaddr)
1604 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwmlme, struct iw_point)
1605 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwscan, struct iw_point)
1606 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwessid, struct iw_point)
1607 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwessid, struct iw_point)
1608 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwrate, struct iw_param)
1609 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwrate, struct iw_param)
1610 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwrts, struct iw_param)
1611 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwrts, struct iw_param)
1612 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwfrag, struct iw_param)
1613 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwfrag, struct iw_param)
1614 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwretry, struct iw_param)
1615 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwretry, struct iw_param)
1616 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwencode, struct iw_point)
1617 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwencode, struct iw_point)
1618 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwpower, struct iw_param)
1619 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwpower, struct iw_param)
1620 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwgenie, struct iw_point)
1621 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_giwauth, struct iw_param)
1622 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwauth, struct iw_param)
1623 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwencodeext, struct iw_point)
1624 DEFINE_WEXT_COMPAT_STUB(cfg80211_wext_siwpmksa, struct iw_point)
1626 static const iw_handler cfg80211_handlers[] = {
1627 [IW_IOCTL_IDX(SIOCGIWNAME)] = __cfg80211_wext_giwname,
1628 [IW_IOCTL_IDX(SIOCSIWFREQ)] = __cfg80211_wext_siwfreq,
1629 [IW_IOCTL_IDX(SIOCGIWFREQ)] = __cfg80211_wext_giwfreq,
1630 [IW_IOCTL_IDX(SIOCSIWMODE)] = __cfg80211_wext_siwmode,
1631 [IW_IOCTL_IDX(SIOCGIWMODE)] = __cfg80211_wext_giwmode,
1632 [IW_IOCTL_IDX(SIOCGIWRANGE)] = __cfg80211_wext_giwrange,
1633 [IW_IOCTL_IDX(SIOCSIWAP)] = __cfg80211_wext_siwap,
1634 [IW_IOCTL_IDX(SIOCGIWAP)] = __cfg80211_wext_giwap,
1635 [IW_IOCTL_IDX(SIOCSIWMLME)] = __cfg80211_wext_siwmlme,
1636 [IW_IOCTL_IDX(SIOCSIWSCAN)] = cfg80211_wext_siwscan,
1637 [IW_IOCTL_IDX(SIOCGIWSCAN)] = __cfg80211_wext_giwscan,
1638 [IW_IOCTL_IDX(SIOCSIWESSID)] = __cfg80211_wext_siwessid,
1639 [IW_IOCTL_IDX(SIOCGIWESSID)] = __cfg80211_wext_giwessid,
1640 [IW_IOCTL_IDX(SIOCSIWRATE)] = __cfg80211_wext_siwrate,
1641 [IW_IOCTL_IDX(SIOCGIWRATE)] = __cfg80211_wext_giwrate,
1642 [IW_IOCTL_IDX(SIOCSIWRTS)] = __cfg80211_wext_siwrts,
1643 [IW_IOCTL_IDX(SIOCGIWRTS)] = __cfg80211_wext_giwrts,
1644 [IW_IOCTL_IDX(SIOCSIWFRAG)] = __cfg80211_wext_siwfrag,
1645 [IW_IOCTL_IDX(SIOCGIWFRAG)] = __cfg80211_wext_giwfrag,
1646 [IW_IOCTL_IDX(SIOCSIWTXPOW)] = cfg80211_wext_siwtxpower,
1647 [IW_IOCTL_IDX(SIOCGIWTXPOW)] = cfg80211_wext_giwtxpower,
1648 [IW_IOCTL_IDX(SIOCSIWRETRY)] = __cfg80211_wext_siwretry,
1649 [IW_IOCTL_IDX(SIOCGIWRETRY)] = __cfg80211_wext_giwretry,
1650 [IW_IOCTL_IDX(SIOCSIWENCODE)] = __cfg80211_wext_siwencode,
1651 [IW_IOCTL_IDX(SIOCGIWENCODE)] = __cfg80211_wext_giwencode,
1652 [IW_IOCTL_IDX(SIOCSIWPOWER)] = __cfg80211_wext_siwpower,
1653 [IW_IOCTL_IDX(SIOCGIWPOWER)] = __cfg80211_wext_giwpower,
1654 [IW_IOCTL_IDX(SIOCSIWGENIE)] = __cfg80211_wext_siwgenie,
1655 [IW_IOCTL_IDX(SIOCSIWAUTH)] = __cfg80211_wext_siwauth,
1656 [IW_IOCTL_IDX(SIOCGIWAUTH)] = __cfg80211_wext_giwauth,
1657 [IW_IOCTL_IDX(SIOCSIWENCODEEXT)]= __cfg80211_wext_siwencodeext,
1658 [IW_IOCTL_IDX(SIOCSIWPMKSA)] = __cfg80211_wext_siwpmksa,
1661 const struct iw_handler_def cfg80211_wext_handler = {
1662 .num_standard = ARRAY_SIZE(cfg80211_handlers),
1663 .standard = cfg80211_handlers,
1664 .get_wireless_stats = cfg80211_wireless_stats,