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 union iwreq_data *wrqu, char *extra)
30 strcpy(wrqu->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 union iwreq_data *wrqu, char *extra)
38 __u32 *mode = &wrqu->mode;
39 struct wireless_dev *wdev = dev->ieee80211_ptr;
40 struct cfg80211_registered_device *rdev;
41 struct vif_params vifparams;
42 enum nl80211_iftype type;
45 rdev = wiphy_to_rdev(wdev->wiphy);
49 type = NL80211_IFTYPE_STATION;
52 type = NL80211_IFTYPE_ADHOC;
55 type = NL80211_IFTYPE_MONITOR;
61 if (type == wdev->iftype)
64 memset(&vifparams, 0, sizeof(vifparams));
66 wiphy_lock(wdev->wiphy);
67 ret = cfg80211_change_iface(rdev, dev, type, &vifparams);
68 wiphy_unlock(wdev->wiphy);
72 EXPORT_WEXT_HANDLER(cfg80211_wext_siwmode);
74 int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
75 union iwreq_data *wrqu, char *extra)
77 __u32 *mode = &wrqu->mode;
78 struct wireless_dev *wdev = dev->ieee80211_ptr;
83 switch (wdev->iftype) {
84 case NL80211_IFTYPE_AP:
85 *mode = IW_MODE_MASTER;
87 case NL80211_IFTYPE_STATION:
88 *mode = IW_MODE_INFRA;
90 case NL80211_IFTYPE_ADHOC:
91 *mode = IW_MODE_ADHOC;
93 case NL80211_IFTYPE_MONITOR:
94 *mode = IW_MODE_MONITOR;
96 case NL80211_IFTYPE_WDS:
97 *mode = IW_MODE_REPEAT;
99 case NL80211_IFTYPE_AP_VLAN:
100 *mode = IW_MODE_SECOND; /* FIXME */
103 *mode = IW_MODE_AUTO;
108 EXPORT_WEXT_HANDLER(cfg80211_wext_giwmode);
111 int cfg80211_wext_giwrange(struct net_device *dev,
112 struct iw_request_info *info,
113 union iwreq_data *wrqu, char *extra)
115 struct iw_point *data = &wrqu->data;
116 struct wireless_dev *wdev = dev->ieee80211_ptr;
117 struct iw_range *range = (struct iw_range *) extra;
118 enum nl80211_band band;
124 data->length = sizeof(struct iw_range);
125 memset(range, 0, sizeof(struct iw_range));
127 range->we_version_compiled = WIRELESS_EXT;
128 range->we_version_source = 21;
129 range->retry_capa = IW_RETRY_LIMIT;
130 range->retry_flags = IW_RETRY_LIMIT;
131 range->min_retry = 0;
132 range->max_retry = 255;
134 range->max_rts = 2347;
135 range->min_frag = 256;
136 range->max_frag = 2346;
138 range->max_encoding_tokens = 4;
140 range->max_qual.updated = IW_QUAL_NOISE_INVALID;
142 switch (wdev->wiphy->signal_type) {
143 case CFG80211_SIGNAL_TYPE_NONE:
145 case CFG80211_SIGNAL_TYPE_MBM:
146 range->max_qual.level = (u8)-110;
147 range->max_qual.qual = 70;
148 range->avg_qual.qual = 35;
149 range->max_qual.updated |= IW_QUAL_DBM;
150 range->max_qual.updated |= IW_QUAL_QUAL_UPDATED;
151 range->max_qual.updated |= IW_QUAL_LEVEL_UPDATED;
153 case CFG80211_SIGNAL_TYPE_UNSPEC:
154 range->max_qual.level = 100;
155 range->max_qual.qual = 100;
156 range->avg_qual.qual = 50;
157 range->max_qual.updated |= IW_QUAL_QUAL_UPDATED;
158 range->max_qual.updated |= IW_QUAL_LEVEL_UPDATED;
162 range->avg_qual.level = range->max_qual.level / 2;
163 range->avg_qual.noise = range->max_qual.noise / 2;
164 range->avg_qual.updated = range->max_qual.updated;
166 for (i = 0; i < wdev->wiphy->n_cipher_suites; i++) {
167 switch (wdev->wiphy->cipher_suites[i]) {
168 case WLAN_CIPHER_SUITE_TKIP:
169 range->enc_capa |= (IW_ENC_CAPA_CIPHER_TKIP |
173 case WLAN_CIPHER_SUITE_CCMP:
174 range->enc_capa |= (IW_ENC_CAPA_CIPHER_CCMP |
178 case WLAN_CIPHER_SUITE_WEP40:
179 range->encoding_size[range->num_encoding_sizes++] =
183 case WLAN_CIPHER_SUITE_WEP104:
184 range->encoding_size[range->num_encoding_sizes++] =
190 for (band = 0; band < NUM_NL80211_BANDS; band ++) {
191 struct ieee80211_supported_band *sband;
193 sband = wdev->wiphy->bands[band];
198 for (i = 0; i < sband->n_channels && c < IW_MAX_FREQUENCIES; i++) {
199 struct ieee80211_channel *chan = &sband->channels[i];
201 if (!(chan->flags & IEEE80211_CHAN_DISABLED)) {
203 ieee80211_frequency_to_channel(
205 range->freq[c].m = chan->center_freq;
206 range->freq[c].e = 6;
211 range->num_channels = c;
212 range->num_frequency = c;
214 IW_EVENT_CAPA_SET_KERNEL(range->event_capa);
215 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP);
216 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN);
218 if (wdev->wiphy->max_scan_ssids > 0)
219 range->scan_capa |= IW_SCAN_CAPA_ESSID;
223 EXPORT_WEXT_HANDLER(cfg80211_wext_giwrange);
227 * cfg80211_wext_freq - get wext frequency for non-"auto"
228 * @freq: the wext freq encoding
230 * Returns a frequency, or a negative error code, or 0 for auto.
232 int cfg80211_wext_freq(struct iw_freq *freq)
235 * Parse frequency - return 0 for auto and
236 * -EINVAL for impossible things.
239 enum nl80211_band band = NL80211_BAND_2GHZ;
243 band = NL80211_BAND_5GHZ;
244 return ieee80211_channel_to_frequency(freq->m, band);
246 int i, div = 1000000;
247 for (i = 0; i < freq->e; i++)
251 return freq->m / div;
255 int cfg80211_wext_siwrts(struct net_device *dev,
256 struct iw_request_info *info,
257 union iwreq_data *wrqu, char *extra)
259 struct iw_param *rts = &wrqu->rts;
260 struct wireless_dev *wdev = dev->ieee80211_ptr;
261 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
262 u32 orts = wdev->wiphy->rts_threshold;
265 wiphy_lock(&rdev->wiphy);
266 if (rts->disabled || !rts->fixed) {
267 wdev->wiphy->rts_threshold = (u32) -1;
268 } else if (rts->value < 0) {
272 wdev->wiphy->rts_threshold = rts->value;
275 err = rdev_set_wiphy_params(rdev, WIPHY_PARAM_RTS_THRESHOLD);
278 wdev->wiphy->rts_threshold = orts;
281 wiphy_unlock(&rdev->wiphy);
284 EXPORT_WEXT_HANDLER(cfg80211_wext_siwrts);
286 int cfg80211_wext_giwrts(struct net_device *dev,
287 struct iw_request_info *info,
288 union iwreq_data *wrqu, char *extra)
290 struct iw_param *rts = &wrqu->rts;
291 struct wireless_dev *wdev = dev->ieee80211_ptr;
293 rts->value = wdev->wiphy->rts_threshold;
294 rts->disabled = rts->value == (u32) -1;
299 EXPORT_WEXT_HANDLER(cfg80211_wext_giwrts);
301 int cfg80211_wext_siwfrag(struct net_device *dev,
302 struct iw_request_info *info,
303 union iwreq_data *wrqu, char *extra)
305 struct iw_param *frag = &wrqu->frag;
306 struct wireless_dev *wdev = dev->ieee80211_ptr;
307 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
308 u32 ofrag = wdev->wiphy->frag_threshold;
311 wiphy_lock(&rdev->wiphy);
312 if (frag->disabled || !frag->fixed) {
313 wdev->wiphy->frag_threshold = (u32) -1;
314 } else if (frag->value < 256) {
318 /* Fragment length must be even, so strip LSB. */
319 wdev->wiphy->frag_threshold = frag->value & ~0x1;
322 err = rdev_set_wiphy_params(rdev, WIPHY_PARAM_FRAG_THRESHOLD);
324 wdev->wiphy->frag_threshold = ofrag;
326 wiphy_unlock(&rdev->wiphy);
330 EXPORT_WEXT_HANDLER(cfg80211_wext_siwfrag);
332 int cfg80211_wext_giwfrag(struct net_device *dev,
333 struct iw_request_info *info,
334 union iwreq_data *wrqu, char *extra)
336 struct iw_param *frag = &wrqu->frag;
337 struct wireless_dev *wdev = dev->ieee80211_ptr;
339 frag->value = wdev->wiphy->frag_threshold;
340 frag->disabled = frag->value == (u32) -1;
345 EXPORT_WEXT_HANDLER(cfg80211_wext_giwfrag);
347 static int cfg80211_wext_siwretry(struct net_device *dev,
348 struct iw_request_info *info,
349 union iwreq_data *wrqu, char *extra)
351 struct iw_param *retry = &wrqu->retry;
352 struct wireless_dev *wdev = dev->ieee80211_ptr;
353 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
355 u8 olong = wdev->wiphy->retry_long;
356 u8 oshort = wdev->wiphy->retry_short;
359 if (retry->disabled || retry->value < 1 || retry->value > 255 ||
360 (retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT)
363 wiphy_lock(&rdev->wiphy);
364 if (retry->flags & IW_RETRY_LONG) {
365 wdev->wiphy->retry_long = retry->value;
366 changed |= WIPHY_PARAM_RETRY_LONG;
367 } else if (retry->flags & IW_RETRY_SHORT) {
368 wdev->wiphy->retry_short = retry->value;
369 changed |= WIPHY_PARAM_RETRY_SHORT;
371 wdev->wiphy->retry_short = retry->value;
372 wdev->wiphy->retry_long = retry->value;
373 changed |= WIPHY_PARAM_RETRY_LONG;
374 changed |= WIPHY_PARAM_RETRY_SHORT;
377 err = rdev_set_wiphy_params(rdev, changed);
379 wdev->wiphy->retry_short = oshort;
380 wdev->wiphy->retry_long = olong;
382 wiphy_unlock(&rdev->wiphy);
387 int cfg80211_wext_giwretry(struct net_device *dev,
388 struct iw_request_info *info,
389 union iwreq_data *wrqu, char *extra)
391 struct iw_param *retry = &wrqu->retry;
392 struct wireless_dev *wdev = dev->ieee80211_ptr;
396 if (retry->flags == 0 || (retry->flags & IW_RETRY_SHORT)) {
398 * First return short value, iwconfig will ask long value
401 retry->flags |= IW_RETRY_LIMIT | IW_RETRY_SHORT;
402 retry->value = wdev->wiphy->retry_short;
403 if (wdev->wiphy->retry_long == wdev->wiphy->retry_short)
404 retry->flags |= IW_RETRY_LONG;
409 if (retry->flags & IW_RETRY_LONG) {
410 retry->flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
411 retry->value = wdev->wiphy->retry_long;
416 EXPORT_WEXT_HANDLER(cfg80211_wext_giwretry);
418 static int __cfg80211_set_encryption(struct cfg80211_registered_device *rdev,
419 struct net_device *dev, bool pairwise,
420 const u8 *addr, bool remove, bool tx_key,
421 int idx, struct key_params *params)
423 struct wireless_dev *wdev = dev->ieee80211_ptr;
427 if (wdev->valid_links)
430 if (pairwise && !addr)
434 * In many cases we won't actually need this, but it's better
435 * to do it first in case the allocation fails. Don't use wext.
437 if (!wdev->wext.keys) {
438 wdev->wext.keys = kzalloc(sizeof(*wdev->wext.keys),
440 if (!wdev->wext.keys)
442 for (i = 0; i < 4; i++)
443 wdev->wext.keys->params[i].key =
444 wdev->wext.keys->data[i];
447 if (wdev->iftype != NL80211_IFTYPE_ADHOC &&
448 wdev->iftype != NL80211_IFTYPE_STATION)
451 if (params->cipher == WLAN_CIPHER_SUITE_AES_CMAC) {
452 if (!wdev->connected)
455 if (!rdev->ops->set_default_mgmt_key)
458 if (idx < 4 || idx > 5)
460 } else if (idx < 0 || idx > 3)
465 if (wdev->connected ||
466 (wdev->iftype == NL80211_IFTYPE_ADHOC &&
467 wdev->u.ibss.current_bss)) {
469 * If removing the current TX key, we will need to
470 * join a new IBSS without the privacy bit clear.
472 if (idx == wdev->wext.default_key &&
473 wdev->iftype == NL80211_IFTYPE_ADHOC) {
474 __cfg80211_leave_ibss(rdev, wdev->netdev, true);
478 if (!pairwise && addr &&
479 !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN))
482 err = rdev_del_key(rdev, dev, -1, idx, pairwise,
485 wdev->wext.connect.privacy = false;
487 * Applications using wireless extensions expect to be
488 * able to delete keys that don't exist, so allow that.
493 if (!addr && idx < 4) {
494 memset(wdev->wext.keys->data[idx], 0,
495 sizeof(wdev->wext.keys->data[idx]));
496 wdev->wext.keys->params[idx].key_len = 0;
497 wdev->wext.keys->params[idx].cipher = 0;
499 if (idx == wdev->wext.default_key)
500 wdev->wext.default_key = -1;
501 else if (idx == wdev->wext.default_mgmt_key)
502 wdev->wext.default_mgmt_key = -1;
506 err = cfg80211_ibss_wext_join(rdev, wdev);
514 if (cfg80211_validate_key_settings(rdev, params, idx, pairwise, addr))
518 if (wdev->connected ||
519 (wdev->iftype == NL80211_IFTYPE_ADHOC &&
520 wdev->u.ibss.current_bss))
521 err = rdev_add_key(rdev, dev, -1, idx, pairwise, addr, params);
522 else if (params->cipher != WLAN_CIPHER_SUITE_WEP40 &&
523 params->cipher != WLAN_CIPHER_SUITE_WEP104)
529 * We only need to store WEP keys, since they're the only keys that
530 * can be set before a connection is established and persist after
533 if (!addr && (params->cipher == WLAN_CIPHER_SUITE_WEP40 ||
534 params->cipher == WLAN_CIPHER_SUITE_WEP104)) {
535 wdev->wext.keys->params[idx] = *params;
536 memcpy(wdev->wext.keys->data[idx],
537 params->key, params->key_len);
538 wdev->wext.keys->params[idx].key =
539 wdev->wext.keys->data[idx];
542 if ((params->cipher == WLAN_CIPHER_SUITE_WEP40 ||
543 params->cipher == WLAN_CIPHER_SUITE_WEP104) &&
544 (tx_key || (!addr && wdev->wext.default_key == -1))) {
545 if (wdev->connected ||
546 (wdev->iftype == NL80211_IFTYPE_ADHOC &&
547 wdev->u.ibss.current_bss)) {
549 * If we are getting a new TX key from not having
550 * had one before we need to join a new IBSS with
551 * the privacy bit set.
553 if (wdev->iftype == NL80211_IFTYPE_ADHOC &&
554 wdev->wext.default_key == -1) {
555 __cfg80211_leave_ibss(rdev, wdev->netdev, true);
558 err = rdev_set_default_key(rdev, dev, -1, idx, true,
562 wdev->wext.default_key = idx;
564 err = cfg80211_ibss_wext_join(rdev, wdev);
569 if (params->cipher == WLAN_CIPHER_SUITE_AES_CMAC &&
570 (tx_key || (!addr && wdev->wext.default_mgmt_key == -1))) {
571 if (wdev->connected ||
572 (wdev->iftype == NL80211_IFTYPE_ADHOC &&
573 wdev->u.ibss.current_bss))
574 err = rdev_set_default_mgmt_key(rdev, dev, -1, idx);
576 wdev->wext.default_mgmt_key = idx;
583 static int cfg80211_set_encryption(struct cfg80211_registered_device *rdev,
584 struct net_device *dev, bool pairwise,
585 const u8 *addr, bool remove, bool tx_key,
586 int idx, struct key_params *params)
590 wdev_lock(dev->ieee80211_ptr);
591 err = __cfg80211_set_encryption(rdev, dev, pairwise, addr,
592 remove, tx_key, idx, params);
593 wdev_unlock(dev->ieee80211_ptr);
598 static int cfg80211_wext_siwencode(struct net_device *dev,
599 struct iw_request_info *info,
600 union iwreq_data *wrqu, char *keybuf)
602 struct iw_point *erq = &wrqu->encoding;
603 struct wireless_dev *wdev = dev->ieee80211_ptr;
604 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
607 struct key_params params;
609 if (wdev->iftype != NL80211_IFTYPE_STATION &&
610 wdev->iftype != NL80211_IFTYPE_ADHOC)
613 /* no use -- only MFP (set_default_mgmt_key) is optional */
614 if (!rdev->ops->del_key ||
615 !rdev->ops->add_key ||
616 !rdev->ops->set_default_key)
619 wiphy_lock(&rdev->wiphy);
620 if (wdev->valid_links) {
625 idx = erq->flags & IW_ENCODE_INDEX;
627 idx = wdev->wext.default_key;
630 } else if (idx < 1 || idx > 4) {
637 if (erq->flags & IW_ENCODE_DISABLED)
639 else if (erq->length == 0) {
640 /* No key data - just set the default TX key index */
643 if (wdev->connected ||
644 (wdev->iftype == NL80211_IFTYPE_ADHOC &&
645 wdev->u.ibss.current_bss))
646 err = rdev_set_default_key(rdev, dev, -1, idx, true,
649 wdev->wext.default_key = idx;
654 memset(¶ms, 0, sizeof(params));
656 params.key_len = erq->length;
657 if (erq->length == 5) {
658 params.cipher = WLAN_CIPHER_SUITE_WEP40;
659 } else if (erq->length == 13) {
660 params.cipher = WLAN_CIPHER_SUITE_WEP104;
661 } else if (!remove) {
666 err = cfg80211_set_encryption(rdev, dev, false, NULL, remove,
667 wdev->wext.default_key == -1,
670 wiphy_unlock(&rdev->wiphy);
675 static int cfg80211_wext_siwencodeext(struct net_device *dev,
676 struct iw_request_info *info,
677 union iwreq_data *wrqu, char *extra)
679 struct iw_point *erq = &wrqu->encoding;
680 struct wireless_dev *wdev = dev->ieee80211_ptr;
681 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
682 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
686 struct key_params params;
690 if (wdev->iftype != NL80211_IFTYPE_STATION &&
691 wdev->iftype != NL80211_IFTYPE_ADHOC)
694 /* no use -- only MFP (set_default_mgmt_key) is optional */
695 if (!rdev->ops->del_key ||
696 !rdev->ops->add_key ||
697 !rdev->ops->set_default_key)
701 if (wdev->valid_links) {
708 case IW_ENCODE_ALG_NONE:
712 case IW_ENCODE_ALG_WEP:
713 if (ext->key_len == 5)
714 cipher = WLAN_CIPHER_SUITE_WEP40;
715 else if (ext->key_len == 13)
716 cipher = WLAN_CIPHER_SUITE_WEP104;
720 case IW_ENCODE_ALG_TKIP:
721 cipher = WLAN_CIPHER_SUITE_TKIP;
723 case IW_ENCODE_ALG_CCMP:
724 cipher = WLAN_CIPHER_SUITE_CCMP;
726 case IW_ENCODE_ALG_AES_CMAC:
727 cipher = WLAN_CIPHER_SUITE_AES_CMAC;
733 if (erq->flags & IW_ENCODE_DISABLED)
736 idx = erq->flags & IW_ENCODE_INDEX;
737 if (cipher == WLAN_CIPHER_SUITE_AES_CMAC) {
738 if (idx < 4 || idx > 5) {
739 idx = wdev->wext.default_mgmt_key;
745 if (idx < 1 || idx > 4) {
746 idx = wdev->wext.default_key;
753 addr = ext->addr.sa_data;
754 if (is_broadcast_ether_addr(addr))
757 memset(¶ms, 0, sizeof(params));
758 params.key = ext->key;
759 params.key_len = ext->key_len;
760 params.cipher = cipher;
762 if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
763 params.seq = ext->rx_seq;
767 wiphy_lock(wdev->wiphy);
768 ret = cfg80211_set_encryption(
770 !(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY),
772 ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY,
774 wiphy_unlock(wdev->wiphy);
779 static int cfg80211_wext_giwencode(struct net_device *dev,
780 struct iw_request_info *info,
781 union iwreq_data *wrqu, char *keybuf)
783 struct iw_point *erq = &wrqu->encoding;
784 struct wireless_dev *wdev = dev->ieee80211_ptr;
787 if (wdev->iftype != NL80211_IFTYPE_STATION &&
788 wdev->iftype != NL80211_IFTYPE_ADHOC)
791 idx = erq->flags & IW_ENCODE_INDEX;
793 idx = wdev->wext.default_key;
796 } else if (idx < 1 || idx > 4)
801 erq->flags = idx + 1;
803 if (!wdev->wext.keys || !wdev->wext.keys->params[idx].cipher) {
804 erq->flags |= IW_ENCODE_DISABLED;
809 erq->length = min_t(size_t, erq->length,
810 wdev->wext.keys->params[idx].key_len);
811 memcpy(keybuf, wdev->wext.keys->params[idx].key, erq->length);
812 erq->flags |= IW_ENCODE_ENABLED;
817 static int cfg80211_wext_siwfreq(struct net_device *dev,
818 struct iw_request_info *info,
819 union iwreq_data *wrqu, char *extra)
821 struct iw_freq *wextfreq = &wrqu->freq;
822 struct wireless_dev *wdev = dev->ieee80211_ptr;
823 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
824 struct cfg80211_chan_def chandef = {
825 .width = NL80211_CHAN_WIDTH_20_NOHT,
829 wiphy_lock(&rdev->wiphy);
831 switch (wdev->iftype) {
832 case NL80211_IFTYPE_STATION:
833 ret = cfg80211_mgd_wext_siwfreq(dev, info, wextfreq, extra);
835 case NL80211_IFTYPE_ADHOC:
836 ret = cfg80211_ibss_wext_siwfreq(dev, info, wextfreq, extra);
838 case NL80211_IFTYPE_MONITOR:
839 freq = cfg80211_wext_freq(wextfreq);
848 chandef.center_freq1 = freq;
849 chandef.chan = ieee80211_get_channel(&rdev->wiphy, freq);
854 ret = cfg80211_set_monitor_channel(rdev, &chandef);
856 case NL80211_IFTYPE_MESH_POINT:
857 freq = cfg80211_wext_freq(wextfreq);
866 chandef.center_freq1 = freq;
867 chandef.chan = ieee80211_get_channel(&rdev->wiphy, freq);
872 ret = cfg80211_set_mesh_channel(rdev, wdev, &chandef);
879 wiphy_unlock(&rdev->wiphy);
884 static int cfg80211_wext_giwfreq(struct net_device *dev,
885 struct iw_request_info *info,
886 union iwreq_data *wrqu, char *extra)
888 struct iw_freq *freq = &wrqu->freq;
889 struct wireless_dev *wdev = dev->ieee80211_ptr;
890 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
891 struct cfg80211_chan_def chandef = {};
894 wiphy_lock(&rdev->wiphy);
895 switch (wdev->iftype) {
896 case NL80211_IFTYPE_STATION:
897 ret = cfg80211_mgd_wext_giwfreq(dev, info, freq, extra);
899 case NL80211_IFTYPE_ADHOC:
900 ret = cfg80211_ibss_wext_giwfreq(dev, info, freq, extra);
902 case NL80211_IFTYPE_MONITOR:
903 if (!rdev->ops->get_channel) {
908 ret = rdev_get_channel(rdev, wdev, 0, &chandef);
911 freq->m = chandef.chan->center_freq;
920 wiphy_unlock(&rdev->wiphy);
925 static int cfg80211_wext_siwtxpower(struct net_device *dev,
926 struct iw_request_info *info,
927 union iwreq_data *data, char *extra)
929 struct wireless_dev *wdev = dev->ieee80211_ptr;
930 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
931 enum nl80211_tx_power_setting type;
935 if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM)
937 if (data->txpower.flags & IW_TXPOW_RANGE)
940 if (!rdev->ops->set_tx_power)
943 /* only change when not disabling */
944 if (!data->txpower.disabled) {
945 rfkill_set_sw_state(rdev->wiphy.rfkill, false);
947 if (data->txpower.fixed) {
949 * wext doesn't support negative values, see
950 * below where it's for automatic
952 if (data->txpower.value < 0)
954 dbm = data->txpower.value;
955 type = NL80211_TX_POWER_FIXED;
956 /* TODO: do regulatory check! */
959 * Automatic power level setting, max being the value
960 * passed in from userland.
962 if (data->txpower.value < 0) {
963 type = NL80211_TX_POWER_AUTOMATIC;
965 dbm = data->txpower.value;
966 type = NL80211_TX_POWER_LIMITED;
970 if (rfkill_set_sw_state(rdev->wiphy.rfkill, true))
971 schedule_work(&rdev->rfkill_block);
975 wiphy_lock(&rdev->wiphy);
976 ret = rdev_set_tx_power(rdev, wdev, type, DBM_TO_MBM(dbm));
977 wiphy_unlock(&rdev->wiphy);
982 static int cfg80211_wext_giwtxpower(struct net_device *dev,
983 struct iw_request_info *info,
984 union iwreq_data *data, char *extra)
986 struct wireless_dev *wdev = dev->ieee80211_ptr;
987 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
990 if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM)
992 if (data->txpower.flags & IW_TXPOW_RANGE)
995 if (!rdev->ops->get_tx_power)
998 wiphy_lock(&rdev->wiphy);
999 err = rdev_get_tx_power(rdev, wdev, &val);
1000 wiphy_unlock(&rdev->wiphy);
1004 /* well... oh well */
1005 data->txpower.fixed = 1;
1006 data->txpower.disabled = rfkill_blocked(rdev->wiphy.rfkill);
1007 data->txpower.value = val;
1008 data->txpower.flags = IW_TXPOW_DBM;
1013 static int cfg80211_set_auth_alg(struct wireless_dev *wdev,
1021 if (auth_alg & ~(IW_AUTH_ALG_OPEN_SYSTEM |
1022 IW_AUTH_ALG_SHARED_KEY |
1026 if (auth_alg & IW_AUTH_ALG_OPEN_SYSTEM) {
1028 wdev->wext.connect.auth_type = NL80211_AUTHTYPE_OPEN_SYSTEM;
1031 if (auth_alg & IW_AUTH_ALG_SHARED_KEY) {
1033 wdev->wext.connect.auth_type = NL80211_AUTHTYPE_SHARED_KEY;
1036 if (auth_alg & IW_AUTH_ALG_LEAP) {
1038 wdev->wext.connect.auth_type = NL80211_AUTHTYPE_NETWORK_EAP;
1042 wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
1047 static int cfg80211_set_wpa_version(struct wireless_dev *wdev, u32 wpa_versions)
1049 if (wpa_versions & ~(IW_AUTH_WPA_VERSION_WPA |
1050 IW_AUTH_WPA_VERSION_WPA2|
1051 IW_AUTH_WPA_VERSION_DISABLED))
1054 if ((wpa_versions & IW_AUTH_WPA_VERSION_DISABLED) &&
1055 (wpa_versions & (IW_AUTH_WPA_VERSION_WPA|
1056 IW_AUTH_WPA_VERSION_WPA2)))
1059 if (wpa_versions & IW_AUTH_WPA_VERSION_DISABLED)
1060 wdev->wext.connect.crypto.wpa_versions &=
1061 ~(NL80211_WPA_VERSION_1|NL80211_WPA_VERSION_2);
1063 if (wpa_versions & IW_AUTH_WPA_VERSION_WPA)
1064 wdev->wext.connect.crypto.wpa_versions |=
1065 NL80211_WPA_VERSION_1;
1067 if (wpa_versions & IW_AUTH_WPA_VERSION_WPA2)
1068 wdev->wext.connect.crypto.wpa_versions |=
1069 NL80211_WPA_VERSION_2;
1074 static int cfg80211_set_cipher_group(struct wireless_dev *wdev, u32 cipher)
1076 if (cipher & IW_AUTH_CIPHER_WEP40)
1077 wdev->wext.connect.crypto.cipher_group =
1078 WLAN_CIPHER_SUITE_WEP40;
1079 else if (cipher & IW_AUTH_CIPHER_WEP104)
1080 wdev->wext.connect.crypto.cipher_group =
1081 WLAN_CIPHER_SUITE_WEP104;
1082 else if (cipher & IW_AUTH_CIPHER_TKIP)
1083 wdev->wext.connect.crypto.cipher_group =
1084 WLAN_CIPHER_SUITE_TKIP;
1085 else if (cipher & IW_AUTH_CIPHER_CCMP)
1086 wdev->wext.connect.crypto.cipher_group =
1087 WLAN_CIPHER_SUITE_CCMP;
1088 else if (cipher & IW_AUTH_CIPHER_AES_CMAC)
1089 wdev->wext.connect.crypto.cipher_group =
1090 WLAN_CIPHER_SUITE_AES_CMAC;
1091 else if (cipher & IW_AUTH_CIPHER_NONE)
1092 wdev->wext.connect.crypto.cipher_group = 0;
1099 static int cfg80211_set_cipher_pairwise(struct wireless_dev *wdev, u32 cipher)
1102 u32 *ciphers_pairwise = wdev->wext.connect.crypto.ciphers_pairwise;
1104 if (cipher & IW_AUTH_CIPHER_WEP40) {
1105 ciphers_pairwise[nr_ciphers] = WLAN_CIPHER_SUITE_WEP40;
1109 if (cipher & IW_AUTH_CIPHER_WEP104) {
1110 ciphers_pairwise[nr_ciphers] = WLAN_CIPHER_SUITE_WEP104;
1114 if (cipher & IW_AUTH_CIPHER_TKIP) {
1115 ciphers_pairwise[nr_ciphers] = WLAN_CIPHER_SUITE_TKIP;
1119 if (cipher & IW_AUTH_CIPHER_CCMP) {
1120 ciphers_pairwise[nr_ciphers] = WLAN_CIPHER_SUITE_CCMP;
1124 if (cipher & IW_AUTH_CIPHER_AES_CMAC) {
1125 ciphers_pairwise[nr_ciphers] = WLAN_CIPHER_SUITE_AES_CMAC;
1129 BUILD_BUG_ON(NL80211_MAX_NR_CIPHER_SUITES < 5);
1131 wdev->wext.connect.crypto.n_ciphers_pairwise = nr_ciphers;
1137 static int cfg80211_set_key_mgt(struct wireless_dev *wdev, u32 key_mgt)
1139 int nr_akm_suites = 0;
1141 if (key_mgt & ~(IW_AUTH_KEY_MGMT_802_1X |
1142 IW_AUTH_KEY_MGMT_PSK))
1145 if (key_mgt & IW_AUTH_KEY_MGMT_802_1X) {
1146 wdev->wext.connect.crypto.akm_suites[nr_akm_suites] =
1147 WLAN_AKM_SUITE_8021X;
1151 if (key_mgt & IW_AUTH_KEY_MGMT_PSK) {
1152 wdev->wext.connect.crypto.akm_suites[nr_akm_suites] =
1157 wdev->wext.connect.crypto.n_akm_suites = nr_akm_suites;
1162 static int cfg80211_wext_siwauth(struct net_device *dev,
1163 struct iw_request_info *info,
1164 union iwreq_data *wrqu, char *extra)
1166 struct iw_param *data = &wrqu->param;
1167 struct wireless_dev *wdev = dev->ieee80211_ptr;
1169 if (wdev->iftype != NL80211_IFTYPE_STATION)
1172 switch (data->flags & IW_AUTH_INDEX) {
1173 case IW_AUTH_PRIVACY_INVOKED:
1174 wdev->wext.connect.privacy = data->value;
1176 case IW_AUTH_WPA_VERSION:
1177 return cfg80211_set_wpa_version(wdev, data->value);
1178 case IW_AUTH_CIPHER_GROUP:
1179 return cfg80211_set_cipher_group(wdev, data->value);
1180 case IW_AUTH_KEY_MGMT:
1181 return cfg80211_set_key_mgt(wdev, data->value);
1182 case IW_AUTH_CIPHER_PAIRWISE:
1183 return cfg80211_set_cipher_pairwise(wdev, data->value);
1184 case IW_AUTH_80211_AUTH_ALG:
1185 return cfg80211_set_auth_alg(wdev, data->value);
1186 case IW_AUTH_WPA_ENABLED:
1187 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
1188 case IW_AUTH_DROP_UNENCRYPTED:
1196 static int cfg80211_wext_giwauth(struct net_device *dev,
1197 struct iw_request_info *info,
1198 union iwreq_data *wrqu, char *extra)
1200 /* XXX: what do we need? */
1205 static int cfg80211_wext_siwpower(struct net_device *dev,
1206 struct iw_request_info *info,
1207 union iwreq_data *wrqu, char *extra)
1209 struct iw_param *wrq = &wrqu->power;
1210 struct wireless_dev *wdev = dev->ieee80211_ptr;
1211 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1213 int timeout = wdev->ps_timeout;
1216 if (wdev->iftype != NL80211_IFTYPE_STATION)
1219 if (!rdev->ops->set_power_mgmt)
1222 if (wrq->disabled) {
1225 switch (wrq->flags & IW_POWER_MODE) {
1226 case IW_POWER_ON: /* If not specified */
1227 case IW_POWER_MODE: /* If set all mask */
1228 case IW_POWER_ALL_R: /* If explicitely state all */
1231 default: /* Otherwise we ignore */
1235 if (wrq->flags & ~(IW_POWER_MODE | IW_POWER_TIMEOUT))
1238 if (wrq->flags & IW_POWER_TIMEOUT)
1239 timeout = wrq->value / 1000;
1242 wiphy_lock(&rdev->wiphy);
1243 err = rdev_set_power_mgmt(rdev, dev, ps, timeout);
1244 wiphy_unlock(&rdev->wiphy);
1249 wdev->ps_timeout = timeout;
1255 static int cfg80211_wext_giwpower(struct net_device *dev,
1256 struct iw_request_info *info,
1257 union iwreq_data *wrqu, char *extra)
1259 struct iw_param *wrq = &wrqu->power;
1260 struct wireless_dev *wdev = dev->ieee80211_ptr;
1262 wrq->disabled = !wdev->ps;
1267 static int cfg80211_wext_siwrate(struct net_device *dev,
1268 struct iw_request_info *info,
1269 union iwreq_data *wrqu, char *extra)
1271 struct iw_param *rate = &wrqu->bitrate;
1272 struct wireless_dev *wdev = dev->ieee80211_ptr;
1273 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1274 struct cfg80211_bitrate_mask mask;
1276 struct ieee80211_supported_band *sband;
1277 int band, ridx, ret;
1280 if (!rdev->ops->set_bitrate_mask)
1283 memset(&mask, 0, sizeof(mask));
1287 if (rate->value < 0) {
1289 } else if (rate->fixed) {
1290 fixed = rate->value / 100000;
1292 maxrate = rate->value / 100000;
1295 for (band = 0; band < NUM_NL80211_BANDS; band++) {
1296 sband = wdev->wiphy->bands[band];
1299 for (ridx = 0; ridx < sband->n_bitrates; ridx++) {
1300 struct ieee80211_rate *srate = &sband->bitrates[ridx];
1301 if (fixed == srate->bitrate) {
1302 mask.control[band].legacy = 1 << ridx;
1306 if (srate->bitrate <= maxrate) {
1307 mask.control[band].legacy |= 1 << ridx;
1316 wiphy_lock(&rdev->wiphy);
1317 if (dev->ieee80211_ptr->valid_links)
1320 ret = rdev_set_bitrate_mask(rdev, dev, 0, NULL, &mask);
1321 wiphy_unlock(&rdev->wiphy);
1326 static int cfg80211_wext_giwrate(struct net_device *dev,
1327 struct iw_request_info *info,
1328 union iwreq_data *wrqu, char *extra)
1330 struct iw_param *rate = &wrqu->bitrate;
1331 struct wireless_dev *wdev = dev->ieee80211_ptr;
1332 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1333 struct station_info sinfo = {};
1337 if (wdev->iftype != NL80211_IFTYPE_STATION)
1340 if (!rdev->ops->get_station)
1345 if (!wdev->valid_links && wdev->links[0].client.current_bss)
1346 memcpy(addr, wdev->links[0].client.current_bss->pub.bssid,
1354 wiphy_lock(&rdev->wiphy);
1355 err = rdev_get_station(rdev, dev, addr, &sinfo);
1356 wiphy_unlock(&rdev->wiphy);
1360 if (!(sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE))) {
1365 rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.txrate);
1368 cfg80211_sinfo_release_content(&sinfo);
1372 /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
1373 static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
1375 struct wireless_dev *wdev = dev->ieee80211_ptr;
1376 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1377 /* we are under RTNL - globally locked - so can use static structs */
1378 static struct iw_statistics wstats;
1379 static struct station_info sinfo = {};
1383 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION)
1386 if (!rdev->ops->get_station)
1389 /* Grab BSSID of current BSS, if any */
1391 if (wdev->valid_links || !wdev->links[0].client.current_bss) {
1395 memcpy(bssid, wdev->links[0].client.current_bss->pub.bssid, ETH_ALEN);
1398 memset(&sinfo, 0, sizeof(sinfo));
1400 wiphy_lock(&rdev->wiphy);
1401 ret = rdev_get_station(rdev, dev, bssid, &sinfo);
1402 wiphy_unlock(&rdev->wiphy);
1407 memset(&wstats, 0, sizeof(wstats));
1409 switch (rdev->wiphy.signal_type) {
1410 case CFG80211_SIGNAL_TYPE_MBM:
1411 if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_SIGNAL)) {
1412 int sig = sinfo.signal;
1413 wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED;
1414 wstats.qual.updated |= IW_QUAL_QUAL_UPDATED;
1415 wstats.qual.updated |= IW_QUAL_DBM;
1416 wstats.qual.level = sig;
1421 wstats.qual.qual = sig + 110;
1425 case CFG80211_SIGNAL_TYPE_UNSPEC:
1426 if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_SIGNAL)) {
1427 wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED;
1428 wstats.qual.updated |= IW_QUAL_QUAL_UPDATED;
1429 wstats.qual.level = sinfo.signal;
1430 wstats.qual.qual = sinfo.signal;
1435 wstats.qual.updated |= IW_QUAL_LEVEL_INVALID;
1436 wstats.qual.updated |= IW_QUAL_QUAL_INVALID;
1439 wstats.qual.updated |= IW_QUAL_NOISE_INVALID;
1440 if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC))
1441 wstats.discard.misc = sinfo.rx_dropped_misc;
1442 if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_FAILED))
1443 wstats.discard.retries = sinfo.tx_failed;
1445 cfg80211_sinfo_release_content(&sinfo);
1450 static int cfg80211_wext_siwap(struct net_device *dev,
1451 struct iw_request_info *info,
1452 union iwreq_data *wrqu, char *extra)
1454 struct sockaddr *ap_addr = &wrqu->ap_addr;
1455 struct wireless_dev *wdev = dev->ieee80211_ptr;
1456 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1459 wiphy_lock(&rdev->wiphy);
1460 switch (wdev->iftype) {
1461 case NL80211_IFTYPE_ADHOC:
1462 ret = cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra);
1464 case NL80211_IFTYPE_STATION:
1465 ret = cfg80211_mgd_wext_siwap(dev, info, ap_addr, extra);
1471 wiphy_unlock(&rdev->wiphy);
1476 static int cfg80211_wext_giwap(struct net_device *dev,
1477 struct iw_request_info *info,
1478 union iwreq_data *wrqu, char *extra)
1480 struct sockaddr *ap_addr = &wrqu->ap_addr;
1481 struct wireless_dev *wdev = dev->ieee80211_ptr;
1482 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1485 wiphy_lock(&rdev->wiphy);
1486 switch (wdev->iftype) {
1487 case NL80211_IFTYPE_ADHOC:
1488 ret = cfg80211_ibss_wext_giwap(dev, info, ap_addr, extra);
1490 case NL80211_IFTYPE_STATION:
1491 ret = cfg80211_mgd_wext_giwap(dev, info, ap_addr, extra);
1497 wiphy_unlock(&rdev->wiphy);
1502 static int cfg80211_wext_siwessid(struct net_device *dev,
1503 struct iw_request_info *info,
1504 union iwreq_data *wrqu, char *ssid)
1506 struct iw_point *data = &wrqu->data;
1507 struct wireless_dev *wdev = dev->ieee80211_ptr;
1508 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1511 wiphy_lock(&rdev->wiphy);
1512 switch (wdev->iftype) {
1513 case NL80211_IFTYPE_ADHOC:
1514 ret = cfg80211_ibss_wext_siwessid(dev, info, data, ssid);
1516 case NL80211_IFTYPE_STATION:
1517 ret = cfg80211_mgd_wext_siwessid(dev, info, data, ssid);
1523 wiphy_unlock(&rdev->wiphy);
1528 static int cfg80211_wext_giwessid(struct net_device *dev,
1529 struct iw_request_info *info,
1530 union iwreq_data *wrqu, char *ssid)
1532 struct iw_point *data = &wrqu->data;
1533 struct wireless_dev *wdev = dev->ieee80211_ptr;
1534 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1540 wiphy_lock(&rdev->wiphy);
1541 switch (wdev->iftype) {
1542 case NL80211_IFTYPE_ADHOC:
1543 ret = cfg80211_ibss_wext_giwessid(dev, info, data, ssid);
1545 case NL80211_IFTYPE_STATION:
1546 ret = cfg80211_mgd_wext_giwessid(dev, info, data, ssid);
1552 wiphy_unlock(&rdev->wiphy);
1557 static int cfg80211_wext_siwpmksa(struct net_device *dev,
1558 struct iw_request_info *info,
1559 union iwreq_data *wrqu, char *extra)
1561 struct wireless_dev *wdev = dev->ieee80211_ptr;
1562 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1563 struct cfg80211_pmksa cfg_pmksa;
1564 struct iw_pmksa *pmksa = (struct iw_pmksa *)extra;
1567 memset(&cfg_pmksa, 0, sizeof(struct cfg80211_pmksa));
1569 if (wdev->iftype != NL80211_IFTYPE_STATION)
1572 cfg_pmksa.bssid = pmksa->bssid.sa_data;
1573 cfg_pmksa.pmkid = pmksa->pmkid;
1575 wiphy_lock(&rdev->wiphy);
1576 switch (pmksa->cmd) {
1578 if (!rdev->ops->set_pmksa) {
1583 ret = rdev_set_pmksa(rdev, dev, &cfg_pmksa);
1585 case IW_PMKSA_REMOVE:
1586 if (!rdev->ops->del_pmksa) {
1591 ret = rdev_del_pmksa(rdev, dev, &cfg_pmksa);
1593 case IW_PMKSA_FLUSH:
1594 if (!rdev->ops->flush_pmksa) {
1599 ret = rdev_flush_pmksa(rdev, dev);
1605 wiphy_unlock(&rdev->wiphy);
1610 static const iw_handler cfg80211_handlers[] = {
1611 IW_HANDLER(SIOCGIWNAME, cfg80211_wext_giwname),
1612 IW_HANDLER(SIOCSIWFREQ, cfg80211_wext_siwfreq),
1613 IW_HANDLER(SIOCGIWFREQ, cfg80211_wext_giwfreq),
1614 IW_HANDLER(SIOCSIWMODE, cfg80211_wext_siwmode),
1615 IW_HANDLER(SIOCGIWMODE, cfg80211_wext_giwmode),
1616 IW_HANDLER(SIOCGIWRANGE, cfg80211_wext_giwrange),
1617 IW_HANDLER(SIOCSIWAP, cfg80211_wext_siwap),
1618 IW_HANDLER(SIOCGIWAP, cfg80211_wext_giwap),
1619 IW_HANDLER(SIOCSIWMLME, cfg80211_wext_siwmlme),
1620 IW_HANDLER(SIOCSIWSCAN, cfg80211_wext_siwscan),
1621 IW_HANDLER(SIOCGIWSCAN, cfg80211_wext_giwscan),
1622 IW_HANDLER(SIOCSIWESSID, cfg80211_wext_siwessid),
1623 IW_HANDLER(SIOCGIWESSID, cfg80211_wext_giwessid),
1624 IW_HANDLER(SIOCSIWRATE, cfg80211_wext_siwrate),
1625 IW_HANDLER(SIOCGIWRATE, cfg80211_wext_giwrate),
1626 IW_HANDLER(SIOCSIWRTS, cfg80211_wext_siwrts),
1627 IW_HANDLER(SIOCGIWRTS, cfg80211_wext_giwrts),
1628 IW_HANDLER(SIOCSIWFRAG, cfg80211_wext_siwfrag),
1629 IW_HANDLER(SIOCGIWFRAG, cfg80211_wext_giwfrag),
1630 IW_HANDLER(SIOCSIWTXPOW, cfg80211_wext_siwtxpower),
1631 IW_HANDLER(SIOCGIWTXPOW, cfg80211_wext_giwtxpower),
1632 IW_HANDLER(SIOCSIWRETRY, cfg80211_wext_siwretry),
1633 IW_HANDLER(SIOCGIWRETRY, cfg80211_wext_giwretry),
1634 IW_HANDLER(SIOCSIWENCODE, cfg80211_wext_siwencode),
1635 IW_HANDLER(SIOCGIWENCODE, cfg80211_wext_giwencode),
1636 IW_HANDLER(SIOCSIWPOWER, cfg80211_wext_siwpower),
1637 IW_HANDLER(SIOCGIWPOWER, cfg80211_wext_giwpower),
1638 IW_HANDLER(SIOCSIWGENIE, cfg80211_wext_siwgenie),
1639 IW_HANDLER(SIOCSIWAUTH, cfg80211_wext_siwauth),
1640 IW_HANDLER(SIOCGIWAUTH, cfg80211_wext_giwauth),
1641 IW_HANDLER(SIOCSIWENCODEEXT, cfg80211_wext_siwencodeext),
1642 IW_HANDLER(SIOCSIWPMKSA, cfg80211_wext_siwpmksa),
1645 const struct iw_handler_def cfg80211_wext_handler = {
1646 .num_standard = ARRAY_SIZE(cfg80211_handlers),
1647 .standard = cfg80211_handlers,
1648 .get_wireless_stats = cfg80211_wireless_stats,