19 #include <linux/random.h>
21 #include <linux/slab.h>
23 #include <asm/uaccess.h>
28 {0x00,0x0F,0xAC,0x00},
29 {0x00,0x0F,0xAC,0x01},
30 {0x00,0x0F,0xAC,0x02},
31 {0x00,0x0F,0xAC,0x03},
32 {0x00,0x0F,0xAC,0x04},
33 {0x00,0x0F,0xAC,0x05},
52 unsigned int rate_len = 0;
220 spin_unlock_irqrestore(&ieee->
lock, flags);
222 spin_unlock_irqrestore(&ieee->
lock, flags);
293 disass->
header.duration_id = 0;
321 unsigned int len,rate_len;
337 req->
header.duration_id = 0;
343 tag = (
u8 *)
skb_put(skb,len+2+rate_len);
457 }
while(!channel_map[ch]);
482 if(channel_map[ch] == 1)
601 printk(
"error out, scanning = 0\n");
746 if (!skb)
return NULL;
754 auth->
header.duration_id = 0x013a;
778 int atim_len,erp_len;
786 if(rate_ex_len > 0) rate_ex_len+=2;
807 skb = dev_alloc_skb(beacon_size);
818 beacon_buf->
header.duration_id = 0;
830 ((0 ==
strcmp(crypt->
ops->name,
"WEP")) || wpa_ie_len);
843 memcpy(tag, ssid, ssid_len);
848 *(tag++) = rate_len-2;
871 *(tag++) = rate_ex_len-2;
886 skb->dev = ieee->
dev;
902 skb = dev_alloc_skb(len);
925 encrypt = ( crypt && crypt->
ops);
1021 struct sk_buff *
buf = ieee80211_probe_resp(ieee, dest);
1050 unsigned int rsn_len = beacon->
rsn_ie_len - 4;
1053 unsigned int wmm_info_len = beacon->
QoS_Enable?9:0;
1054 unsigned int turbo_info_len = beacon->
Turbo_Enable?9:0;
1080 skb = dev_alloc_skb(len);
1090 hdr->
header.duration_id= 37;
1110 tag =
skb_put(skb, beacon->ssid_len);
1111 memcpy(tag, beacon->ssid, beacon->ssid_len);
1124 tag =
skb_put(skb,wmm_info_len);
1128 tag =
skb_put(skb,turbo_info_len);
1129 if(turbo_info_len) {
1139 unsigned long flags;
1162 spin_unlock_irqrestore(&ieee->
lock, flags);
1218 memcpy(c, challenge, chlen);
1283 for(i = 0; i < 6; i++) {
1314 int tmp_ssid_len = 0;
1316 short apset,ssidset,ssidbroad,apmatch,ssidmatch;
1338 ssidbroad = !(net->
ssid_len == 0 || net->
ssid[0]==
'\0');
1354 ( apset && apmatch &&
1355 ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
1359 (!apset && ssidset && ssidbroad && ssidmatch)
1402 unsigned long flags;
1419 spin_unlock_irqrestore(&ieee->
lock, flags);
1424 static inline u16 auth_parse(
struct sk_buff *skb,
u8** challenge,
int *chlen)
1487 while (tag+1 < skbend){
1499 if (ssidlen == 0)
return 1;
1501 if (!ssid)
return 1;
1524 static inline u16 assoc_parse(
struct sk_buff *skb,
int *
aid)
1545 if (probe_rq_parse(ieee, skb, dest)){
1640 if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
1704 }
else if(sleep == 2){
1715 spin_unlock_irqrestore(&ieee->
lock, flags);
1768 spin_unlock_irqrestore(&ieee->
lock, flags);
1791 tasklet_schedule(&ieee->
ps_task);
1807 if (0 == (
errcode=assoc_parse(skb, &aid))){
1817 goto associate_complete;
1862 &info_element->data[info_element->len];
1874 "Association response status code 0x%x\n",
1898 if (0 == (
errcode=auth_parse(skb, &challenge, &chlen))){
1926 ieee80211_rx_probe_rq(ieee, skb);
1981 unsigned long flags;
1989 for(i = 0; i < txb->
nr_frags; i++) {
2000 ieee->
stats.tx_packets++;
2009 spin_unlock_irqrestore(&ieee->
lock,flags);
2028 ieee->
stats.tx_packets++;
2041 unsigned long flags;
2050 spin_unlock_irqrestore(&ieee->
lock,flags);
2057 unsigned long flags;
2088 netif_wake_queue(ieee->
dev);
2092 spin_unlock_irqrestore(&ieee->
lock,flags);
2101 if (! netif_queue_stopped(ieee->
dev)){
2102 netif_stop_queue(ieee->
dev);
2201 printk(
"creating new IBSS cell\n");
2269 unsigned long flags;
2305 spin_unlock_irqrestore(&ieee->
lock, flags);
2332 unsigned long flags;
2368 spin_unlock_irqrestore(&ieee->
lock, flags);
2376 u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
2381 skb = ieee80211_probe_resp(ieee, broadcast_addr);
2473 for(i = 0; i < 17; i++) {
2515 #define DRV_NAME "Ieee80211"
2523 for(i = 0; i < 5; i++) {
2576 sema_init(&ieee->
wx_sem, 1);
2584 (
unsigned long)ieee);
2614 printk(
"%s WPA\n",value ?
"enabling" :
"disabling");
2623 ieee80211_wpa_enable(ieee, 1);
2644 printk(
"Unknown MLME request: %d\n", command);
2680 #define AUTH_ALG_OPEN_SYSTEM 0x1
2681 #define AUTH_ALG_SHARED_KEY 0x2
2710 unsigned long flags;
2714 ret = ieee80211_wpa_enable(ieee, value);
2759 ret = ieee80211_wpa_set_auth_algs(ieee, value);
2775 printk(
"Unknown WPA param: %d\n",name);
2800 (
int) ((
char *) param->
u.
crypt.key - (
char *) param) +
2801 param->
u.
crypt.key_len) {
2802 printk(
"Len mismatch %d, %d\n", param_len,
2806 if (is_broadcast_ether_addr(param->
sta_addr)) {
2833 goto skip_host_crypt;
2843 printk(
"unknown crypto alg '%s'\n", param->
u.
crypt.alg);
2849 if (*crypt ==
NULL || (*crypt)->ops != ops) {
2855 if (new_crypt ==
NULL) {
2863 new_crypt->
ops->init(param->
u.
crypt.idx);
2875 if (param->
u.
crypt.key_len > 0 && (*crypt)->ops->set_key &&
2876 (*crypt)->ops->set_key(param->
u.
crypt.key,
2878 (*crypt)->priv) < 0) {
2879 printk(
"key setting failed\n");
2886 if (param->
u.
crypt.set_tx) {
2924 printk(
"reset_port failed\n");
2956 switch (param->
cmd) {
2959 ret = ieee80211_wpa_set_param(ieee, param->
u.
wpa_param.name,
2964 ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->
length);
2968 ret = ieee80211_wpa_set_encryption(ieee, param, p->
length);
2972 ret = ieee80211_wpa_mlme(ieee, param->
u.
mlme.command,
2973 param->
u.
mlme.reason_code);
2977 printk(
"Unknown WPA supplicant request: %d\n",param->
cmd);