1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright(c) 2004 Intel Corporation. All rights reserved.
5 * Portions of this file are based on the WEP enablement code provided by the
6 * Host AP project hostap-drivers v0.1.3
7 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
9 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
11 * Contact Information:
12 * James P. Ketrenos <ipw2100-admin@linux.intel.com>
13 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
15 #include <linux/wireless.h>
16 #include <linux/kmod.h>
17 #include <linux/module.h>
18 #include <linux/etherdevice.h>
24 static struct modes_unit rtllib_modes[] = {
33 #define MAX_CUSTOM_LEN 64
34 static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
35 char *start, char *stop,
36 struct rtllib_network *network,
37 struct iw_request_info *info)
39 char custom[MAX_CUSTOM_LEN];
40 char proto_name[IFNAMSIZ];
41 char *pname = proto_name;
46 static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};
48 /* First entry *MUST* be the AP MAC address */
50 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
51 ether_addr_copy(iwe.u.ap_addr.sa_data, network->bssid);
52 start = iwe_stream_add_event_rsl(info, start, stop,
53 &iwe, IW_EV_ADDR_LEN);
54 /* Remaining entries will be displayed in the order we provide them */
57 iwe.cmd = SIOCGIWESSID;
59 if (network->ssid_len > 0) {
60 iwe.u.data.length = min_t(u8, network->ssid_len, 32);
61 start = iwe_stream_add_point_rsl(info, start, stop, &iwe,
63 } else if (network->hidden_ssid_len == 0) {
64 iwe.u.data.length = sizeof("<hidden>");
65 start = iwe_stream_add_point_rsl(info, start, stop,
68 iwe.u.data.length = min_t(u8, network->hidden_ssid_len, 32);
69 start = iwe_stream_add_point_rsl(info, start, stop, &iwe,
70 network->hidden_ssid);
72 /* Add the protocol name */
73 iwe.cmd = SIOCGIWNAME;
74 for (i = 0; i < ARRAY_SIZE(rtllib_modes); i++) {
75 if (network->mode&(1<<i)) {
76 sprintf(pname, rtllib_modes[i].mode_string,
77 rtllib_modes[i].mode_size);
78 pname += rtllib_modes[i].mode_size;
82 snprintf(iwe.u.name, IFNAMSIZ, "IEEE802.11%s", proto_name);
83 start = iwe_stream_add_event_rsl(info, start, stop,
84 &iwe, IW_EV_CHAR_LEN);
86 iwe.cmd = SIOCGIWMODE;
87 if (network->capability &
88 (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) {
89 if (network->capability & WLAN_CAPABILITY_ESS)
90 iwe.u.mode = IW_MODE_MASTER;
92 iwe.u.mode = IW_MODE_ADHOC;
93 start = iwe_stream_add_event_rsl(info, start, stop,
94 &iwe, IW_EV_UINT_LEN);
97 /* Add frequency/channel */
98 iwe.cmd = SIOCGIWFREQ;
99 iwe.u.freq.m = network->channel;
102 start = iwe_stream_add_event_rsl(info, start, stop, &iwe,
105 /* Add encryption capability */
106 iwe.cmd = SIOCGIWENCODE;
107 if (network->capability & WLAN_CAPABILITY_PRIVACY)
108 iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
110 iwe.u.data.flags = IW_ENCODE_DISABLED;
111 iwe.u.data.length = 0;
112 start = iwe_stream_add_point_rsl(info, start, stop,
113 &iwe, network->ssid);
114 /* Add basic and extended rates */
117 p += scnprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): ");
118 for (i = 0, j = 0; i < network->rates_len;) {
119 if (j < network->rates_ex_len &&
120 ((network->rates_ex[j] & 0x7F) <
121 (network->rates[i] & 0x7F)))
122 rate = network->rates_ex[j++] & 0x7F;
124 rate = network->rates[i++] & 0x7F;
127 p += scnprintf(p, MAX_CUSTOM_LEN - (p - custom),
128 "%d%s ", rate >> 1, (rate & 1) ? ".5" : "");
130 for (; j < network->rates_ex_len; j++) {
131 rate = network->rates_ex[j] & 0x7F;
132 p += scnprintf(p, MAX_CUSTOM_LEN - (p - custom),
133 "%d%s ", rate >> 1, (rate & 1) ? ".5" : "");
138 if (network->mode >= IEEE_N_24G) {
139 struct ht_capab_ele *ht_cap = NULL;
140 bool is40M = false, isShortGI = false;
143 if (!memcmp(network->bssht.bdHTCapBuf, EWC11NHTCap, 4))
144 ht_cap = (struct ht_capab_ele *)
145 &network->bssht.bdHTCapBuf[4];
147 ht_cap = (struct ht_capab_ele *)
148 &network->bssht.bdHTCapBuf[0];
149 is40M = (ht_cap->ChlWidth) ? 1 : 0;
150 isShortGI = (ht_cap->ChlWidth) ?
151 ((ht_cap->ShortGI40Mhz) ? 1 : 0) :
152 ((ht_cap->ShortGI20Mhz) ? 1 : 0);
154 max_mcs = HTGetHighestMCSRate(ieee, ht_cap->MCS,
156 rate = MCS_DATA_RATE[is40M][isShortGI][max_mcs & 0x7f];
160 iwe.cmd = SIOCGIWRATE;
161 iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
162 iwe.u.bitrate.value = max_rate * 500000;
163 start = iwe_stream_add_event_rsl(info, start, stop, &iwe,
165 iwe.cmd = IWEVCUSTOM;
166 iwe.u.data.length = p - custom;
167 if (iwe.u.data.length)
168 start = iwe_stream_add_point_rsl(info, start, stop,
170 /* Add quality statistics */
171 /* TODO: Fix these values... */
173 iwe.u.qual.qual = network->stats.signal;
174 iwe.u.qual.level = network->stats.rssi;
175 iwe.u.qual.noise = network->stats.noise;
176 iwe.u.qual.updated = network->stats.mask & RTLLIB_STATMASK_WEMASK;
177 if (!(network->stats.mask & RTLLIB_STATMASK_RSSI))
178 iwe.u.qual.updated |= IW_QUAL_LEVEL_INVALID;
179 if (!(network->stats.mask & RTLLIB_STATMASK_NOISE))
180 iwe.u.qual.updated |= IW_QUAL_NOISE_INVALID;
181 if (!(network->stats.mask & RTLLIB_STATMASK_SIGNAL))
182 iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID;
183 iwe.u.qual.updated = 7;
184 start = iwe_stream_add_event_rsl(info, start, stop, &iwe,
187 iwe.cmd = IWEVCUSTOM;
189 iwe.u.data.length = p - custom;
190 if (iwe.u.data.length)
191 start = iwe_stream_add_point_rsl(info, start, stop,
194 memset(&iwe, 0, sizeof(iwe));
195 if (network->wpa_ie_len) {
196 char buf[MAX_WPA_IE_LEN];
198 memcpy(buf, network->wpa_ie, network->wpa_ie_len);
200 iwe.u.data.length = network->wpa_ie_len;
201 start = iwe_stream_add_point_rsl(info, start, stop, &iwe, buf);
203 memset(&iwe, 0, sizeof(iwe));
204 if (network->rsn_ie_len) {
205 char buf[MAX_WPA_IE_LEN];
207 memcpy(buf, network->rsn_ie, network->rsn_ie_len);
209 iwe.u.data.length = network->rsn_ie_len;
210 start = iwe_stream_add_point_rsl(info, start, stop, &iwe, buf);
213 /* add info for WZC */
214 memset(&iwe, 0, sizeof(iwe));
215 if (network->wzc_ie_len) {
216 char buf[MAX_WZC_IE_LEN];
218 memcpy(buf, network->wzc_ie, network->wzc_ie_len);
220 iwe.u.data.length = network->wzc_ie_len;
221 start = iwe_stream_add_point_rsl(info, start, stop, &iwe, buf);
224 /* Add EXTRA: Age to display seconds since last beacon/probe response
227 iwe.cmd = IWEVCUSTOM;
229 p += scnprintf(p, MAX_CUSTOM_LEN - (p - custom),
230 " Last beacon: %lums ago",
231 (jiffies - network->last_scanned) / (HZ / 100));
232 iwe.u.data.length = p - custom;
233 if (iwe.u.data.length)
234 start = iwe_stream_add_point_rsl(info, start, stop,
240 int rtllib_wx_get_scan(struct rtllib_device *ieee,
241 struct iw_request_info *info,
242 union iwreq_data *wrqu, char *extra)
244 struct rtllib_network *network;
248 char *stop = ev + wrqu->data.length;
252 netdev_dbg(ieee->dev, "Getting scan\n");
253 mutex_lock(&ieee->wx_mutex);
254 spin_lock_irqsave(&ieee->lock, flags);
256 list_for_each_entry(network, &ieee->network_list, list) {
258 if ((stop - ev) < 200) {
262 if (ieee->scan_age == 0 ||
263 time_after(network->last_scanned + ieee->scan_age, jiffies))
264 ev = rtl819x_translate_scan(ieee, ev, stop, network,
267 netdev_dbg(ieee->dev,
268 "Network '%s ( %pM)' hidden due to age (%lums).\n",
269 escape_essid(network->ssid,
272 (jiffies - network->last_scanned) /
276 spin_unlock_irqrestore(&ieee->lock, flags);
277 mutex_unlock(&ieee->wx_mutex);
278 wrqu->data.length = ev - extra;
279 wrqu->data.flags = 0;
281 netdev_dbg(ieee->dev, "%s(): %d networks returned.\n", __func__, i);
285 EXPORT_SYMBOL(rtllib_wx_get_scan);
287 int rtllib_wx_set_encode(struct rtllib_device *ieee,
288 struct iw_request_info *info,
289 union iwreq_data *wrqu, char *keybuf)
291 struct iw_point *erq = &(wrqu->encoding);
292 struct net_device *dev = ieee->dev;
293 struct rtllib_security sec = {
296 int i, key, key_provided, len;
297 struct lib80211_crypt_data **crypt;
299 netdev_dbg(ieee->dev, "%s()\n", __func__);
301 key = erq->flags & IW_ENCODE_INDEX;
303 if (key > NUM_WEP_KEYS)
309 key = ieee->crypt_info.tx_keyidx;
312 netdev_dbg(ieee->dev, "Key: %d [%s]\n", key, key_provided ?
313 "provided" : "default");
314 crypt = &ieee->crypt_info.crypt[key];
315 if (erq->flags & IW_ENCODE_DISABLED) {
316 if (key_provided && *crypt) {
317 netdev_dbg(ieee->dev,
318 "Disabling encryption on key %d.\n", key);
319 lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt);
321 netdev_dbg(ieee->dev, "Disabling encryption.\n");
323 /* Check all the keys to see if any are still configured,
324 * and if no key index was provided, de-init them all
326 for (i = 0; i < NUM_WEP_KEYS; i++) {
327 if (ieee->crypt_info.crypt[i] != NULL) {
330 lib80211_crypt_delayed_deinit(&ieee->crypt_info,
331 &ieee->crypt_info.crypt[i]);
335 if (i == NUM_WEP_KEYS) {
337 sec.level = SEC_LEVEL_0;
338 sec.flags |= SEC_ENABLED | SEC_LEVEL;
347 sec.flags |= SEC_ENABLED;
349 if (*crypt != NULL && (*crypt)->ops != NULL &&
350 strcmp((*crypt)->ops->name, "R-WEP") != 0) {
351 /* changing to use WEP; deinit previously used algorithm
354 lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt);
357 if (*crypt == NULL) {
358 struct lib80211_crypt_data *new_crypt;
360 /* take WEP into use */
361 new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
362 if (new_crypt == NULL)
364 new_crypt->ops = lib80211_get_crypto_ops("R-WEP");
365 if (!new_crypt->ops) {
366 request_module("rtllib_crypt_wep");
367 new_crypt->ops = lib80211_get_crypto_ops("R-WEP");
371 new_crypt->priv = new_crypt->ops->init(key);
373 if (!new_crypt->ops || !new_crypt->priv) {
378 "%s: could not initialize WEP: load module rtllib_crypt_wep\n",
385 /* If a new key was provided, set it up */
386 if (erq->length > 0) {
387 len = erq->length <= 5 ? 5 : 13;
388 memcpy(sec.keys[key], keybuf, erq->length);
389 if (len > erq->length)
390 memset(sec.keys[key] + erq->length, 0,
392 netdev_dbg(ieee->dev, "Setting key %d to '%s' (%d:%d bytes)\n",
393 key, escape_essid(sec.keys[key], len), erq->length,
395 sec.key_sizes[key] = len;
396 (*crypt)->ops->set_key(sec.keys[key], len, NULL,
398 sec.flags |= (1 << key);
399 /* This ensures a key will be activated if no key is
402 if (key == sec.active_key)
403 sec.flags |= SEC_ACTIVE_KEY;
404 ieee->crypt_info.tx_keyidx = key;
407 len = (*crypt)->ops->get_key(sec.keys[key], WEP_KEY_LEN,
408 NULL, (*crypt)->priv);
410 /* Set a default key of all 0 */
411 netdev_info(ieee->dev, "Setting key %d to all zero.\n",
414 memset(sec.keys[key], 0, 13);
415 (*crypt)->ops->set_key(sec.keys[key], 13, NULL,
417 sec.key_sizes[key] = 13;
418 sec.flags |= (1 << key);
421 /* No key data - just set the default TX key index */
423 netdev_dbg(ieee->dev,
424 "Setting key %d as default Tx key.\n", key);
425 ieee->crypt_info.tx_keyidx = key;
426 sec.active_key = key;
427 sec.flags |= SEC_ACTIVE_KEY;
431 ieee->open_wep = !(erq->flags & IW_ENCODE_RESTRICTED);
432 ieee->auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN :
433 WLAN_AUTH_SHARED_KEY;
434 sec.auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
435 sec.flags |= SEC_AUTH_MODE;
436 netdev_dbg(ieee->dev, "Auth: %s\n", sec.auth_mode == WLAN_AUTH_OPEN ?
437 "OPEN" : "SHARED KEY");
439 /* For now we just support WEP, so only set that security level...
440 * TODO: When WPA is added this is one place that needs to change
442 sec.flags |= SEC_LEVEL;
443 sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */
445 if (ieee->set_security)
446 ieee->set_security(dev, &sec);
448 /* Do not reset port if card is in Managed mode since resetting will
449 * generate new IEEE 802.11 authentication which may end up in looping
450 * with IEEE 802.1X. If your hardware requires a reset after WEP
451 * configuration (for example... Prism2), implement the reset_port in
452 * the callbacks structures used to initialize the 802.11 stack.
454 if (ieee->reset_on_keychange &&
455 ieee->iw_mode != IW_MODE_INFRA &&
456 ieee->reset_port && ieee->reset_port(dev)) {
457 netdev_dbg(dev, "%s: reset_port failed\n", dev->name);
462 EXPORT_SYMBOL(rtllib_wx_set_encode);
464 int rtllib_wx_get_encode(struct rtllib_device *ieee,
465 struct iw_request_info *info,
466 union iwreq_data *wrqu, char *keybuf)
468 struct iw_point *erq = &(wrqu->encoding);
470 struct lib80211_crypt_data *crypt;
472 netdev_dbg(ieee->dev, "%s()\n", __func__);
474 if (ieee->iw_mode == IW_MODE_MONITOR)
477 key = erq->flags & IW_ENCODE_INDEX;
479 if (key > NUM_WEP_KEYS)
483 key = ieee->crypt_info.tx_keyidx;
485 crypt = ieee->crypt_info.crypt[key];
487 erq->flags = key + 1;
489 if (crypt == NULL || crypt->ops == NULL) {
491 erq->flags |= IW_ENCODE_DISABLED;
494 len = crypt->ops->get_key(keybuf, SCM_KEY_LEN, NULL, crypt->priv);
496 erq->length = max(len, 0);
498 erq->flags |= IW_ENCODE_ENABLED;
501 erq->flags |= IW_ENCODE_OPEN;
503 erq->flags |= IW_ENCODE_RESTRICTED;
507 EXPORT_SYMBOL(rtllib_wx_get_encode);
509 int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
510 struct iw_request_info *info,
511 union iwreq_data *wrqu, char *extra)
514 struct net_device *dev = ieee->dev;
515 struct iw_point *encoding = &wrqu->encoding;
516 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
519 const char *alg, *module;
520 struct lib80211_crypto_ops *ops;
521 struct lib80211_crypt_data **crypt;
523 struct rtllib_security sec = {
526 idx = encoding->flags & IW_ENCODE_INDEX;
528 if (idx < 1 || idx > NUM_WEP_KEYS)
532 idx = ieee->crypt_info.tx_keyidx;
534 if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
535 crypt = &ieee->crypt_info.crypt[idx];
538 /* some Cisco APs use idx>0 for unicast in dynamic WEP */
539 if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP)
541 if (ieee->iw_mode == IW_MODE_INFRA)
542 crypt = &ieee->crypt_info.crypt[idx];
547 sec.flags |= SEC_ENABLED;
548 if ((encoding->flags & IW_ENCODE_DISABLED) ||
549 ext->alg == IW_ENCODE_ALG_NONE) {
551 lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt);
553 for (i = 0; i < NUM_WEP_KEYS; i++) {
554 if (ieee->crypt_info.crypt[i] != NULL)
557 if (i == NUM_WEP_KEYS) {
559 sec.level = SEC_LEVEL_0;
560 sec.flags |= SEC_LEVEL;
567 case IW_ENCODE_ALG_WEP:
569 module = "rtllib_crypt_wep";
571 case IW_ENCODE_ALG_TKIP:
573 module = "rtllib_crypt_tkip";
575 case IW_ENCODE_ALG_CCMP:
577 module = "rtllib_crypt_ccmp";
580 netdev_dbg(ieee->dev, "Unknown crypto alg %d\n", ext->alg);
584 netdev_dbg(dev, "alg name:%s\n", alg);
586 ops = lib80211_get_crypto_ops(alg);
590 memset(tempbuf, 0x00, 100);
591 sprintf(tempbuf, "%s", module);
592 request_module("%s", tempbuf);
593 ops = lib80211_get_crypto_ops(alg);
596 netdev_info(dev, "========>unknown crypto alg %d\n", ext->alg);
601 if (*crypt == NULL || (*crypt)->ops != ops) {
602 struct lib80211_crypt_data *new_crypt;
604 lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt);
606 new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
607 if (new_crypt == NULL) {
611 new_crypt->ops = ops;
612 if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
613 new_crypt->priv = new_crypt->ops->init(idx);
615 if (new_crypt->priv == NULL) {
624 if (ext->key_len > 0 && (*crypt)->ops->set_key &&
625 (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq,
626 (*crypt)->priv) < 0) {
627 netdev_info(dev, "key setting failed\n");
631 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
632 ieee->crypt_info.tx_keyidx = idx;
633 sec.active_key = idx;
634 sec.flags |= SEC_ACTIVE_KEY;
636 if (ext->alg != IW_ENCODE_ALG_NONE) {
637 sec.key_sizes[idx] = ext->key_len;
638 sec.flags |= (1 << idx);
639 if (ext->alg == IW_ENCODE_ALG_WEP) {
640 sec.flags |= SEC_LEVEL;
641 sec.level = SEC_LEVEL_1;
642 } else if (ext->alg == IW_ENCODE_ALG_TKIP) {
643 sec.flags |= SEC_LEVEL;
644 sec.level = SEC_LEVEL_2;
645 } else if (ext->alg == IW_ENCODE_ALG_CCMP) {
646 sec.flags |= SEC_LEVEL;
647 sec.level = SEC_LEVEL_3;
649 /* Don't set sec level for group keys. */
651 sec.flags &= ~SEC_LEVEL;
654 if (ieee->set_security)
655 ieee->set_security(ieee->dev, &sec);
657 if (ieee->reset_on_keychange &&
658 ieee->iw_mode != IW_MODE_INFRA &&
659 ieee->reset_port && ieee->reset_port(dev)) {
660 netdev_dbg(ieee->dev, "Port reset failed\n");
665 EXPORT_SYMBOL(rtllib_wx_set_encode_ext);
667 int rtllib_wx_set_mlme(struct rtllib_device *ieee,
668 struct iw_request_info *info,
669 union iwreq_data *wrqu, char *extra)
673 struct iw_mlme *mlme = (struct iw_mlme *) extra;
675 if (ieee->state != RTLLIB_LINKED)
678 mutex_lock(&ieee->wx_mutex);
684 case IW_MLME_DISASSOC:
686 netdev_info(ieee->dev, "disauth packet !\n");
688 netdev_info(ieee->dev, "dis associate packet!\n");
690 ieee->cannot_notify = true;
692 SendDisassociation(ieee, deauth, mlme->reason_code);
693 rtllib_disassociate(ieee);
696 for (i = 0; i < 6; i++)
697 ieee->current_network.bssid[i] = 0x55;
700 ieee->current_network.ssid[0] = '\0';
701 ieee->current_network.ssid_len = 0;
704 mutex_unlock(&ieee->wx_mutex);
708 mutex_unlock(&ieee->wx_mutex);
712 EXPORT_SYMBOL(rtllib_wx_set_mlme);
714 int rtllib_wx_set_auth(struct rtllib_device *ieee,
715 struct iw_request_info *info,
716 struct iw_param *data, char *extra)
718 switch (data->flags & IW_AUTH_INDEX) {
719 case IW_AUTH_WPA_VERSION:
721 case IW_AUTH_CIPHER_PAIRWISE:
722 case IW_AUTH_CIPHER_GROUP:
723 case IW_AUTH_KEY_MGMT:
724 /* Host AP driver does not use these parameters and allows
725 * wpa_supplicant to control them internally.
728 case IW_AUTH_TKIP_COUNTERMEASURES:
729 ieee->tkip_countermeasures = data->value;
731 case IW_AUTH_DROP_UNENCRYPTED:
732 ieee->drop_unencrypted = data->value;
735 case IW_AUTH_80211_AUTH_ALG:
736 if (data->value & IW_AUTH_ALG_SHARED_KEY) {
739 } else if (data->value & IW_AUTH_ALG_OPEN_SYSTEM) {
742 } else if (data->value & IW_AUTH_ALG_LEAP) {
749 case IW_AUTH_WPA_ENABLED:
750 ieee->wpa_enabled = (data->value) ? 1 : 0;
753 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
754 ieee->ieee802_1x = data->value;
756 case IW_AUTH_PRIVACY_INVOKED:
757 ieee->privacy_invoked = data->value;
764 EXPORT_SYMBOL(rtllib_wx_set_auth);
766 int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len)
769 u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};
771 if (len > MAX_WPA_IE_LEN || (len && ie == NULL))
776 if ((eid == MFIE_TYPE_GENERIC) && (!memcmp(&ie[2],
779 ieee->wps_ie_len = min_t(size_t, len, MAX_WZC_IE_LEN);
780 buf = kmemdup(ie, ieee->wps_ie_len, GFP_KERNEL);
787 ieee->wps_ie_len = 0;
793 buf = kmemdup(ie, len, GFP_KERNEL);
798 ieee->wpa_ie_len = len;
802 ieee->wpa_ie_len = 0;
806 EXPORT_SYMBOL(rtllib_wx_set_gen_ie);