32 #include <linux/wireless.h>
34 #include <linux/slab.h>
35 #include <linux/module.h>
51 #define iwe_stream_add_event_rsl iwe_stream_add_event
53 #define MAX_CUSTOM_LEN 64
61 char *pname = proto_name;
66 static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};
80 iwe.
u.
data.length =
sizeof(
"<hidden>");
81 start = iwe_stream_add_point(info, start, stop, &iwe,
"<hidden>");
84 start = iwe_stream_add_point(info, start, stop, &iwe, network->
ssid);
89 if(network->
mode&(1<<i)) {
90 sprintf(pname,ieee80211_modes[i].mode_string,ieee80211_modes[i].mode_size);
122 iwe.
u.
data.length = 0;
123 start = iwe_stream_add_point(info, start, stop, &iwe, network->
ssid);
128 for (i = 0, j = 0; i < network->
rates_len; ) {
129 if (j < network->rates_ex_len &&
131 (network->
rates[i] & 0x7F)))
132 rate = network->
rates_ex[j++] & 0x7F;
134 rate = network->
rates[i++] & 0x7F;
138 "%d%s ", rate >> 1, (rate & 1) ?
".5" :
"");
143 "%d%s ", rate >> 1, (rate & 1) ?
".5" :
"");
151 bool is40M =
false, isShortGI =
false;
157 is40M = (ht_cap->ChlWidth)?1:0;
158 isShortGI = (ht_cap->ChlWidth)?
159 ((ht_cap->ShortGI40Mhz)?1:0):
160 ((ht_cap->ShortGI20Mhz)?1:0);
169 iwe.
u.
bitrate.value = max_rate * 500000;
174 if (iwe.
u.
data.length)
175 start = iwe_stream_add_point(info, start, stop, &iwe, custom);
189 iwe.
u.
qual.updated = 7;
195 if (iwe.
u.
data.length)
196 start = iwe_stream_add_point(info, start, stop, &iwe, custom);
197 #if (WIRELESS_EXT < 18)
207 memset(&iwe, 0,
sizeof(iwe));
210 start = iwe_stream_add_point(info, start, stop, &iwe, buf);
222 memset(&iwe, 0,
sizeof(iwe));
225 start = iwe_stream_add_point(info, start, stop, &iwe, buf);
228 memset(&iwe, 0,
sizeof(iwe));
235 start = iwe_stream_add_point(info, start, stop, &iwe, buf);
237 memset(&iwe, 0,
sizeof(iwe));
244 start = iwe_stream_add_point(info, start, stop, &iwe, buf);
256 if (iwe.
u.
data.length)
257 start = iwe_stream_add_point(info, start, stop, &iwe, custom);
271 char *
stop = ev + wrqu->
data.length;
288 ev = rtl819x_translate_scan(ieee, ev, stop, network, info);
291 "Not showing network '%s ("
292 "%pM)' due to age (%lums).\n",
293 escape_essid(network->
ssid,
299 spin_unlock_irqrestore(&ieee->
lock, flags);
302 wrqu->
data.flags = 0;
335 "provided" :
"default");
339 if (key_provided && *crypt) {
353 ieee, &ieee->
crypt[i]);
371 if (*crypt !=
NULL && (*crypt)->ops !=
NULL &&
372 strcmp((*crypt)->ops->name,
"WEP") != 0) {
378 if (*crypt ==
NULL) {
384 if (new_crypt ==
NULL)
387 if (!new_crypt->
ops) {
388 request_module(
"ieee80211_crypt_wep");
391 if (new_crypt->
ops && try_module_get(new_crypt->
ops->owner))
392 new_crypt->
priv = new_crypt->
ops->init(key);
394 if (!new_crypt->
ops || !new_crypt->
priv) {
399 "load module ieee80211_crypt_wep\n",
408 len = erq->
length <= 5 ? 5 : 13;
414 key, escape_essid(sec.
keys[key], len),
417 (*crypt)->ops->set_key(sec.
keys[key], len,
NULL,
428 NULL, (*crypt)->priv);
431 printk(
"Setting key %d to all zero.\n",
437 (*crypt)->ops->set_key(sec.
keys[key], 13,
NULL,
446 "Setting key %d to default Tx key.\n", key);
459 "OPEN" :
"SHARED KEY");
505 erq->
flags = key + 1;
513 erq->
length = (len >= 0 ? len : 0);
524 #if (WIRELESS_EXT >= 18)
596 module =
"ieee80211_crypt_wep";
600 module =
"ieee80211_crypt_tkip";
604 module =
"ieee80211_crypt_ccmp";
612 printk(
"alg name:%s\n",alg);
616 request_module(module);
622 printk(
"========>unknown crypto alg %d\n", ext->
alg);
627 if (*crypt ==
NULL || (*crypt)->ops != ops) {
632 new_crypt = kzalloc(
sizeof(*new_crypt),
GFP_KERNEL);
633 if (new_crypt ==
NULL) {
638 if (new_crypt->
ops && try_module_get(new_crypt->
ops->owner))
639 new_crypt->
priv = new_crypt->
ops->init(idx);
649 if (ext->
key_len > 0 && (*crypt)->ops->set_key &&
651 (*crypt)->priv) < 0) {
653 printk(
"key setting failed\n");
706 int idx, max_key_len;
708 max_key_len = encoding->
length -
sizeof(*ext);
714 if (idx < 1 || idx > WEP_KEYS)
726 encoding->
flags = idx + 1;
727 memset(ext, 0,
sizeof(*ext));
734 if (
strcmp(crypt->
ops->name,
"WEP") == 0 )
736 else if (
strcmp(crypt->
ops->name,
"TKIP"))
738 else if (
strcmp(crypt->
ops->name,
"CCMP"))
847 printk(
"len:%zu, ie:%d\n", len, ie[1]);
867 #if (WIRELESS_EXT >= 18)