diff options
author | David Howells <dhowells@redhat.com> | 2006-12-05 09:37:56 -0500 |
---|---|---|
committer | David Howells <dhowells@warthog.cambridge.redhat.com> | 2006-12-05 09:37:56 -0500 |
commit | 4c1ac1b49122b805adfa4efc620592f68dccf5db (patch) | |
tree | 87557f4bc2fd4fe65b7570489c2f610c45c0adcd /net/ieee80211 | |
parent | c4028958b6ecad064b1a6303a6a5906d4fe48d73 (diff) | |
parent | d916faace3efc0bf19fe9a615a1ab8fa1a24cd93 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
drivers/infiniband/core/iwcm.c
drivers/net/chelsio/cxgb2.c
drivers/net/wireless/bcm43xx/bcm43xx_main.c
drivers/net/wireless/prism54/islpci_eth.c
drivers/usb/core/hub.h
drivers/usb/input/hid-core.c
net/core/netpoll.c
Fix up merge failures with Linus's head and fix new compilation failures.
Signed-Off-By: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net/ieee80211')
-rw-r--r-- | net/ieee80211/ieee80211_module.c | 25 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_rx.c | 68 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_tx.c | 4 | ||||
-rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_auth.c | 24 | ||||
-rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_scan.c | 7 |
5 files changed, 98 insertions, 30 deletions
diff --git a/net/ieee80211/ieee80211_module.c b/net/ieee80211/ieee80211_module.c index 13b1e5fff7e4..b1c6d1f717d9 100644 --- a/net/ieee80211/ieee80211_module.c +++ b/net/ieee80211/ieee80211_module.c | |||
@@ -67,7 +67,7 @@ static int ieee80211_networks_allocate(struct ieee80211_device *ieee) | |||
67 | return 0; | 67 | return 0; |
68 | 68 | ||
69 | ieee->networks = | 69 | ieee->networks = |
70 | kmalloc(MAX_NETWORK_COUNT * sizeof(struct ieee80211_network), | 70 | kzalloc(MAX_NETWORK_COUNT * sizeof(struct ieee80211_network), |
71 | GFP_KERNEL); | 71 | GFP_KERNEL); |
72 | if (!ieee->networks) { | 72 | if (!ieee->networks) { |
73 | printk(KERN_WARNING "%s: Out of memory allocating beacons\n", | 73 | printk(KERN_WARNING "%s: Out of memory allocating beacons\n", |
@@ -75,9 +75,6 @@ static int ieee80211_networks_allocate(struct ieee80211_device *ieee) | |||
75 | return -ENOMEM; | 75 | return -ENOMEM; |
76 | } | 76 | } |
77 | 77 | ||
78 | memset(ieee->networks, 0, | ||
79 | MAX_NETWORK_COUNT * sizeof(struct ieee80211_network)); | ||
80 | |||
81 | return 0; | 78 | return 0; |
82 | } | 79 | } |
83 | 80 | ||
@@ -118,6 +115,21 @@ static void ieee80211_networks_initialize(struct ieee80211_device *ieee) | |||
118 | &ieee->network_free_list); | 115 | &ieee->network_free_list); |
119 | } | 116 | } |
120 | 117 | ||
118 | static int ieee80211_change_mtu(struct net_device *dev, int new_mtu) | ||
119 | { | ||
120 | if ((new_mtu < 68) || (new_mtu > IEEE80211_DATA_LEN)) | ||
121 | return -EINVAL; | ||
122 | dev->mtu = new_mtu; | ||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | static struct net_device_stats *ieee80211_generic_get_stats( | ||
127 | struct net_device *dev) | ||
128 | { | ||
129 | struct ieee80211_device *ieee = netdev_priv(dev); | ||
130 | return &ieee->stats; | ||
131 | } | ||
132 | |||
121 | struct net_device *alloc_ieee80211(int sizeof_priv) | 133 | struct net_device *alloc_ieee80211(int sizeof_priv) |
122 | { | 134 | { |
123 | struct ieee80211_device *ieee; | 135 | struct ieee80211_device *ieee; |
@@ -133,6 +145,11 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
133 | } | 145 | } |
134 | ieee = netdev_priv(dev); | 146 | ieee = netdev_priv(dev); |
135 | dev->hard_start_xmit = ieee80211_xmit; | 147 | dev->hard_start_xmit = ieee80211_xmit; |
148 | dev->change_mtu = ieee80211_change_mtu; | ||
149 | |||
150 | /* Drivers are free to override this if the generic implementation | ||
151 | * does not meet their needs. */ | ||
152 | dev->get_stats = ieee80211_generic_get_stats; | ||
136 | 153 | ||
137 | ieee->dev = dev; | 154 | ieee->dev = dev; |
138 | 155 | ||
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index 2759312a4204..d97e5412e31b 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c | |||
@@ -415,17 +415,16 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
415 | ieee->host_mc_decrypt : ieee->host_decrypt; | 415 | ieee->host_mc_decrypt : ieee->host_decrypt; |
416 | 416 | ||
417 | if (can_be_decrypted) { | 417 | if (can_be_decrypted) { |
418 | int idx = 0; | ||
419 | if (skb->len >= hdrlen + 3) { | 418 | if (skb->len >= hdrlen + 3) { |
420 | /* Top two-bits of byte 3 are the key index */ | 419 | /* Top two-bits of byte 3 are the key index */ |
421 | idx = skb->data[hdrlen + 3] >> 6; | 420 | keyidx = skb->data[hdrlen + 3] >> 6; |
422 | } | 421 | } |
423 | 422 | ||
424 | /* ieee->crypt[] is WEP_KEY (4) in length. Given that idx | 423 | /* ieee->crypt[] is WEP_KEY (4) in length. Given that keyidx |
425 | * is only allowed 2-bits of storage, no value of idx can | 424 | * is only allowed 2-bits of storage, no value of keyidx can |
426 | * be provided via above code that would result in idx | 425 | * be provided via above code that would result in keyidx |
427 | * being out of range */ | 426 | * being out of range */ |
428 | crypt = ieee->crypt[idx]; | 427 | crypt = ieee->crypt[keyidx]; |
429 | 428 | ||
430 | #ifdef NOT_YET | 429 | #ifdef NOT_YET |
431 | sta = NULL; | 430 | sta = NULL; |
@@ -479,6 +478,11 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
479 | goto rx_exit; | 478 | goto rx_exit; |
480 | } | 479 | } |
481 | #endif | 480 | #endif |
481 | /* drop duplicate 802.11 retransmissions (IEEE 802.11 Chap. 9.29) */ | ||
482 | if (sc == ieee->prev_seq_ctl) | ||
483 | goto rx_dropped; | ||
484 | else | ||
485 | ieee->prev_seq_ctl = sc; | ||
482 | 486 | ||
483 | /* Data frame - extract src/dst addresses */ | 487 | /* Data frame - extract src/dst addresses */ |
484 | if (skb->len < IEEE80211_3ADDR_LEN) | 488 | if (skb->len < IEEE80211_3ADDR_LEN) |
@@ -655,6 +659,51 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
655 | goto rx_dropped; | 659 | goto rx_dropped; |
656 | } | 660 | } |
657 | 661 | ||
662 | /* If the frame was decrypted in hardware, we may need to strip off | ||
663 | * any security data (IV, ICV, etc) that was left behind */ | ||
664 | if (!can_be_decrypted && (fc & IEEE80211_FCTL_PROTECTED) && | ||
665 | ieee->host_strip_iv_icv) { | ||
666 | int trimlen = 0; | ||
667 | |||
668 | /* Top two-bits of byte 3 are the key index */ | ||
669 | if (skb->len >= hdrlen + 3) | ||
670 | keyidx = skb->data[hdrlen + 3] >> 6; | ||
671 | |||
672 | /* To strip off any security data which appears before the | ||
673 | * payload, we simply increase hdrlen (as the header gets | ||
674 | * chopped off immediately below). For the security data which | ||
675 | * appears after the payload, we use skb_trim. */ | ||
676 | |||
677 | switch (ieee->sec.encode_alg[keyidx]) { | ||
678 | case SEC_ALG_WEP: | ||
679 | /* 4 byte IV */ | ||
680 | hdrlen += 4; | ||
681 | /* 4 byte ICV */ | ||
682 | trimlen = 4; | ||
683 | break; | ||
684 | case SEC_ALG_TKIP: | ||
685 | /* 4 byte IV, 4 byte ExtIV */ | ||
686 | hdrlen += 8; | ||
687 | /* 8 byte MIC, 4 byte ICV */ | ||
688 | trimlen = 12; | ||
689 | break; | ||
690 | case SEC_ALG_CCMP: | ||
691 | /* 8 byte CCMP header */ | ||
692 | hdrlen += 8; | ||
693 | /* 8 byte MIC */ | ||
694 | trimlen = 8; | ||
695 | break; | ||
696 | } | ||
697 | |||
698 | if (skb->len < trimlen) | ||
699 | goto rx_dropped; | ||
700 | |||
701 | __skb_trim(skb, skb->len - trimlen); | ||
702 | |||
703 | if (skb->len < hdrlen) | ||
704 | goto rx_dropped; | ||
705 | } | ||
706 | |||
658 | /* skb: hdr + (possible reassembled) full plaintext payload */ | 707 | /* skb: hdr + (possible reassembled) full plaintext payload */ |
659 | 708 | ||
660 | payload = skb->data + hdrlen; | 709 | payload = skb->data + hdrlen; |
@@ -1255,12 +1304,11 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element | |||
1255 | case MFIE_TYPE_IBSS_DFS: | 1304 | case MFIE_TYPE_IBSS_DFS: |
1256 | if (network->ibss_dfs) | 1305 | if (network->ibss_dfs) |
1257 | break; | 1306 | break; |
1258 | network->ibss_dfs = | 1307 | network->ibss_dfs = kmemdup(info_element->data, |
1259 | kmalloc(info_element->len, GFP_ATOMIC); | 1308 | info_element->len, |
1309 | GFP_ATOMIC); | ||
1260 | if (!network->ibss_dfs) | 1310 | if (!network->ibss_dfs) |
1261 | return 1; | 1311 | return 1; |
1262 | memcpy(network->ibss_dfs, info_element->data, | ||
1263 | info_element->len); | ||
1264 | network->flags |= NETWORK_HAS_IBSS_DFS; | 1312 | network->flags |= NETWORK_HAS_IBSS_DFS; |
1265 | break; | 1313 | break; |
1266 | 1314 | ||
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c index ae254497ba3d..854fc13cd78d 100644 --- a/net/ieee80211/ieee80211_tx.c +++ b/net/ieee80211/ieee80211_tx.c | |||
@@ -390,7 +390,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
390 | * this stack is providing the full 802.11 header, one will | 390 | * this stack is providing the full 802.11 header, one will |
391 | * eventually be affixed to this fragment -- so we must account | 391 | * eventually be affixed to this fragment -- so we must account |
392 | * for it when determining the amount of payload space. */ | 392 | * for it when determining the amount of payload space. */ |
393 | bytes_per_frag = frag_size - IEEE80211_3ADDR_LEN; | 393 | bytes_per_frag = frag_size - hdr_len; |
394 | if (ieee->config & | 394 | if (ieee->config & |
395 | (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) | 395 | (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) |
396 | bytes_per_frag -= IEEE80211_FCS_LEN; | 396 | bytes_per_frag -= IEEE80211_FCS_LEN; |
@@ -412,7 +412,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
412 | } else { | 412 | } else { |
413 | nr_frags = 1; | 413 | nr_frags = 1; |
414 | bytes_per_frag = bytes_last_frag = bytes; | 414 | bytes_per_frag = bytes_last_frag = bytes; |
415 | frag_size = bytes + IEEE80211_3ADDR_LEN; | 415 | frag_size = bytes + hdr_len; |
416 | } | 416 | } |
417 | 417 | ||
418 | rts_required = (frag_size > ieee->rts | 418 | rts_required = (frag_size > ieee->rts |
diff --git a/net/ieee80211/softmac/ieee80211softmac_auth.c b/net/ieee80211/softmac/ieee80211softmac_auth.c index 2ae1833b657a..6012705aa4f8 100644 --- a/net/ieee80211/softmac/ieee80211softmac_auth.c +++ b/net/ieee80211/softmac/ieee80211softmac_auth.c | |||
@@ -161,7 +161,7 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth) | |||
161 | /* Make sure that we've got an auth queue item for this request */ | 161 | /* Make sure that we've got an auth queue item for this request */ |
162 | if(aq == NULL) | 162 | if(aq == NULL) |
163 | { | 163 | { |
164 | printkl(KERN_DEBUG PFX "Authentication response received from "MAC_FMT" but no queue item exists.\n", MAC_ARG(auth->header.addr2)); | 164 | dprintkl(KERN_DEBUG PFX "Authentication response received from "MAC_FMT" but no queue item exists.\n", MAC_ARG(auth->header.addr2)); |
165 | /* Error #? */ | 165 | /* Error #? */ |
166 | return -1; | 166 | return -1; |
167 | } | 167 | } |
@@ -169,7 +169,7 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth) | |||
169 | /* Check for out of order authentication */ | 169 | /* Check for out of order authentication */ |
170 | if(!net->authenticating) | 170 | if(!net->authenticating) |
171 | { | 171 | { |
172 | printkl(KERN_DEBUG PFX "Authentication response received from "MAC_FMT" but did not request authentication.\n",MAC_ARG(auth->header.addr2)); | 172 | dprintkl(KERN_DEBUG PFX "Authentication response received from "MAC_FMT" but did not request authentication.\n",MAC_ARG(auth->header.addr2)); |
173 | return -1; | 173 | return -1; |
174 | } | 174 | } |
175 | 175 | ||
@@ -219,10 +219,16 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth) | |||
219 | net->challenge_len = *data++; | 219 | net->challenge_len = *data++; |
220 | if (net->challenge_len > WLAN_AUTH_CHALLENGE_LEN) | 220 | if (net->challenge_len > WLAN_AUTH_CHALLENGE_LEN) |
221 | net->challenge_len = WLAN_AUTH_CHALLENGE_LEN; | 221 | net->challenge_len = WLAN_AUTH_CHALLENGE_LEN; |
222 | if (net->challenge != NULL) | 222 | kfree(net->challenge); |
223 | kfree(net->challenge); | 223 | net->challenge = kmemdup(data, net->challenge_len, |
224 | net->challenge = kmalloc(net->challenge_len, GFP_ATOMIC); | 224 | GFP_ATOMIC); |
225 | memcpy(net->challenge, data, net->challenge_len); | 225 | if (net->challenge == NULL) { |
226 | printkl(KERN_NOTICE PFX "Shared Key " | ||
227 | "Authentication failed due to " | ||
228 | "memory shortage.\n"); | ||
229 | spin_unlock_irqrestore(&mac->lock, flags); | ||
230 | break; | ||
231 | } | ||
226 | aq->state = IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE; | 232 | aq->state = IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE; |
227 | 233 | ||
228 | /* We reuse the work struct from the auth request here. | 234 | /* We reuse the work struct from the auth request here. |
@@ -345,7 +351,7 @@ ieee80211softmac_deauth_req(struct ieee80211softmac_device *mac, | |||
345 | /* Make sure the network is authenticated */ | 351 | /* Make sure the network is authenticated */ |
346 | if (!net->authenticated) | 352 | if (!net->authenticated) |
347 | { | 353 | { |
348 | printkl(KERN_DEBUG PFX "Can't send deauthentication packet, network is not authenticated.\n"); | 354 | dprintkl(KERN_DEBUG PFX "Can't send deauthentication packet, network is not authenticated.\n"); |
349 | /* Error okay? */ | 355 | /* Error okay? */ |
350 | return -EPERM; | 356 | return -EPERM; |
351 | } | 357 | } |
@@ -379,7 +385,7 @@ ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *de | |||
379 | net = ieee80211softmac_get_network_by_bssid(mac, deauth->header.addr2); | 385 | net = ieee80211softmac_get_network_by_bssid(mac, deauth->header.addr2); |
380 | 386 | ||
381 | if (net == NULL) { | 387 | if (net == NULL) { |
382 | printkl(KERN_DEBUG PFX "Received deauthentication packet from "MAC_FMT", but that network is unknown.\n", | 388 | dprintkl(KERN_DEBUG PFX "Received deauthentication packet from "MAC_FMT", but that network is unknown.\n", |
383 | MAC_ARG(deauth->header.addr2)); | 389 | MAC_ARG(deauth->header.addr2)); |
384 | return 0; | 390 | return 0; |
385 | } | 391 | } |
@@ -387,7 +393,7 @@ ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *de | |||
387 | /* Make sure the network is authenticated */ | 393 | /* Make sure the network is authenticated */ |
388 | if(!net->authenticated) | 394 | if(!net->authenticated) |
389 | { | 395 | { |
390 | printkl(KERN_DEBUG PFX "Can't perform deauthentication, network is not authenticated.\n"); | 396 | dprintkl(KERN_DEBUG PFX "Can't perform deauthentication, network is not authenticated.\n"); |
391 | /* Error okay? */ | 397 | /* Error okay? */ |
392 | return -EPERM; | 398 | return -EPERM; |
393 | } | 399 | } |
diff --git a/net/ieee80211/softmac/ieee80211softmac_scan.c b/net/ieee80211/softmac/ieee80211softmac_scan.c index a8326076581a..0c85d6c24cdb 100644 --- a/net/ieee80211/softmac/ieee80211softmac_scan.c +++ b/net/ieee80211/softmac/ieee80211softmac_scan.c | |||
@@ -47,7 +47,6 @@ ieee80211softmac_start_scan(struct ieee80211softmac_device *sm) | |||
47 | sm->scanning = 1; | 47 | sm->scanning = 1; |
48 | spin_unlock_irqrestore(&sm->lock, flags); | 48 | spin_unlock_irqrestore(&sm->lock, flags); |
49 | 49 | ||
50 | netif_tx_disable(sm->ieee->dev); | ||
51 | ret = sm->start_scan(sm->dev); | 50 | ret = sm->start_scan(sm->dev); |
52 | if (ret) { | 51 | if (ret) { |
53 | spin_lock_irqsave(&sm->lock, flags); | 52 | spin_lock_irqsave(&sm->lock, flags); |
@@ -137,7 +136,8 @@ void ieee80211softmac_scan(struct work_struct *work) | |||
137 | si->started = 0; | 136 | si->started = 0; |
138 | spin_unlock_irqrestore(&sm->lock, flags); | 137 | spin_unlock_irqrestore(&sm->lock, flags); |
139 | 138 | ||
140 | dprintk(PFX "Scanning finished\n"); | 139 | dprintk(PFX "Scanning finished: scanned %d channels starting with channel %d\n", |
140 | sm->scaninfo->number_channels, sm->scaninfo->channels[0].channel); | ||
141 | ieee80211softmac_scan_finished(sm); | 141 | ieee80211softmac_scan_finished(sm); |
142 | complete_all(&sm->scaninfo->finished); | 142 | complete_all(&sm->scaninfo->finished); |
143 | } | 143 | } |
@@ -186,8 +186,6 @@ int ieee80211softmac_start_scan_implementation(struct net_device *dev) | |||
186 | sm->scaninfo->channels = sm->ieee->geo.bg; | 186 | sm->scaninfo->channels = sm->ieee->geo.bg; |
187 | sm->scaninfo->number_channels = sm->ieee->geo.bg_channels; | 187 | sm->scaninfo->number_channels = sm->ieee->geo.bg_channels; |
188 | } | 188 | } |
189 | dprintk(PFX "Start scanning with channel: %d\n", sm->scaninfo->channels[0].channel); | ||
190 | dprintk(PFX "Scanning %d channels\n", sm->scaninfo->number_channels); | ||
191 | sm->scaninfo->current_channel_idx = 0; | 189 | sm->scaninfo->current_channel_idx = 0; |
192 | sm->scaninfo->started = 1; | 190 | sm->scaninfo->started = 1; |
193 | sm->scaninfo->stop = 0; | 191 | sm->scaninfo->stop = 0; |
@@ -251,7 +249,6 @@ void ieee80211softmac_scan_finished(struct ieee80211softmac_device *sm) | |||
251 | if (net) | 249 | if (net) |
252 | sm->set_channel(sm->dev, net->channel); | 250 | sm->set_channel(sm->dev, net->channel); |
253 | } | 251 | } |
254 | netif_wake_queue(sm->ieee->dev); | ||
255 | ieee80211softmac_call_events(sm, IEEE80211SOFTMAC_EVENT_SCAN_FINISHED, NULL); | 252 | ieee80211softmac_call_events(sm, IEEE80211SOFTMAC_EVENT_SCAN_FINISHED, NULL); |
256 | } | 253 | } |
257 | EXPORT_SYMBOL_GPL(ieee80211softmac_scan_finished); | 254 | EXPORT_SYMBOL_GPL(ieee80211softmac_scan_finished); |