diff options
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_80211_rx.c')
-rw-r--r-- | drivers/net/wireless/hostap/hostap_80211_rx.c | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c index 241756318da4..7ba318e84dec 100644 --- a/drivers/net/wireless/hostap/hostap_80211_rx.c +++ b/drivers/net/wireless/hostap/hostap_80211_rx.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include <linux/etherdevice.h> | 1 | #include <linux/etherdevice.h> |
2 | #include <net/lib80211.h> | 2 | #include <net/lib80211.h> |
3 | #include <linux/if_arp.h> | ||
3 | 4 | ||
4 | #include "hostap_80211.h" | 5 | #include "hostap_80211.h" |
5 | #include "hostap.h" | 6 | #include "hostap.h" |
@@ -17,10 +18,10 @@ static unsigned char bridge_tunnel_header[] = | |||
17 | void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, | 18 | void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, |
18 | struct hostap_80211_rx_status *rx_stats) | 19 | struct hostap_80211_rx_status *rx_stats) |
19 | { | 20 | { |
20 | struct ieee80211_hdr_4addr *hdr; | 21 | struct ieee80211_hdr *hdr; |
21 | u16 fc; | 22 | u16 fc; |
22 | 23 | ||
23 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 24 | hdr = (struct ieee80211_hdr *) skb->data; |
24 | 25 | ||
25 | printk(KERN_DEBUG "%s: RX signal=%d noise=%d rate=%d len=%d " | 26 | printk(KERN_DEBUG "%s: RX signal=%d noise=%d rate=%d len=%d " |
26 | "jiffies=%ld\n", | 27 | "jiffies=%ld\n", |
@@ -30,9 +31,10 @@ void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, | |||
30 | if (skb->len < 2) | 31 | if (skb->len < 2) |
31 | return; | 32 | return; |
32 | 33 | ||
33 | fc = le16_to_cpu(hdr->frame_ctl); | 34 | fc = le16_to_cpu(hdr->frame_control); |
34 | printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", | 35 | printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", |
35 | fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, | 36 | fc, (fc & IEEE80211_FCTL_FTYPE) >> 2, |
37 | (fc & IEEE80211_FCTL_STYPE) >> 4, | ||
36 | fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", | 38 | fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", |
37 | fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : ""); | 39 | fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : ""); |
38 | 40 | ||
@@ -42,7 +44,7 @@ void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, | |||
42 | } | 44 | } |
43 | 45 | ||
44 | printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id), | 46 | printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id), |
45 | le16_to_cpu(hdr->seq_ctl)); | 47 | le16_to_cpu(hdr->seq_ctrl)); |
46 | 48 | ||
47 | printk(KERN_DEBUG " A1=%pM", hdr->addr1); | 49 | printk(KERN_DEBUG " A1=%pM", hdr->addr1); |
48 | printk(" A2=%pM", hdr->addr2); | 50 | printk(" A2=%pM", hdr->addr2); |
@@ -63,7 +65,7 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb, | |||
63 | int hdrlen, phdrlen, head_need, tail_need; | 65 | int hdrlen, phdrlen, head_need, tail_need; |
64 | u16 fc; | 66 | u16 fc; |
65 | int prism_header, ret; | 67 | int prism_header, ret; |
66 | struct ieee80211_hdr_4addr *fhdr; | 68 | struct ieee80211_hdr *fhdr; |
67 | 69 | ||
68 | iface = netdev_priv(dev); | 70 | iface = netdev_priv(dev); |
69 | local = iface->local; | 71 | local = iface->local; |
@@ -84,8 +86,8 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb, | |||
84 | phdrlen = 0; | 86 | phdrlen = 0; |
85 | } | 87 | } |
86 | 88 | ||
87 | fhdr = (struct ieee80211_hdr_4addr *) skb->data; | 89 | fhdr = (struct ieee80211_hdr *) skb->data; |
88 | fc = le16_to_cpu(fhdr->frame_ctl); | 90 | fc = le16_to_cpu(fhdr->frame_control); |
89 | 91 | ||
90 | if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) { | 92 | if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) { |
91 | printk(KERN_DEBUG "%s: dropped management frame with header " | 93 | printk(KERN_DEBUG "%s: dropped management frame with header " |
@@ -94,7 +96,7 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb, | |||
94 | return 0; | 96 | return 0; |
95 | } | 97 | } |
96 | 98 | ||
97 | hdrlen = hostap_80211_get_hdrlen(fc); | 99 | hdrlen = hostap_80211_get_hdrlen(fhdr->frame_control); |
98 | 100 | ||
99 | /* check if there is enough room for extra data; if not, expand skb | 101 | /* check if there is enough room for extra data; if not, expand skb |
100 | * buffer to be large enough for the changes */ | 102 | * buffer to be large enough for the changes */ |
@@ -247,21 +249,21 @@ prism2_frag_cache_find(local_info_t *local, unsigned int seq, | |||
247 | 249 | ||
248 | /* Called only as a tasklet (software IRQ) */ | 250 | /* Called only as a tasklet (software IRQ) */ |
249 | static struct sk_buff * | 251 | static struct sk_buff * |
250 | prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr_4addr *hdr) | 252 | prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr *hdr) |
251 | { | 253 | { |
252 | struct sk_buff *skb = NULL; | 254 | struct sk_buff *skb = NULL; |
253 | u16 sc; | 255 | u16 sc; |
254 | unsigned int frag, seq; | 256 | unsigned int frag, seq; |
255 | struct prism2_frag_entry *entry; | 257 | struct prism2_frag_entry *entry; |
256 | 258 | ||
257 | sc = le16_to_cpu(hdr->seq_ctl); | 259 | sc = le16_to_cpu(hdr->seq_ctrl); |
258 | frag = WLAN_GET_SEQ_FRAG(sc); | 260 | frag = sc & IEEE80211_SCTL_FRAG; |
259 | seq = WLAN_GET_SEQ_SEQ(sc) >> 4; | 261 | seq = (sc & IEEE80211_SCTL_SEQ) >> 4; |
260 | 262 | ||
261 | if (frag == 0) { | 263 | if (frag == 0) { |
262 | /* Reserve enough space to fit maximum frame length */ | 264 | /* Reserve enough space to fit maximum frame length */ |
263 | skb = dev_alloc_skb(local->dev->mtu + | 265 | skb = dev_alloc_skb(local->dev->mtu + |
264 | sizeof(struct ieee80211_hdr_4addr) + | 266 | sizeof(struct ieee80211_hdr) + |
265 | 8 /* LLC */ + | 267 | 8 /* LLC */ + |
266 | 2 /* alignment */ + | 268 | 2 /* alignment */ + |
267 | 8 /* WEP */ + ETH_ALEN /* WDS */); | 269 | 8 /* WEP */ + ETH_ALEN /* WDS */); |
@@ -299,14 +301,14 @@ prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr_4addr *hdr) | |||
299 | 301 | ||
300 | /* Called only as a tasklet (software IRQ) */ | 302 | /* Called only as a tasklet (software IRQ) */ |
301 | static int prism2_frag_cache_invalidate(local_info_t *local, | 303 | static int prism2_frag_cache_invalidate(local_info_t *local, |
302 | struct ieee80211_hdr_4addr *hdr) | 304 | struct ieee80211_hdr *hdr) |
303 | { | 305 | { |
304 | u16 sc; | 306 | u16 sc; |
305 | unsigned int seq; | 307 | unsigned int seq; |
306 | struct prism2_frag_entry *entry; | 308 | struct prism2_frag_entry *entry; |
307 | 309 | ||
308 | sc = le16_to_cpu(hdr->seq_ctl); | 310 | sc = le16_to_cpu(hdr->seq_ctrl); |
309 | seq = WLAN_GET_SEQ_SEQ(sc) >> 4; | 311 | seq = (sc & IEEE80211_SCTL_SEQ) >> 4; |
310 | 312 | ||
311 | entry = prism2_frag_cache_find(local, seq, -1, hdr->addr2, hdr->addr1); | 313 | entry = prism2_frag_cache_find(local, seq, -1, hdr->addr2, hdr->addr1); |
312 | 314 | ||
@@ -472,10 +474,8 @@ hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb, | |||
472 | struct hostap_80211_rx_status *rx_stats, u16 type, | 474 | struct hostap_80211_rx_status *rx_stats, u16 type, |
473 | u16 stype) | 475 | u16 stype) |
474 | { | 476 | { |
475 | if (local->iw_mode == IW_MODE_MASTER) { | 477 | if (local->iw_mode == IW_MODE_MASTER) |
476 | hostap_update_sta_ps(local, (struct ieee80211_hdr_4addr *) | 478 | hostap_update_sta_ps(local, (struct ieee80211_hdr *) skb->data); |
477 | skb->data); | ||
478 | } | ||
479 | 479 | ||
480 | if (local->hostapd && type == IEEE80211_FTYPE_MGMT) { | 480 | if (local->hostapd && type == IEEE80211_FTYPE_MGMT) { |
481 | if (stype == IEEE80211_STYPE_BEACON && | 481 | if (stype == IEEE80211_STYPE_BEACON && |
@@ -552,8 +552,8 @@ static struct net_device *prism2_rx_get_wds(local_info_t *local, | |||
552 | 552 | ||
553 | 553 | ||
554 | static int | 554 | static int |
555 | hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr_4addr *hdr, | 555 | hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr, u16 fc, |
556 | u16 fc, struct net_device **wds) | 556 | struct net_device **wds) |
557 | { | 557 | { |
558 | /* FIX: is this really supposed to accept WDS frames only in Master | 558 | /* FIX: is this really supposed to accept WDS frames only in Master |
559 | * mode? What about Repeater or Managed with WDS frames? */ | 559 | * mode? What about Repeater or Managed with WDS frames? */ |
@@ -611,14 +611,14 @@ static int hostap_is_eapol_frame(local_info_t *local, struct sk_buff *skb) | |||
611 | { | 611 | { |
612 | struct net_device *dev = local->dev; | 612 | struct net_device *dev = local->dev; |
613 | u16 fc, ethertype; | 613 | u16 fc, ethertype; |
614 | struct ieee80211_hdr_4addr *hdr; | 614 | struct ieee80211_hdr *hdr; |
615 | u8 *pos; | 615 | u8 *pos; |
616 | 616 | ||
617 | if (skb->len < 24) | 617 | if (skb->len < 24) |
618 | return 0; | 618 | return 0; |
619 | 619 | ||
620 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 620 | hdr = (struct ieee80211_hdr *) skb->data; |
621 | fc = le16_to_cpu(hdr->frame_ctl); | 621 | fc = le16_to_cpu(hdr->frame_control); |
622 | 622 | ||
623 | /* check that the frame is unicast frame to us */ | 623 | /* check that the frame is unicast frame to us */ |
624 | if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == | 624 | if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == |
@@ -651,14 +651,14 @@ static int | |||
651 | hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb, | 651 | hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb, |
652 | struct lib80211_crypt_data *crypt) | 652 | struct lib80211_crypt_data *crypt) |
653 | { | 653 | { |
654 | struct ieee80211_hdr_4addr *hdr; | 654 | struct ieee80211_hdr *hdr; |
655 | int res, hdrlen; | 655 | int res, hdrlen; |
656 | 656 | ||
657 | if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) | 657 | if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) |
658 | return 0; | 658 | return 0; |
659 | 659 | ||
660 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 660 | hdr = (struct ieee80211_hdr *) skb->data; |
661 | hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); | 661 | hdrlen = hostap_80211_get_hdrlen(hdr->frame_control); |
662 | 662 | ||
663 | if (local->tkip_countermeasures && | 663 | if (local->tkip_countermeasures && |
664 | strcmp(crypt->ops->name, "TKIP") == 0) { | 664 | strcmp(crypt->ops->name, "TKIP") == 0) { |
@@ -689,14 +689,14 @@ static int | |||
689 | hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb, | 689 | hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb, |
690 | int keyidx, struct lib80211_crypt_data *crypt) | 690 | int keyidx, struct lib80211_crypt_data *crypt) |
691 | { | 691 | { |
692 | struct ieee80211_hdr_4addr *hdr; | 692 | struct ieee80211_hdr *hdr; |
693 | int res, hdrlen; | 693 | int res, hdrlen; |
694 | 694 | ||
695 | if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) | 695 | if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) |
696 | return 0; | 696 | return 0; |
697 | 697 | ||
698 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 698 | hdr = (struct ieee80211_hdr *) skb->data; |
699 | hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); | 699 | hdrlen = hostap_80211_get_hdrlen(hdr->frame_control); |
700 | 700 | ||
701 | atomic_inc(&crypt->refcnt); | 701 | atomic_inc(&crypt->refcnt); |
702 | res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv); | 702 | res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv); |
@@ -720,7 +720,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
720 | { | 720 | { |
721 | struct hostap_interface *iface; | 721 | struct hostap_interface *iface; |
722 | local_info_t *local; | 722 | local_info_t *local; |
723 | struct ieee80211_hdr_4addr *hdr; | 723 | struct ieee80211_hdr *hdr; |
724 | size_t hdrlen; | 724 | size_t hdrlen; |
725 | u16 fc, type, stype, sc; | 725 | u16 fc, type, stype, sc; |
726 | struct net_device *wds = NULL; | 726 | struct net_device *wds = NULL; |
@@ -747,18 +747,18 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
747 | dev = local->ddev; | 747 | dev = local->ddev; |
748 | iface = netdev_priv(dev); | 748 | iface = netdev_priv(dev); |
749 | 749 | ||
750 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 750 | hdr = (struct ieee80211_hdr *) skb->data; |
751 | stats = hostap_get_stats(dev); | 751 | stats = hostap_get_stats(dev); |
752 | 752 | ||
753 | if (skb->len < 10) | 753 | if (skb->len < 10) |
754 | goto rx_dropped; | 754 | goto rx_dropped; |
755 | 755 | ||
756 | fc = le16_to_cpu(hdr->frame_ctl); | 756 | fc = le16_to_cpu(hdr->frame_control); |
757 | type = WLAN_FC_GET_TYPE(fc); | 757 | type = fc & IEEE80211_FCTL_FTYPE; |
758 | stype = WLAN_FC_GET_STYPE(fc); | 758 | stype = fc & IEEE80211_FCTL_STYPE; |
759 | sc = le16_to_cpu(hdr->seq_ctl); | 759 | sc = le16_to_cpu(hdr->seq_ctrl); |
760 | frag = WLAN_GET_SEQ_FRAG(sc); | 760 | frag = sc & IEEE80211_SCTL_FRAG; |
761 | hdrlen = hostap_80211_get_hdrlen(fc); | 761 | hdrlen = hostap_80211_get_hdrlen(hdr->frame_control); |
762 | 762 | ||
763 | /* Put this code here so that we avoid duplicating it in all | 763 | /* Put this code here so that we avoid duplicating it in all |
764 | * Rx paths. - Jean II */ | 764 | * Rx paths. - Jean II */ |
@@ -918,7 +918,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
918 | if (local->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && | 918 | if (local->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && |
919 | (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) | 919 | (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) |
920 | goto rx_dropped; | 920 | goto rx_dropped; |
921 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 921 | hdr = (struct ieee80211_hdr *) skb->data; |
922 | 922 | ||
923 | /* skb: hdr + (possibly fragmented) plaintext payload */ | 923 | /* skb: hdr + (possibly fragmented) plaintext payload */ |
924 | 924 | ||
@@ -931,7 +931,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
931 | printk(KERN_DEBUG "%s: Rx cannot get skb from " | 931 | printk(KERN_DEBUG "%s: Rx cannot get skb from " |
932 | "fragment cache (morefrag=%d seq=%u frag=%u)\n", | 932 | "fragment cache (morefrag=%d seq=%u frag=%u)\n", |
933 | dev->name, (fc & IEEE80211_FCTL_MOREFRAGS) != 0, | 933 | dev->name, (fc & IEEE80211_FCTL_MOREFRAGS) != 0, |
934 | WLAN_GET_SEQ_SEQ(sc) >> 4, frag); | 934 | (sc & IEEE80211_SCTL_SEQ) >> 4, frag); |
935 | goto rx_dropped; | 935 | goto rx_dropped; |
936 | } | 936 | } |
937 | 937 | ||
@@ -972,7 +972,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
972 | /* this was the last fragment and the frame will be | 972 | /* this was the last fragment and the frame will be |
973 | * delivered, so remove skb from fragment cache */ | 973 | * delivered, so remove skb from fragment cache */ |
974 | skb = frag_skb; | 974 | skb = frag_skb; |
975 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 975 | hdr = (struct ieee80211_hdr *) skb->data; |
976 | prism2_frag_cache_invalidate(local, hdr); | 976 | prism2_frag_cache_invalidate(local, hdr); |
977 | } | 977 | } |
978 | 978 | ||
@@ -983,7 +983,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
983 | hostap_rx_frame_decrypt_msdu(local, skb, keyidx, crypt)) | 983 | hostap_rx_frame_decrypt_msdu(local, skb, keyidx, crypt)) |
984 | goto rx_dropped; | 984 | goto rx_dropped; |
985 | 985 | ||
986 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 986 | hdr = (struct ieee80211_hdr *) skb->data; |
987 | if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !local->open_wep) { | 987 | if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !local->open_wep) { |
988 | if (local->ieee_802_1x && | 988 | if (local->ieee_802_1x && |
989 | hostap_is_eapol_frame(local, skb)) { | 989 | hostap_is_eapol_frame(local, skb)) { |