aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.osdl.org>2006-12-02 18:08:32 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-02 18:08:32 -0500
commit97be852f81c5bb114aab31974af2c061eb86a6de (patch)
tree701a9c88eef7fc3692150f5dd7edb226a6089173 /net
parentcdb54fac35812a21943f0e506e8e3b94b469a77c (diff)
parentaae343d493df965ac3abec1bd97cccfe44a7d920 (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (118 commits) [netdrvr] skge: build fix [PATCH] NetXen: driver cleanup, removed unnecessary __iomem type casts [PATCH] PHY: Add support for configuring the PHY connection interface [PATCH] chelesio: transmit locking (plus bug fix). [PATCH] chelsio: statistics improvement [PATCH] chelsio: add MSI support [PATCH] chelsio: use standard CRC routines [PATCH] chelsio: cleanup pm3393 code [PATCH] chelsio: add 1G swcixw aupport [PATCH] chelsio: add support for other 10G boards [PATCH] chelsio: remove unused mutex [PATCH] chelsio: use kzalloc [PATCH] chelsio: whitespace fixes [PATCH] amd8111e use standard CRC lib [PATCH] sky2: msi enhancements. [PATCH] sky2: kfree_skb_any needed [PATCH] sky2: fixes for Yukon EC_U chip revisions [PATCH] sky2: add Dlink 560SX id [PATCH] sky2: receive error handling fix [PATCH] skge: don't clear MC state on link down ...
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c9
-rw-r--r--net/ieee80211/ieee80211_module.c25
-rw-r--r--net/ieee80211/ieee80211_rx.c68
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_auth.c24
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_scan.c5
5 files changed, 96 insertions, 35 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 81c426adcd..411c2428d2 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3035,15 +3035,6 @@ int register_netdev(struct net_device *dev)
3035 goto out; 3035 goto out;
3036 } 3036 }
3037 3037
3038 /*
3039 * Back compatibility hook. Kill this one in 2.5
3040 */
3041 if (dev->name[0] == 0 || dev->name[0] == ' ') {
3042 err = dev_alloc_name(dev, "eth%d");
3043 if (err < 0)
3044 goto out;
3045 }
3046
3047 err = register_netdevice(dev); 3038 err = register_netdevice(dev);
3048out: 3039out:
3049 rtnl_unlock(); 3040 rtnl_unlock();
diff --git a/net/ieee80211/ieee80211_module.c b/net/ieee80211/ieee80211_module.c
index 13b1e5fff7..b1c6d1f717 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
118static 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
126static 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
121struct net_device *alloc_ieee80211(int sizeof_priv) 133struct 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 2759312a42..d97e5412e3 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/softmac/ieee80211softmac_auth.c b/net/ieee80211/softmac/ieee80211softmac_auth.c
index 4cef39e171..0612015f1c 100644
--- a/net/ieee80211/softmac/ieee80211softmac_auth.c
+++ b/net/ieee80211/softmac/ieee80211softmac_auth.c
@@ -158,7 +158,7 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
158 /* Make sure that we've got an auth queue item for this request */ 158 /* Make sure that we've got an auth queue item for this request */
159 if(aq == NULL) 159 if(aq == NULL)
160 { 160 {
161 printkl(KERN_DEBUG PFX "Authentication response received from "MAC_FMT" but no queue item exists.\n", MAC_ARG(auth->header.addr2)); 161 dprintkl(KERN_DEBUG PFX "Authentication response received from "MAC_FMT" but no queue item exists.\n", MAC_ARG(auth->header.addr2));
162 /* Error #? */ 162 /* Error #? */
163 return -1; 163 return -1;
164 } 164 }
@@ -166,7 +166,7 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
166 /* Check for out of order authentication */ 166 /* Check for out of order authentication */
167 if(!net->authenticating) 167 if(!net->authenticating)
168 { 168 {
169 printkl(KERN_DEBUG PFX "Authentication response received from "MAC_FMT" but did not request authentication.\n",MAC_ARG(auth->header.addr2)); 169 dprintkl(KERN_DEBUG PFX "Authentication response received from "MAC_FMT" but did not request authentication.\n",MAC_ARG(auth->header.addr2));
170 return -1; 170 return -1;
171 } 171 }
172 172
@@ -216,10 +216,16 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
216 net->challenge_len = *data++; 216 net->challenge_len = *data++;
217 if (net->challenge_len > WLAN_AUTH_CHALLENGE_LEN) 217 if (net->challenge_len > WLAN_AUTH_CHALLENGE_LEN)
218 net->challenge_len = WLAN_AUTH_CHALLENGE_LEN; 218 net->challenge_len = WLAN_AUTH_CHALLENGE_LEN;
219 if (net->challenge != NULL) 219 kfree(net->challenge);
220 kfree(net->challenge); 220 net->challenge = kmemdup(data, net->challenge_len,
221 net->challenge = kmalloc(net->challenge_len, GFP_ATOMIC); 221 GFP_ATOMIC);
222 memcpy(net->challenge, data, net->challenge_len); 222 if (net->challenge == NULL) {
223 printkl(KERN_NOTICE PFX "Shared Key "
224 "Authentication failed due to "
225 "memory shortage.\n");
226 spin_unlock_irqrestore(&mac->lock, flags);
227 break;
228 }
223 aq->state = IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE; 229 aq->state = IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE;
224 230
225 /* We reuse the work struct from the auth request here. 231 /* We reuse the work struct from the auth request here.
@@ -342,7 +348,7 @@ ieee80211softmac_deauth_req(struct ieee80211softmac_device *mac,
342 /* Make sure the network is authenticated */ 348 /* Make sure the network is authenticated */
343 if (!net->authenticated) 349 if (!net->authenticated)
344 { 350 {
345 printkl(KERN_DEBUG PFX "Can't send deauthentication packet, network is not authenticated.\n"); 351 dprintkl(KERN_DEBUG PFX "Can't send deauthentication packet, network is not authenticated.\n");
346 /* Error okay? */ 352 /* Error okay? */
347 return -EPERM; 353 return -EPERM;
348 } 354 }
@@ -376,7 +382,7 @@ ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *de
376 net = ieee80211softmac_get_network_by_bssid(mac, deauth->header.addr2); 382 net = ieee80211softmac_get_network_by_bssid(mac, deauth->header.addr2);
377 383
378 if (net == NULL) { 384 if (net == NULL) {
379 printkl(KERN_DEBUG PFX "Received deauthentication packet from "MAC_FMT", but that network is unknown.\n", 385 dprintkl(KERN_DEBUG PFX "Received deauthentication packet from "MAC_FMT", but that network is unknown.\n",
380 MAC_ARG(deauth->header.addr2)); 386 MAC_ARG(deauth->header.addr2));
381 return 0; 387 return 0;
382 } 388 }
@@ -384,7 +390,7 @@ ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *de
384 /* Make sure the network is authenticated */ 390 /* Make sure the network is authenticated */
385 if(!net->authenticated) 391 if(!net->authenticated)
386 { 392 {
387 printkl(KERN_DEBUG PFX "Can't perform deauthentication, network is not authenticated.\n"); 393 dprintkl(KERN_DEBUG PFX "Can't perform deauthentication, network is not authenticated.\n");
388 /* Error okay? */ 394 /* Error okay? */
389 return -EPERM; 395 return -EPERM;
390 } 396 }
diff --git a/net/ieee80211/softmac/ieee80211softmac_scan.c b/net/ieee80211/softmac/ieee80211softmac_scan.c
index ad67368b58..5507feab32 100644
--- a/net/ieee80211/softmac/ieee80211softmac_scan.c
+++ b/net/ieee80211/softmac/ieee80211softmac_scan.c
@@ -134,7 +134,8 @@ void ieee80211softmac_scan(void *d)
134 si->started = 0; 134 si->started = 0;
135 spin_unlock_irqrestore(&sm->lock, flags); 135 spin_unlock_irqrestore(&sm->lock, flags);
136 136
137 dprintk(PFX "Scanning finished\n"); 137 dprintk(PFX "Scanning finished: scanned %d channels starting with channel %d\n",
138 sm->scaninfo->number_channels, sm->scaninfo->channels[0].channel);
138 ieee80211softmac_scan_finished(sm); 139 ieee80211softmac_scan_finished(sm);
139 complete_all(&sm->scaninfo->finished); 140 complete_all(&sm->scaninfo->finished);
140} 141}
@@ -182,8 +183,6 @@ int ieee80211softmac_start_scan_implementation(struct net_device *dev)
182 sm->scaninfo->channels = sm->ieee->geo.bg; 183 sm->scaninfo->channels = sm->ieee->geo.bg;
183 sm->scaninfo->number_channels = sm->ieee->geo.bg_channels; 184 sm->scaninfo->number_channels = sm->ieee->geo.bg_channels;
184 } 185 }
185 dprintk(PFX "Start scanning with channel: %d\n", sm->scaninfo->channels[0].channel);
186 dprintk(PFX "Scanning %d channels\n", sm->scaninfo->number_channels);
187 sm->scaninfo->current_channel_idx = 0; 186 sm->scaninfo->current_channel_idx = 0;
188 sm->scaninfo->started = 1; 187 sm->scaninfo->started = 1;
189 sm->scaninfo->stop = 0; 188 sm->scaninfo->stop = 0;