2 * cfg80211 - wext compat code
4 * This is temporary code until all wireless functionality is migrated
5 * into cfg80211, when that happens all the exports here go away and
6 * we directly assign the wireless handlers of wireless interfaces.
8 * Copyright 2008-2009 Johannes Berg <johannes@sipsolutions.net>
11 #include <linux/wireless.h>
12 #include <linux/nl80211.h>
13 #include <linux/if_arp.h>
14 #include <linux/etherdevice.h>
15 #include <linux/slab.h>
16 #include <net/iw_handler.h>
17 #include <net/cfg80211.h>
18 #include "wext-compat.h"
21 int cfg80211_wext_giwname(struct net_device
*dev
,
22 struct iw_request_info
*info
,
23 char *name
, char *extra
)
25 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
26 struct ieee80211_supported_band
*sband
;
27 bool is_ht
= false, is_a
= false, is_b
= false, is_g
= false;
32 sband
= wdev
->wiphy
->bands
[IEEE80211_BAND_5GHZ
];
35 is_ht
|= sband
->ht_cap
.ht_supported
;
38 sband
= wdev
->wiphy
->bands
[IEEE80211_BAND_2GHZ
];
41 /* Check for mandatory rates */
42 for (i
= 0; i
< sband
->n_bitrates
; i
++) {
43 if (sband
->bitrates
[i
].bitrate
== 10)
45 if (sband
->bitrates
[i
].bitrate
== 60)
48 is_ht
|= sband
->ht_cap
.ht_supported
;
51 strcpy(name
, "IEEE 802.11");
63 EXPORT_SYMBOL_GPL(cfg80211_wext_giwname
);
65 int cfg80211_wext_siwmode(struct net_device
*dev
, struct iw_request_info
*info
,
66 u32
*mode
, char *extra
)
68 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
69 struct cfg80211_registered_device
*rdev
;
70 struct vif_params vifparams
;
71 enum nl80211_iftype type
;
74 rdev
= wiphy_to_dev(wdev
->wiphy
);
78 type
= NL80211_IFTYPE_STATION
;
81 type
= NL80211_IFTYPE_ADHOC
;
84 type
= NL80211_IFTYPE_WDS
;
87 type
= NL80211_IFTYPE_MONITOR
;
93 if (type
== wdev
->iftype
)
96 memset(&vifparams
, 0, sizeof(vifparams
));
98 cfg80211_lock_rdev(rdev
);
99 ret
= cfg80211_change_iface(rdev
, dev
, type
, NULL
, &vifparams
);
100 cfg80211_unlock_rdev(rdev
);
104 EXPORT_SYMBOL_GPL(cfg80211_wext_siwmode
);
106 int cfg80211_wext_giwmode(struct net_device
*dev
, struct iw_request_info
*info
,
107 u32
*mode
, char *extra
)
109 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
114 switch (wdev
->iftype
) {
115 case NL80211_IFTYPE_AP
:
116 *mode
= IW_MODE_MASTER
;
118 case NL80211_IFTYPE_STATION
:
119 *mode
= IW_MODE_INFRA
;
121 case NL80211_IFTYPE_ADHOC
:
122 *mode
= IW_MODE_ADHOC
;
124 case NL80211_IFTYPE_MONITOR
:
125 *mode
= IW_MODE_MONITOR
;
127 case NL80211_IFTYPE_WDS
:
128 *mode
= IW_MODE_REPEAT
;
130 case NL80211_IFTYPE_AP_VLAN
:
131 *mode
= IW_MODE_SECOND
; /* FIXME */
134 *mode
= IW_MODE_AUTO
;
139 EXPORT_SYMBOL_GPL(cfg80211_wext_giwmode
);
142 int cfg80211_wext_giwrange(struct net_device
*dev
,
143 struct iw_request_info
*info
,
144 struct iw_point
*data
, char *extra
)
146 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
147 struct iw_range
*range
= (struct iw_range
*) extra
;
148 enum ieee80211_band band
;
154 data
->length
= sizeof(struct iw_range
);
155 memset(range
, 0, sizeof(struct iw_range
));
157 range
->we_version_compiled
= WIRELESS_EXT
;
158 range
->we_version_source
= 21;
159 range
->retry_capa
= IW_RETRY_LIMIT
;
160 range
->retry_flags
= IW_RETRY_LIMIT
;
161 range
->min_retry
= 0;
162 range
->max_retry
= 255;
164 range
->max_rts
= 2347;
165 range
->min_frag
= 256;
166 range
->max_frag
= 2346;
168 range
->max_encoding_tokens
= 4;
170 range
->max_qual
.updated
= IW_QUAL_NOISE_INVALID
;
172 switch (wdev
->wiphy
->signal_type
) {
173 case CFG80211_SIGNAL_TYPE_NONE
:
175 case CFG80211_SIGNAL_TYPE_MBM
:
176 range
->max_qual
.level
= -110;
177 range
->max_qual
.qual
= 70;
178 range
->avg_qual
.qual
= 35;
179 range
->max_qual
.updated
|= IW_QUAL_DBM
;
180 range
->max_qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
181 range
->max_qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
183 case CFG80211_SIGNAL_TYPE_UNSPEC
:
184 range
->max_qual
.level
= 100;
185 range
->max_qual
.qual
= 100;
186 range
->avg_qual
.qual
= 50;
187 range
->max_qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
188 range
->max_qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
192 range
->avg_qual
.level
= range
->max_qual
.level
/ 2;
193 range
->avg_qual
.noise
= range
->max_qual
.noise
/ 2;
194 range
->avg_qual
.updated
= range
->max_qual
.updated
;
196 for (i
= 0; i
< wdev
->wiphy
->n_cipher_suites
; i
++) {
197 switch (wdev
->wiphy
->cipher_suites
[i
]) {
198 case WLAN_CIPHER_SUITE_TKIP
:
199 range
->enc_capa
|= (IW_ENC_CAPA_CIPHER_TKIP
|
203 case WLAN_CIPHER_SUITE_CCMP
:
204 range
->enc_capa
|= (IW_ENC_CAPA_CIPHER_CCMP
|
208 case WLAN_CIPHER_SUITE_WEP40
:
209 range
->encoding_size
[range
->num_encoding_sizes
++] =
213 case WLAN_CIPHER_SUITE_WEP104
:
214 range
->encoding_size
[range
->num_encoding_sizes
++] =
220 for (band
= 0; band
< IEEE80211_NUM_BANDS
; band
++) {
221 struct ieee80211_supported_band
*sband
;
223 sband
= wdev
->wiphy
->bands
[band
];
228 for (i
= 0; i
< sband
->n_channels
&& c
< IW_MAX_FREQUENCIES
; i
++) {
229 struct ieee80211_channel
*chan
= &sband
->channels
[i
];
231 if (!(chan
->flags
& IEEE80211_CHAN_DISABLED
)) {
233 ieee80211_frequency_to_channel(
235 range
->freq
[c
].m
= chan
->center_freq
;
236 range
->freq
[c
].e
= 6;
241 range
->num_channels
= c
;
242 range
->num_frequency
= c
;
244 IW_EVENT_CAPA_SET_KERNEL(range
->event_capa
);
245 IW_EVENT_CAPA_SET(range
->event_capa
, SIOCGIWAP
);
246 IW_EVENT_CAPA_SET(range
->event_capa
, SIOCGIWSCAN
);
248 if (wdev
->wiphy
->max_scan_ssids
> 0)
249 range
->scan_capa
|= IW_SCAN_CAPA_ESSID
;
253 EXPORT_SYMBOL_GPL(cfg80211_wext_giwrange
);
257 * cfg80211_wext_freq - get wext frequency for non-"auto"
259 * @freq: the wext freq encoding
261 * Returns a frequency, or a negative error code, or 0 for auto.
263 int cfg80211_wext_freq(struct wiphy
*wiphy
, struct iw_freq
*freq
)
266 * Parse frequency - return 0 for auto and
267 * -EINVAL for impossible things.
270 enum ieee80211_band band
= IEEE80211_BAND_2GHZ
;
274 band
= IEEE80211_BAND_5GHZ
;
275 return ieee80211_channel_to_frequency(freq
->m
, band
);
277 int i
, div
= 1000000;
278 for (i
= 0; i
< freq
->e
; i
++)
282 return freq
->m
/ div
;
286 int cfg80211_wext_siwrts(struct net_device
*dev
,
287 struct iw_request_info
*info
,
288 struct iw_param
*rts
, char *extra
)
290 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
291 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
292 u32 orts
= wdev
->wiphy
->rts_threshold
;
295 if (rts
->disabled
|| !rts
->fixed
)
296 wdev
->wiphy
->rts_threshold
= (u32
) -1;
297 else if (rts
->value
< 0)
300 wdev
->wiphy
->rts_threshold
= rts
->value
;
302 err
= rdev
->ops
->set_wiphy_params(wdev
->wiphy
,
303 WIPHY_PARAM_RTS_THRESHOLD
);
305 wdev
->wiphy
->rts_threshold
= orts
;
309 EXPORT_SYMBOL_GPL(cfg80211_wext_siwrts
);
311 int cfg80211_wext_giwrts(struct net_device
*dev
,
312 struct iw_request_info
*info
,
313 struct iw_param
*rts
, char *extra
)
315 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
317 rts
->value
= wdev
->wiphy
->rts_threshold
;
318 rts
->disabled
= rts
->value
== (u32
) -1;
323 EXPORT_SYMBOL_GPL(cfg80211_wext_giwrts
);
325 int cfg80211_wext_siwfrag(struct net_device
*dev
,
326 struct iw_request_info
*info
,
327 struct iw_param
*frag
, char *extra
)
329 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
330 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
331 u32 ofrag
= wdev
->wiphy
->frag_threshold
;
334 if (frag
->disabled
|| !frag
->fixed
)
335 wdev
->wiphy
->frag_threshold
= (u32
) -1;
336 else if (frag
->value
< 256)
339 /* Fragment length must be even, so strip LSB. */
340 wdev
->wiphy
->frag_threshold
= frag
->value
& ~0x1;
343 err
= rdev
->ops
->set_wiphy_params(wdev
->wiphy
,
344 WIPHY_PARAM_FRAG_THRESHOLD
);
346 wdev
->wiphy
->frag_threshold
= ofrag
;
350 EXPORT_SYMBOL_GPL(cfg80211_wext_siwfrag
);
352 int cfg80211_wext_giwfrag(struct net_device
*dev
,
353 struct iw_request_info
*info
,
354 struct iw_param
*frag
, char *extra
)
356 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
358 frag
->value
= wdev
->wiphy
->frag_threshold
;
359 frag
->disabled
= frag
->value
== (u32
) -1;
364 EXPORT_SYMBOL_GPL(cfg80211_wext_giwfrag
);
366 int cfg80211_wext_siwretry(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
;
371 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
373 u8 olong
= wdev
->wiphy
->retry_long
;
374 u8 oshort
= wdev
->wiphy
->retry_short
;
377 if (retry
->disabled
||
378 (retry
->flags
& IW_RETRY_TYPE
) != IW_RETRY_LIMIT
)
381 if (retry
->flags
& IW_RETRY_LONG
) {
382 wdev
->wiphy
->retry_long
= retry
->value
;
383 changed
|= WIPHY_PARAM_RETRY_LONG
;
384 } else if (retry
->flags
& IW_RETRY_SHORT
) {
385 wdev
->wiphy
->retry_short
= retry
->value
;
386 changed
|= WIPHY_PARAM_RETRY_SHORT
;
388 wdev
->wiphy
->retry_short
= retry
->value
;
389 wdev
->wiphy
->retry_long
= retry
->value
;
390 changed
|= WIPHY_PARAM_RETRY_LONG
;
391 changed
|= WIPHY_PARAM_RETRY_SHORT
;
397 err
= rdev
->ops
->set_wiphy_params(wdev
->wiphy
, changed
);
399 wdev
->wiphy
->retry_short
= oshort
;
400 wdev
->wiphy
->retry_long
= olong
;
405 EXPORT_SYMBOL_GPL(cfg80211_wext_siwretry
);
407 int cfg80211_wext_giwretry(struct net_device
*dev
,
408 struct iw_request_info
*info
,
409 struct iw_param
*retry
, char *extra
)
411 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
415 if (retry
->flags
== 0 || (retry
->flags
& IW_RETRY_SHORT
)) {
417 * First return short value, iwconfig will ask long value
420 retry
->flags
|= IW_RETRY_LIMIT
;
421 retry
->value
= wdev
->wiphy
->retry_short
;
422 if (wdev
->wiphy
->retry_long
!= wdev
->wiphy
->retry_short
)
423 retry
->flags
|= IW_RETRY_LONG
;
428 if (retry
->flags
& IW_RETRY_LONG
) {
429 retry
->flags
= IW_RETRY_LIMIT
| IW_RETRY_LONG
;
430 retry
->value
= wdev
->wiphy
->retry_long
;
435 EXPORT_SYMBOL_GPL(cfg80211_wext_giwretry
);
437 static int __cfg80211_set_encryption(struct cfg80211_registered_device
*rdev
,
438 struct net_device
*dev
, bool pairwise
,
439 const u8
*addr
, bool remove
, bool tx_key
,
440 int idx
, struct key_params
*params
)
442 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
446 if (pairwise
&& !addr
)
449 if (!wdev
->wext
.keys
) {
450 wdev
->wext
.keys
= kzalloc(sizeof(*wdev
->wext
.keys
),
452 if (!wdev
->wext
.keys
)
454 for (i
= 0; i
< 6; i
++)
455 wdev
->wext
.keys
->params
[i
].key
=
456 wdev
->wext
.keys
->data
[i
];
459 if (wdev
->iftype
!= NL80211_IFTYPE_ADHOC
&&
460 wdev
->iftype
!= NL80211_IFTYPE_STATION
)
463 if (params
->cipher
== WLAN_CIPHER_SUITE_AES_CMAC
) {
464 if (!wdev
->current_bss
)
467 if (!rdev
->ops
->set_default_mgmt_key
)
470 if (idx
< 4 || idx
> 5)
472 } else if (idx
< 0 || idx
> 3)
477 if (wdev
->current_bss
) {
479 * If removing the current TX key, we will need to
480 * join a new IBSS without the privacy bit clear.
482 if (idx
== wdev
->wext
.default_key
&&
483 wdev
->iftype
== NL80211_IFTYPE_ADHOC
) {
484 __cfg80211_leave_ibss(rdev
, wdev
->netdev
, true);
488 if (!pairwise
&& addr
&&
489 !(rdev
->wiphy
.flags
& WIPHY_FLAG_IBSS_RSN
))
492 err
= rdev
->ops
->del_key(&rdev
->wiphy
, dev
, idx
,
495 wdev
->wext
.connect
.privacy
= false;
497 * Applications using wireless extensions expect to be
498 * able to delete keys that don't exist, so allow that.
504 wdev
->wext
.keys
->params
[idx
].key_len
= 0;
505 wdev
->wext
.keys
->params
[idx
].cipher
= 0;
507 if (idx
== wdev
->wext
.default_key
)
508 wdev
->wext
.default_key
= -1;
509 else if (idx
== wdev
->wext
.default_mgmt_key
)
510 wdev
->wext
.default_mgmt_key
= -1;
514 err
= cfg80211_ibss_wext_join(rdev
, wdev
);
522 if (cfg80211_validate_key_settings(rdev
, params
, idx
, pairwise
, addr
))
526 if (wdev
->current_bss
)
527 err
= rdev
->ops
->add_key(&rdev
->wiphy
, dev
, idx
,
528 pairwise
, addr
, params
);
533 wdev
->wext
.keys
->params
[idx
] = *params
;
534 memcpy(wdev
->wext
.keys
->data
[idx
],
535 params
->key
, params
->key_len
);
536 wdev
->wext
.keys
->params
[idx
].key
=
537 wdev
->wext
.keys
->data
[idx
];
540 if ((params
->cipher
== WLAN_CIPHER_SUITE_WEP40
||
541 params
->cipher
== WLAN_CIPHER_SUITE_WEP104
) &&
542 (tx_key
|| (!addr
&& wdev
->wext
.default_key
== -1))) {
543 if (wdev
->current_bss
) {
545 * If we are getting a new TX key from not having
546 * had one before we need to join a new IBSS with
547 * the privacy bit set.
549 if (wdev
->iftype
== NL80211_IFTYPE_ADHOC
&&
550 wdev
->wext
.default_key
== -1) {
551 __cfg80211_leave_ibss(rdev
, wdev
->netdev
, true);
554 err
= rdev
->ops
->set_default_key(&rdev
->wiphy
, dev
,
558 wdev
->wext
.default_key
= idx
;
560 err
= cfg80211_ibss_wext_join(rdev
, wdev
);
565 if (params
->cipher
== WLAN_CIPHER_SUITE_AES_CMAC
&&
566 (tx_key
|| (!addr
&& wdev
->wext
.default_mgmt_key
== -1))) {
567 if (wdev
->current_bss
)
568 err
= rdev
->ops
->set_default_mgmt_key(&rdev
->wiphy
,
571 wdev
->wext
.default_mgmt_key
= idx
;
578 static int cfg80211_set_encryption(struct cfg80211_registered_device
*rdev
,
579 struct net_device
*dev
, bool pairwise
,
580 const u8
*addr
, bool remove
, bool tx_key
,
581 int idx
, struct key_params
*params
)
585 /* devlist mutex needed for possible IBSS re-join */
586 mutex_lock(&rdev
->devlist_mtx
);
587 wdev_lock(dev
->ieee80211_ptr
);
588 err
= __cfg80211_set_encryption(rdev
, dev
, pairwise
, addr
,
589 remove
, tx_key
, idx
, params
);
590 wdev_unlock(dev
->ieee80211_ptr
);
591 mutex_unlock(&rdev
->devlist_mtx
);
596 int cfg80211_wext_siwencode(struct net_device
*dev
,
597 struct iw_request_info
*info
,
598 struct iw_point
*erq
, char *keybuf
)
600 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
601 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
604 struct key_params params
;
606 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
607 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
610 /* no use -- only MFP (set_default_mgmt_key) is optional */
611 if (!rdev
->ops
->del_key
||
612 !rdev
->ops
->add_key
||
613 !rdev
->ops
->set_default_key
)
616 idx
= erq
->flags
& IW_ENCODE_INDEX
;
618 idx
= wdev
->wext
.default_key
;
621 } else if (idx
< 1 || idx
> 4)
626 if (erq
->flags
& IW_ENCODE_DISABLED
)
628 else if (erq
->length
== 0) {
629 /* No key data - just set the default TX key index */
632 if (wdev
->current_bss
)
633 err
= rdev
->ops
->set_default_key(&rdev
->wiphy
, dev
,
636 wdev
->wext
.default_key
= idx
;
641 memset(¶ms
, 0, sizeof(params
));
643 params
.key_len
= erq
->length
;
644 if (erq
->length
== 5)
645 params
.cipher
= WLAN_CIPHER_SUITE_WEP40
;
646 else if (erq
->length
== 13)
647 params
.cipher
= WLAN_CIPHER_SUITE_WEP104
;
651 return cfg80211_set_encryption(rdev
, dev
, false, NULL
, remove
,
652 wdev
->wext
.default_key
== -1,
655 EXPORT_SYMBOL_GPL(cfg80211_wext_siwencode
);
657 int cfg80211_wext_siwencodeext(struct net_device
*dev
,
658 struct iw_request_info
*info
,
659 struct iw_point
*erq
, char *extra
)
661 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
662 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
663 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*) extra
;
667 struct key_params params
;
670 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
671 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
674 /* no use -- only MFP (set_default_mgmt_key) is optional */
675 if (!rdev
->ops
->del_key
||
676 !rdev
->ops
->add_key
||
677 !rdev
->ops
->set_default_key
)
681 case IW_ENCODE_ALG_NONE
:
685 case IW_ENCODE_ALG_WEP
:
686 if (ext
->key_len
== 5)
687 cipher
= WLAN_CIPHER_SUITE_WEP40
;
688 else if (ext
->key_len
== 13)
689 cipher
= WLAN_CIPHER_SUITE_WEP104
;
693 case IW_ENCODE_ALG_TKIP
:
694 cipher
= WLAN_CIPHER_SUITE_TKIP
;
696 case IW_ENCODE_ALG_CCMP
:
697 cipher
= WLAN_CIPHER_SUITE_CCMP
;
699 case IW_ENCODE_ALG_AES_CMAC
:
700 cipher
= WLAN_CIPHER_SUITE_AES_CMAC
;
706 if (erq
->flags
& IW_ENCODE_DISABLED
)
709 idx
= erq
->flags
& IW_ENCODE_INDEX
;
710 if (cipher
== WLAN_CIPHER_SUITE_AES_CMAC
) {
711 if (idx
< 4 || idx
> 5) {
712 idx
= wdev
->wext
.default_mgmt_key
;
718 if (idx
< 1 || idx
> 4) {
719 idx
= wdev
->wext
.default_key
;
726 addr
= ext
->addr
.sa_data
;
727 if (is_broadcast_ether_addr(addr
))
730 memset(¶ms
, 0, sizeof(params
));
731 params
.key
= ext
->key
;
732 params
.key_len
= ext
->key_len
;
733 params
.cipher
= cipher
;
735 if (ext
->ext_flags
& IW_ENCODE_EXT_RX_SEQ_VALID
) {
736 params
.seq
= ext
->rx_seq
;
740 return cfg80211_set_encryption(
742 !(ext
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
),
744 ext
->ext_flags
& IW_ENCODE_EXT_SET_TX_KEY
,
747 EXPORT_SYMBOL_GPL(cfg80211_wext_siwencodeext
);
749 int cfg80211_wext_giwencode(struct net_device
*dev
,
750 struct iw_request_info
*info
,
751 struct iw_point
*erq
, char *keybuf
)
753 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
756 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
&&
757 wdev
->iftype
!= NL80211_IFTYPE_ADHOC
)
760 idx
= erq
->flags
& IW_ENCODE_INDEX
;
762 idx
= wdev
->wext
.default_key
;
765 } else if (idx
< 1 || idx
> 4)
770 erq
->flags
= idx
+ 1;
772 if (!wdev
->wext
.keys
|| !wdev
->wext
.keys
->params
[idx
].cipher
) {
773 erq
->flags
|= IW_ENCODE_DISABLED
;
778 erq
->length
= min_t(size_t, erq
->length
,
779 wdev
->wext
.keys
->params
[idx
].key_len
);
780 memcpy(keybuf
, wdev
->wext
.keys
->params
[idx
].key
, erq
->length
);
781 erq
->flags
|= IW_ENCODE_ENABLED
;
785 EXPORT_SYMBOL_GPL(cfg80211_wext_giwencode
);
787 int cfg80211_wext_siwfreq(struct net_device
*dev
,
788 struct iw_request_info
*info
,
789 struct iw_freq
*wextfreq
, char *extra
)
791 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
792 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
795 switch (wdev
->iftype
) {
796 case NL80211_IFTYPE_STATION
:
797 return cfg80211_mgd_wext_siwfreq(dev
, info
, wextfreq
, extra
);
798 case NL80211_IFTYPE_ADHOC
:
799 return cfg80211_ibss_wext_siwfreq(dev
, info
, wextfreq
, extra
);
800 case NL80211_IFTYPE_MONITOR
:
801 case NL80211_IFTYPE_WDS
:
802 case NL80211_IFTYPE_MESH_POINT
:
803 freq
= cfg80211_wext_freq(wdev
->wiphy
, wextfreq
);
808 mutex_lock(&rdev
->devlist_mtx
);
810 err
= cfg80211_set_freq(rdev
, wdev
, freq
, NL80211_CHAN_NO_HT
);
812 mutex_unlock(&rdev
->devlist_mtx
);
818 EXPORT_SYMBOL_GPL(cfg80211_wext_siwfreq
);
820 int cfg80211_wext_giwfreq(struct net_device
*dev
,
821 struct iw_request_info
*info
,
822 struct iw_freq
*freq
, char *extra
)
824 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
826 switch (wdev
->iftype
) {
827 case NL80211_IFTYPE_STATION
:
828 return cfg80211_mgd_wext_giwfreq(dev
, info
, freq
, extra
);
829 case NL80211_IFTYPE_ADHOC
:
830 return cfg80211_ibss_wext_giwfreq(dev
, info
, freq
, extra
);
834 freq
->m
= wdev
->channel
->center_freq
;
839 EXPORT_SYMBOL_GPL(cfg80211_wext_giwfreq
);
841 int cfg80211_wext_siwtxpower(struct net_device
*dev
,
842 struct iw_request_info
*info
,
843 union iwreq_data
*data
, char *extra
)
845 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
846 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
847 enum nl80211_tx_power_setting type
;
850 if ((data
->txpower
.flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
)
852 if (data
->txpower
.flags
& IW_TXPOW_RANGE
)
855 if (!rdev
->ops
->set_tx_power
)
858 /* only change when not disabling */
859 if (!data
->txpower
.disabled
) {
860 rfkill_set_sw_state(rdev
->rfkill
, false);
862 if (data
->txpower
.fixed
) {
864 * wext doesn't support negative values, see
865 * below where it's for automatic
867 if (data
->txpower
.value
< 0)
869 dbm
= data
->txpower
.value
;
870 type
= NL80211_TX_POWER_FIXED
;
871 /* TODO: do regulatory check! */
874 * Automatic power level setting, max being the value
875 * passed in from userland.
877 if (data
->txpower
.value
< 0) {
878 type
= NL80211_TX_POWER_AUTOMATIC
;
880 dbm
= data
->txpower
.value
;
881 type
= NL80211_TX_POWER_LIMITED
;
885 rfkill_set_sw_state(rdev
->rfkill
, true);
886 schedule_work(&rdev
->rfkill_sync
);
890 return rdev
->ops
->set_tx_power(wdev
->wiphy
, type
, DBM_TO_MBM(dbm
));
892 EXPORT_SYMBOL_GPL(cfg80211_wext_siwtxpower
);
894 int cfg80211_wext_giwtxpower(struct net_device
*dev
,
895 struct iw_request_info
*info
,
896 union iwreq_data
*data
, char *extra
)
898 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
899 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
902 if ((data
->txpower
.flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
)
904 if (data
->txpower
.flags
& IW_TXPOW_RANGE
)
907 if (!rdev
->ops
->get_tx_power
)
910 err
= rdev
->ops
->get_tx_power(wdev
->wiphy
, &val
);
914 /* well... oh well */
915 data
->txpower
.fixed
= 1;
916 data
->txpower
.disabled
= rfkill_blocked(rdev
->rfkill
);
917 data
->txpower
.value
= val
;
918 data
->txpower
.flags
= IW_TXPOW_DBM
;
922 EXPORT_SYMBOL_GPL(cfg80211_wext_giwtxpower
);
924 static int cfg80211_set_auth_alg(struct wireless_dev
*wdev
,
932 if (auth_alg
& ~(IW_AUTH_ALG_OPEN_SYSTEM
|
933 IW_AUTH_ALG_SHARED_KEY
|
937 if (auth_alg
& IW_AUTH_ALG_OPEN_SYSTEM
) {
939 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_OPEN_SYSTEM
;
942 if (auth_alg
& IW_AUTH_ALG_SHARED_KEY
) {
944 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_SHARED_KEY
;
947 if (auth_alg
& IW_AUTH_ALG_LEAP
) {
949 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_NETWORK_EAP
;
953 wdev
->wext
.connect
.auth_type
= NL80211_AUTHTYPE_AUTOMATIC
;
958 static int cfg80211_set_wpa_version(struct wireless_dev
*wdev
, u32 wpa_versions
)
960 if (wpa_versions
& ~(IW_AUTH_WPA_VERSION_WPA
|
961 IW_AUTH_WPA_VERSION_WPA2
|
962 IW_AUTH_WPA_VERSION_DISABLED
))
965 if ((wpa_versions
& IW_AUTH_WPA_VERSION_DISABLED
) &&
966 (wpa_versions
& (IW_AUTH_WPA_VERSION_WPA
|
967 IW_AUTH_WPA_VERSION_WPA2
)))
970 if (wpa_versions
& IW_AUTH_WPA_VERSION_DISABLED
)
971 wdev
->wext
.connect
.crypto
.wpa_versions
&=
972 ~(NL80211_WPA_VERSION_1
|NL80211_WPA_VERSION_2
);
974 if (wpa_versions
& IW_AUTH_WPA_VERSION_WPA
)
975 wdev
->wext
.connect
.crypto
.wpa_versions
|=
976 NL80211_WPA_VERSION_1
;
978 if (wpa_versions
& IW_AUTH_WPA_VERSION_WPA2
)
979 wdev
->wext
.connect
.crypto
.wpa_versions
|=
980 NL80211_WPA_VERSION_2
;
985 static int cfg80211_set_cipher_group(struct wireless_dev
*wdev
, u32 cipher
)
987 if (cipher
& IW_AUTH_CIPHER_WEP40
)
988 wdev
->wext
.connect
.crypto
.cipher_group
=
989 WLAN_CIPHER_SUITE_WEP40
;
990 else if (cipher
& IW_AUTH_CIPHER_WEP104
)
991 wdev
->wext
.connect
.crypto
.cipher_group
=
992 WLAN_CIPHER_SUITE_WEP104
;
993 else if (cipher
& IW_AUTH_CIPHER_TKIP
)
994 wdev
->wext
.connect
.crypto
.cipher_group
=
995 WLAN_CIPHER_SUITE_TKIP
;
996 else if (cipher
& IW_AUTH_CIPHER_CCMP
)
997 wdev
->wext
.connect
.crypto
.cipher_group
=
998 WLAN_CIPHER_SUITE_CCMP
;
999 else if (cipher
& IW_AUTH_CIPHER_AES_CMAC
)
1000 wdev
->wext
.connect
.crypto
.cipher_group
=
1001 WLAN_CIPHER_SUITE_AES_CMAC
;
1002 else if (cipher
& IW_AUTH_CIPHER_NONE
)
1003 wdev
->wext
.connect
.crypto
.cipher_group
= 0;
1010 static int cfg80211_set_cipher_pairwise(struct wireless_dev
*wdev
, u32 cipher
)
1013 u32
*ciphers_pairwise
= wdev
->wext
.connect
.crypto
.ciphers_pairwise
;
1015 if (cipher
& IW_AUTH_CIPHER_WEP40
) {
1016 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_WEP40
;
1020 if (cipher
& IW_AUTH_CIPHER_WEP104
) {
1021 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_WEP104
;
1025 if (cipher
& IW_AUTH_CIPHER_TKIP
) {
1026 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_TKIP
;
1030 if (cipher
& IW_AUTH_CIPHER_CCMP
) {
1031 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_CCMP
;
1035 if (cipher
& IW_AUTH_CIPHER_AES_CMAC
) {
1036 ciphers_pairwise
[nr_ciphers
] = WLAN_CIPHER_SUITE_AES_CMAC
;
1040 BUILD_BUG_ON(NL80211_MAX_NR_CIPHER_SUITES
< 5);
1042 wdev
->wext
.connect
.crypto
.n_ciphers_pairwise
= nr_ciphers
;
1048 static int cfg80211_set_key_mgt(struct wireless_dev
*wdev
, u32 key_mgt
)
1050 int nr_akm_suites
= 0;
1052 if (key_mgt
& ~(IW_AUTH_KEY_MGMT_802_1X
|
1053 IW_AUTH_KEY_MGMT_PSK
))
1056 if (key_mgt
& IW_AUTH_KEY_MGMT_802_1X
) {
1057 wdev
->wext
.connect
.crypto
.akm_suites
[nr_akm_suites
] =
1058 WLAN_AKM_SUITE_8021X
;
1062 if (key_mgt
& IW_AUTH_KEY_MGMT_PSK
) {
1063 wdev
->wext
.connect
.crypto
.akm_suites
[nr_akm_suites
] =
1068 wdev
->wext
.connect
.crypto
.n_akm_suites
= nr_akm_suites
;
1073 int cfg80211_wext_siwauth(struct net_device
*dev
,
1074 struct iw_request_info
*info
,
1075 struct iw_param
*data
, char *extra
)
1077 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1079 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1082 switch (data
->flags
& IW_AUTH_INDEX
) {
1083 case IW_AUTH_PRIVACY_INVOKED
:
1084 wdev
->wext
.connect
.privacy
= data
->value
;
1086 case IW_AUTH_WPA_VERSION
:
1087 return cfg80211_set_wpa_version(wdev
, data
->value
);
1088 case IW_AUTH_CIPHER_GROUP
:
1089 return cfg80211_set_cipher_group(wdev
, data
->value
);
1090 case IW_AUTH_KEY_MGMT
:
1091 return cfg80211_set_key_mgt(wdev
, data
->value
);
1092 case IW_AUTH_CIPHER_PAIRWISE
:
1093 return cfg80211_set_cipher_pairwise(wdev
, data
->value
);
1094 case IW_AUTH_80211_AUTH_ALG
:
1095 return cfg80211_set_auth_alg(wdev
, data
->value
);
1096 case IW_AUTH_WPA_ENABLED
:
1097 case IW_AUTH_RX_UNENCRYPTED_EAPOL
:
1098 case IW_AUTH_DROP_UNENCRYPTED
:
1105 EXPORT_SYMBOL_GPL(cfg80211_wext_siwauth
);
1107 int cfg80211_wext_giwauth(struct net_device
*dev
,
1108 struct iw_request_info
*info
,
1109 struct iw_param
*data
, char *extra
)
1111 /* XXX: what do we need? */
1115 EXPORT_SYMBOL_GPL(cfg80211_wext_giwauth
);
1117 int cfg80211_wext_siwpower(struct net_device
*dev
,
1118 struct iw_request_info
*info
,
1119 struct iw_param
*wrq
, char *extra
)
1121 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1122 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1124 int timeout
= wdev
->ps_timeout
;
1127 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1130 if (!rdev
->ops
->set_power_mgmt
)
1133 if (wrq
->disabled
) {
1136 switch (wrq
->flags
& IW_POWER_MODE
) {
1137 case IW_POWER_ON
: /* If not specified */
1138 case IW_POWER_MODE
: /* If set all mask */
1139 case IW_POWER_ALL_R
: /* If explicitely state all */
1142 default: /* Otherwise we ignore */
1146 if (wrq
->flags
& ~(IW_POWER_MODE
| IW_POWER_TIMEOUT
))
1149 if (wrq
->flags
& IW_POWER_TIMEOUT
)
1150 timeout
= wrq
->value
/ 1000;
1153 err
= rdev
->ops
->set_power_mgmt(wdev
->wiphy
, dev
, ps
, timeout
);
1158 wdev
->ps_timeout
= timeout
;
1163 EXPORT_SYMBOL_GPL(cfg80211_wext_siwpower
);
1165 int cfg80211_wext_giwpower(struct net_device
*dev
,
1166 struct iw_request_info
*info
,
1167 struct iw_param
*wrq
, char *extra
)
1169 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1171 wrq
->disabled
= !wdev
->ps
;
1175 EXPORT_SYMBOL_GPL(cfg80211_wext_giwpower
);
1177 static int cfg80211_wds_wext_siwap(struct net_device
*dev
,
1178 struct iw_request_info
*info
,
1179 struct sockaddr
*addr
, char *extra
)
1181 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1182 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1185 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_WDS
))
1188 if (addr
->sa_family
!= ARPHRD_ETHER
)
1191 if (netif_running(dev
))
1194 if (!rdev
->ops
->set_wds_peer
)
1197 err
= rdev
->ops
->set_wds_peer(wdev
->wiphy
, dev
, (u8
*) &addr
->sa_data
);
1201 memcpy(&wdev
->wext
.bssid
, (u8
*) &addr
->sa_data
, ETH_ALEN
);
1206 static int cfg80211_wds_wext_giwap(struct net_device
*dev
,
1207 struct iw_request_info
*info
,
1208 struct sockaddr
*addr
, char *extra
)
1210 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1212 if (WARN_ON(wdev
->iftype
!= NL80211_IFTYPE_WDS
))
1215 addr
->sa_family
= ARPHRD_ETHER
;
1216 memcpy(&addr
->sa_data
, wdev
->wext
.bssid
, ETH_ALEN
);
1221 int cfg80211_wext_siwrate(struct net_device
*dev
,
1222 struct iw_request_info
*info
,
1223 struct iw_param
*rate
, char *extra
)
1225 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1226 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1227 struct cfg80211_bitrate_mask mask
;
1229 struct ieee80211_supported_band
*sband
;
1233 if (!rdev
->ops
->set_bitrate_mask
)
1236 memset(&mask
, 0, sizeof(mask
));
1240 if (rate
->value
< 0) {
1242 } else if (rate
->fixed
) {
1243 fixed
= rate
->value
/ 100000;
1245 maxrate
= rate
->value
/ 100000;
1248 for (band
= 0; band
< IEEE80211_NUM_BANDS
; band
++) {
1249 sband
= wdev
->wiphy
->bands
[band
];
1252 for (ridx
= 0; ridx
< sband
->n_bitrates
; ridx
++) {
1253 struct ieee80211_rate
*srate
= &sband
->bitrates
[ridx
];
1254 if (fixed
== srate
->bitrate
) {
1255 mask
.control
[band
].legacy
= 1 << ridx
;
1259 if (srate
->bitrate
<= maxrate
) {
1260 mask
.control
[band
].legacy
|= 1 << ridx
;
1269 return rdev
->ops
->set_bitrate_mask(wdev
->wiphy
, dev
, NULL
, &mask
);
1271 EXPORT_SYMBOL_GPL(cfg80211_wext_siwrate
);
1273 int cfg80211_wext_giwrate(struct net_device
*dev
,
1274 struct iw_request_info
*info
,
1275 struct iw_param
*rate
, char *extra
)
1277 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1278 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1279 /* we are under RTNL - globally locked - so can use a static struct */
1280 static struct station_info sinfo
;
1284 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1287 if (!rdev
->ops
->get_station
)
1292 if (wdev
->current_bss
)
1293 memcpy(addr
, wdev
->current_bss
->pub
.bssid
, ETH_ALEN
);
1300 err
= rdev
->ops
->get_station(&rdev
->wiphy
, dev
, addr
, &sinfo
);
1304 if (!(sinfo
.filled
& STATION_INFO_TX_BITRATE
))
1307 rate
->value
= 100000 * cfg80211_calculate_bitrate(&sinfo
.txrate
);
1311 EXPORT_SYMBOL_GPL(cfg80211_wext_giwrate
);
1313 /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
1314 struct iw_statistics
*cfg80211_wireless_stats(struct net_device
*dev
)
1316 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1317 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1318 /* we are under RTNL - globally locked - so can use static structs */
1319 static struct iw_statistics wstats
;
1320 static struct station_info sinfo
;
1323 if (dev
->ieee80211_ptr
->iftype
!= NL80211_IFTYPE_STATION
)
1326 if (!rdev
->ops
->get_station
)
1329 /* Grab BSSID of current BSS, if any */
1331 if (!wdev
->current_bss
) {
1335 memcpy(bssid
, wdev
->current_bss
->pub
.bssid
, ETH_ALEN
);
1338 if (rdev
->ops
->get_station(&rdev
->wiphy
, dev
, bssid
, &sinfo
))
1341 memset(&wstats
, 0, sizeof(wstats
));
1343 switch (rdev
->wiphy
.signal_type
) {
1344 case CFG80211_SIGNAL_TYPE_MBM
:
1345 if (sinfo
.filled
& STATION_INFO_SIGNAL
) {
1346 int sig
= sinfo
.signal
;
1347 wstats
.qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
1348 wstats
.qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
1349 wstats
.qual
.updated
|= IW_QUAL_DBM
;
1350 wstats
.qual
.level
= sig
;
1355 wstats
.qual
.qual
= sig
+ 110;
1358 case CFG80211_SIGNAL_TYPE_UNSPEC
:
1359 if (sinfo
.filled
& STATION_INFO_SIGNAL
) {
1360 wstats
.qual
.updated
|= IW_QUAL_LEVEL_UPDATED
;
1361 wstats
.qual
.updated
|= IW_QUAL_QUAL_UPDATED
;
1362 wstats
.qual
.level
= sinfo
.signal
;
1363 wstats
.qual
.qual
= sinfo
.signal
;
1367 wstats
.qual
.updated
|= IW_QUAL_LEVEL_INVALID
;
1368 wstats
.qual
.updated
|= IW_QUAL_QUAL_INVALID
;
1371 wstats
.qual
.updated
|= IW_QUAL_NOISE_INVALID
;
1372 if (sinfo
.filled
& STATION_INFO_RX_DROP_MISC
)
1373 wstats
.discard
.misc
= sinfo
.rx_dropped_misc
;
1374 if (sinfo
.filled
& STATION_INFO_TX_FAILED
)
1375 wstats
.discard
.retries
= sinfo
.tx_failed
;
1379 EXPORT_SYMBOL_GPL(cfg80211_wireless_stats
);
1381 int cfg80211_wext_siwap(struct net_device
*dev
,
1382 struct iw_request_info
*info
,
1383 struct sockaddr
*ap_addr
, char *extra
)
1385 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1387 switch (wdev
->iftype
) {
1388 case NL80211_IFTYPE_ADHOC
:
1389 return cfg80211_ibss_wext_siwap(dev
, info
, ap_addr
, extra
);
1390 case NL80211_IFTYPE_STATION
:
1391 return cfg80211_mgd_wext_siwap(dev
, info
, ap_addr
, extra
);
1392 case NL80211_IFTYPE_WDS
:
1393 return cfg80211_wds_wext_siwap(dev
, info
, ap_addr
, extra
);
1398 EXPORT_SYMBOL_GPL(cfg80211_wext_siwap
);
1400 int cfg80211_wext_giwap(struct net_device
*dev
,
1401 struct iw_request_info
*info
,
1402 struct sockaddr
*ap_addr
, char *extra
)
1404 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1406 switch (wdev
->iftype
) {
1407 case NL80211_IFTYPE_ADHOC
:
1408 return cfg80211_ibss_wext_giwap(dev
, info
, ap_addr
, extra
);
1409 case NL80211_IFTYPE_STATION
:
1410 return cfg80211_mgd_wext_giwap(dev
, info
, ap_addr
, extra
);
1411 case NL80211_IFTYPE_WDS
:
1412 return cfg80211_wds_wext_giwap(dev
, info
, ap_addr
, extra
);
1417 EXPORT_SYMBOL_GPL(cfg80211_wext_giwap
);
1419 int cfg80211_wext_siwessid(struct net_device
*dev
,
1420 struct iw_request_info
*info
,
1421 struct iw_point
*data
, char *ssid
)
1423 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1425 switch (wdev
->iftype
) {
1426 case NL80211_IFTYPE_ADHOC
:
1427 return cfg80211_ibss_wext_siwessid(dev
, info
, data
, ssid
);
1428 case NL80211_IFTYPE_STATION
:
1429 return cfg80211_mgd_wext_siwessid(dev
, info
, data
, ssid
);
1434 EXPORT_SYMBOL_GPL(cfg80211_wext_siwessid
);
1436 int cfg80211_wext_giwessid(struct net_device
*dev
,
1437 struct iw_request_info
*info
,
1438 struct iw_point
*data
, char *ssid
)
1440 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1445 switch (wdev
->iftype
) {
1446 case NL80211_IFTYPE_ADHOC
:
1447 return cfg80211_ibss_wext_giwessid(dev
, info
, data
, ssid
);
1448 case NL80211_IFTYPE_STATION
:
1449 return cfg80211_mgd_wext_giwessid(dev
, info
, data
, ssid
);
1454 EXPORT_SYMBOL_GPL(cfg80211_wext_giwessid
);
1456 int cfg80211_wext_siwpmksa(struct net_device
*dev
,
1457 struct iw_request_info
*info
,
1458 struct iw_point
*data
, char *extra
)
1460 struct wireless_dev
*wdev
= dev
->ieee80211_ptr
;
1461 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wdev
->wiphy
);
1462 struct cfg80211_pmksa cfg_pmksa
;
1463 struct iw_pmksa
*pmksa
= (struct iw_pmksa
*)extra
;
1465 memset(&cfg_pmksa
, 0, sizeof(struct cfg80211_pmksa
));
1467 if (wdev
->iftype
!= NL80211_IFTYPE_STATION
)
1470 cfg_pmksa
.bssid
= pmksa
->bssid
.sa_data
;
1471 cfg_pmksa
.pmkid
= pmksa
->pmkid
;
1473 switch (pmksa
->cmd
) {
1475 if (!rdev
->ops
->set_pmksa
)
1478 return rdev
->ops
->set_pmksa(&rdev
->wiphy
, dev
, &cfg_pmksa
);
1480 case IW_PMKSA_REMOVE
:
1481 if (!rdev
->ops
->del_pmksa
)
1484 return rdev
->ops
->del_pmksa(&rdev
->wiphy
, dev
, &cfg_pmksa
);
1486 case IW_PMKSA_FLUSH
:
1487 if (!rdev
->ops
->flush_pmksa
)
1490 return rdev
->ops
->flush_pmksa(&rdev
->wiphy
, dev
);
1496 EXPORT_SYMBOL_GPL(cfg80211_wext_siwpmksa
);
1498 static const iw_handler cfg80211_handlers
[] = {
1499 [IW_IOCTL_IDX(SIOCGIWNAME
)] = (iw_handler
) cfg80211_wext_giwname
,
1500 [IW_IOCTL_IDX(SIOCSIWFREQ
)] = (iw_handler
) cfg80211_wext_siwfreq
,
1501 [IW_IOCTL_IDX(SIOCGIWFREQ
)] = (iw_handler
) cfg80211_wext_giwfreq
,
1502 [IW_IOCTL_IDX(SIOCSIWMODE
)] = (iw_handler
) cfg80211_wext_siwmode
,
1503 [IW_IOCTL_IDX(SIOCGIWMODE
)] = (iw_handler
) cfg80211_wext_giwmode
,
1504 [IW_IOCTL_IDX(SIOCGIWRANGE
)] = (iw_handler
) cfg80211_wext_giwrange
,
1505 [IW_IOCTL_IDX(SIOCSIWAP
)] = (iw_handler
) cfg80211_wext_siwap
,
1506 [IW_IOCTL_IDX(SIOCGIWAP
)] = (iw_handler
) cfg80211_wext_giwap
,
1507 [IW_IOCTL_IDX(SIOCSIWMLME
)] = (iw_handler
) cfg80211_wext_siwmlme
,
1508 [IW_IOCTL_IDX(SIOCSIWSCAN
)] = (iw_handler
) cfg80211_wext_siwscan
,
1509 [IW_IOCTL_IDX(SIOCGIWSCAN
)] = (iw_handler
) cfg80211_wext_giwscan
,
1510 [IW_IOCTL_IDX(SIOCSIWESSID
)] = (iw_handler
) cfg80211_wext_siwessid
,
1511 [IW_IOCTL_IDX(SIOCGIWESSID
)] = (iw_handler
) cfg80211_wext_giwessid
,
1512 [IW_IOCTL_IDX(SIOCSIWRATE
)] = (iw_handler
) cfg80211_wext_siwrate
,
1513 [IW_IOCTL_IDX(SIOCGIWRATE
)] = (iw_handler
) cfg80211_wext_giwrate
,
1514 [IW_IOCTL_IDX(SIOCSIWRTS
)] = (iw_handler
) cfg80211_wext_siwrts
,
1515 [IW_IOCTL_IDX(SIOCGIWRTS
)] = (iw_handler
) cfg80211_wext_giwrts
,
1516 [IW_IOCTL_IDX(SIOCSIWFRAG
)] = (iw_handler
) cfg80211_wext_siwfrag
,
1517 [IW_IOCTL_IDX(SIOCGIWFRAG
)] = (iw_handler
) cfg80211_wext_giwfrag
,
1518 [IW_IOCTL_IDX(SIOCSIWTXPOW
)] = (iw_handler
) cfg80211_wext_siwtxpower
,
1519 [IW_IOCTL_IDX(SIOCGIWTXPOW
)] = (iw_handler
) cfg80211_wext_giwtxpower
,
1520 [IW_IOCTL_IDX(SIOCSIWRETRY
)] = (iw_handler
) cfg80211_wext_siwretry
,
1521 [IW_IOCTL_IDX(SIOCGIWRETRY
)] = (iw_handler
) cfg80211_wext_giwretry
,
1522 [IW_IOCTL_IDX(SIOCSIWENCODE
)] = (iw_handler
) cfg80211_wext_siwencode
,
1523 [IW_IOCTL_IDX(SIOCGIWENCODE
)] = (iw_handler
) cfg80211_wext_giwencode
,
1524 [IW_IOCTL_IDX(SIOCSIWPOWER
)] = (iw_handler
) cfg80211_wext_siwpower
,
1525 [IW_IOCTL_IDX(SIOCGIWPOWER
)] = (iw_handler
) cfg80211_wext_giwpower
,
1526 [IW_IOCTL_IDX(SIOCSIWGENIE
)] = (iw_handler
) cfg80211_wext_siwgenie
,
1527 [IW_IOCTL_IDX(SIOCSIWAUTH
)] = (iw_handler
) cfg80211_wext_siwauth
,
1528 [IW_IOCTL_IDX(SIOCGIWAUTH
)] = (iw_handler
) cfg80211_wext_giwauth
,
1529 [IW_IOCTL_IDX(SIOCSIWENCODEEXT
)]= (iw_handler
) cfg80211_wext_siwencodeext
,
1530 [IW_IOCTL_IDX(SIOCSIWPMKSA
)] = (iw_handler
) cfg80211_wext_siwpmksa
,
1533 const struct iw_handler_def cfg80211_wext_handler
= {
1534 .num_standard
= ARRAY_SIZE(cfg80211_handlers
),
1535 .standard
= cfg80211_handlers
,
1536 .get_wireless_stats
= cfg80211_wireless_stats
,