32 #include <linux/wireless.h>
34 #include <linux/module.h>
50 #define MAX_CUSTOM_LEN 64
51 static inline char *rtl819x_translate_scan(
struct rtllib_device *ieee,
58 char *pname = proto_name;
63 static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};
81 iwe.
u.
data.length =
sizeof(
"<hidden>");
91 for (i = 0; i <
ARRAY_SIZE(rtllib_modes); i++) {
92 if (network->
mode&(1<<i)) {
93 sprintf(pname, rtllib_modes[i].mode_string,
94 rtllib_modes[i].mode_size);
130 iwe.
u.
data.length = 0;
132 &iwe, network->
ssid);
137 for (i = 0, j = 0; i < network->
rates_len;) {
138 if (j < network->rates_ex_len &&
140 (network->
rates[i] & 0x7F)))
141 rate = network->
rates_ex[j++] & 0x7F;
143 rate = network->
rates[i++] & 0x7F;
147 "%d%s ", rate >> 1, (rate & 1) ?
".5" :
"");
152 "%d%s ", rate >> 1, (rate & 1) ?
".5" :
"");
159 bool is40M =
false, isShortGI =
false;
161 if (!
memcmp(network->
bssht.bdHTCapBuf, EWC11NHTCap, 4))
163 &network->
bssht.bdHTCapBuf[4];
166 &network->
bssht.bdHTCapBuf[0];
180 iwe.
u.
bitrate.value = max_rate * 500000;
185 if (iwe.
u.
data.length)
201 iwe.
u.
qual.updated = 7;
208 if (iwe.
u.
data.length)
212 memset(&iwe, 0,
sizeof(iwe));
220 memset(&iwe, 0,
sizeof(iwe));
230 memset(&iwe, 0,
sizeof(iwe));
244 " Last beacon: %lums ago",
247 if (iwe.
u.
data.length)
262 char *
stop = ev + wrqu->
data.length;
271 if ((stop - ev) < 200) {
277 ev = rtl819x_translate_scan(ieee, ev, stop, network,
281 " %pM)' due to age (%lums).\n",
282 escape_essid(network->
ssid,
288 spin_unlock_irqrestore(&ieee->
lock, flags);
291 wrqu->
data.flags = 0;
325 "provided" :
"default");
328 if (key_provided && *crypt) {
346 if (i == NUM_WEP_KEYS) {
360 if (*crypt !=
NULL && (*crypt)->ops !=
NULL &&
361 strcmp((*crypt)->ops->name,
"R-WEP") != 0) {
367 if (*crypt ==
NULL) {
373 if (new_crypt ==
NULL)
376 if (!new_crypt->
ops) {
377 request_module(
"rtllib_crypt_wep");
382 new_crypt->
priv = new_crypt->
ops->init(key);
384 if (!new_crypt->
ops || !new_crypt->
priv) {
389 "load module rtllib_crypt_wep\n",
398 len = erq->
length <= 5 ? 5 : 13;
404 key, escape_essid(sec.
keys[key], len),
407 (*crypt)->ops->set_key(sec.
keys[key], len,
NULL,
418 NULL, (*crypt)->priv);
427 (*crypt)->ops->set_key(sec.
keys[key], 13,
NULL,
436 "Setting key %d to default Tx key.\n", key);
449 "OPEN" :
"SHARED KEY");
497 erq->
flags = key + 1;
505 erq->
length = (len >= 0 ? len : 0);
566 if (i == NUM_WEP_KEYS) {
578 module =
"rtllib_crypt_wep";
582 module =
"rtllib_crypt_tkip";
586 module =
"rtllib_crypt_ccmp";
600 memset(tempbuf, 0x00, 100);
601 sprintf(tempbuf,
"%s", module);
602 request_module(
"%s", tempbuf);
613 if (*crypt ==
NULL || (*crypt)->ops != ops) {
618 new_crypt = kzalloc(
sizeof(*new_crypt),
GFP_KERNEL);
619 if (new_crypt ==
NULL) {
625 new_crypt->
priv = new_crypt->
ops->init(idx);
636 if (ext->
key_len > 0 && (*crypt)->ops->set_key &&
638 (*crypt)->priv) < 0) {
687 int idx, max_key_len;
689 max_key_len = encoding->
length -
sizeof(*ext);
708 encoding->
flags = idx + 1;
709 memset(ext, 0,
sizeof(*ext));
716 if (
strcmp(crypt->
ops->name,
"R-WEP") == 0)
718 else if (
strcmp(crypt->
ops->name,
"R-TKIP"))
720 else if (
strcmp(crypt->
ops->name,
"R-CCMP"))
767 for (i = 0; i < 6; i++)
841 u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};