diff options
author | Dan Williams <dcbw@redhat.com> | 2009-02-11 17:17:10 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-27 14:51:41 -0500 |
commit | 1ea893fde29d8cf1639da8989f4b843dc3283ca8 (patch) | |
tree | b942df0bc99ef1568aab1ce4e42969e9eaf5b3db | |
parent | 4d8faf6937fd7ada1f523b1cf565ffd2a0623e8c (diff) |
hostap: convert usage of net/ieee80211.h to linux/ieee80211.h
So that net/ieee80211.h can be made private to ipw2x00 in a follow-up.
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/hostap/hostap.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_80211.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_80211_rx.c | 88 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_80211_tx.c | 51 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_ap.c | 138 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_ap.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_hw.c | 24 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_info.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_ioctl.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_main.c | 38 |
10 files changed, 164 insertions, 187 deletions
diff --git a/drivers/net/wireless/hostap/hostap.h b/drivers/net/wireless/hostap/hostap.h index 2453deaa3e00..ce8721fbc10e 100644 --- a/drivers/net/wireless/hostap/hostap.h +++ b/drivers/net/wireless/hostap/hostap.h | |||
@@ -31,7 +31,7 @@ void hostap_dump_rx_header(const char *name, | |||
31 | void hostap_dump_tx_header(const char *name, | 31 | void hostap_dump_tx_header(const char *name, |
32 | const struct hfa384x_tx_frame *tx); | 32 | const struct hfa384x_tx_frame *tx); |
33 | extern const struct header_ops hostap_80211_ops; | 33 | extern const struct header_ops hostap_80211_ops; |
34 | int hostap_80211_get_hdrlen(u16 fc); | 34 | int hostap_80211_get_hdrlen(__le16 fc); |
35 | struct net_device_stats *hostap_get_stats(struct net_device *dev); | 35 | struct net_device_stats *hostap_get_stats(struct net_device *dev); |
36 | void hostap_setup_dev(struct net_device *dev, local_info_t *local, | 36 | void hostap_setup_dev(struct net_device *dev, local_info_t *local, |
37 | int type); | 37 | int type); |
diff --git a/drivers/net/wireless/hostap/hostap_80211.h b/drivers/net/wireless/hostap/hostap_80211.h index 3a9474d9a907..2e9fb0f383fc 100644 --- a/drivers/net/wireless/hostap/hostap_80211.h +++ b/drivers/net/wireless/hostap/hostap_80211.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define HOSTAP_80211_H | 2 | #define HOSTAP_80211_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <net/ieee80211.h> | 5 | #include <linux/skbuff.h> |
6 | 6 | ||
7 | struct hostap_ieee80211_mgmt { | 7 | struct hostap_ieee80211_mgmt { |
8 | __le16 frame_control; | 8 | __le16 frame_control; |
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)) { |
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c index 078a010f39a0..6693423f63fe 100644 --- a/drivers/net/wireless/hostap/hostap_80211_tx.c +++ b/drivers/net/wireless/hostap/hostap_80211_tx.c | |||
@@ -15,10 +15,10 @@ static unsigned char bridge_tunnel_header[] = | |||
15 | 15 | ||
16 | void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) | 16 | void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) |
17 | { | 17 | { |
18 | struct ieee80211_hdr_4addr *hdr; | 18 | struct ieee80211_hdr *hdr; |
19 | u16 fc; | 19 | u16 fc; |
20 | 20 | ||
21 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 21 | hdr = (struct ieee80211_hdr *) skb->data; |
22 | 22 | ||
23 | printk(KERN_DEBUG "%s: TX len=%d jiffies=%ld\n", | 23 | printk(KERN_DEBUG "%s: TX len=%d jiffies=%ld\n", |
24 | name, skb->len, jiffies); | 24 | name, skb->len, jiffies); |
@@ -26,9 +26,10 @@ void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) | |||
26 | if (skb->len < 2) | 26 | if (skb->len < 2) |
27 | return; | 27 | return; |
28 | 28 | ||
29 | fc = le16_to_cpu(hdr->frame_ctl); | 29 | fc = le16_to_cpu(hdr->frame_control); |
30 | printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", | 30 | printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", |
31 | fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, | 31 | fc, (fc & IEEE80211_FCTL_FTYPE) >> 2, |
32 | (fc & IEEE80211_FCTL_STYPE) >> 4, | ||
32 | fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", | 33 | fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", |
33 | fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : ""); | 34 | fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : ""); |
34 | 35 | ||
@@ -38,7 +39,7 @@ void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) | |||
38 | } | 39 | } |
39 | 40 | ||
40 | printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id), | 41 | printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id), |
41 | le16_to_cpu(hdr->seq_ctl)); | 42 | le16_to_cpu(hdr->seq_ctrl)); |
42 | 43 | ||
43 | printk(KERN_DEBUG " A1=%pM", hdr->addr1); | 44 | printk(KERN_DEBUG " A1=%pM", hdr->addr1); |
44 | printk(" A2=%pM", hdr->addr2); | 45 | printk(" A2=%pM", hdr->addr2); |
@@ -57,7 +58,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
57 | struct hostap_interface *iface; | 58 | struct hostap_interface *iface; |
58 | local_info_t *local; | 59 | local_info_t *local; |
59 | int need_headroom, need_tailroom = 0; | 60 | int need_headroom, need_tailroom = 0; |
60 | struct ieee80211_hdr_4addr hdr; | 61 | struct ieee80211_hdr hdr; |
61 | u16 fc, ethertype = 0; | 62 | u16 fc, ethertype = 0; |
62 | enum { | 63 | enum { |
63 | WDS_NO = 0, WDS_OWN_FRAME, WDS_COMPLIANT_FRAME | 64 | WDS_NO = 0, WDS_OWN_FRAME, WDS_COMPLIANT_FRAME |
@@ -201,7 +202,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
201 | memcpy(&hdr.addr3, local->bssid, ETH_ALEN); | 202 | memcpy(&hdr.addr3, local->bssid, ETH_ALEN); |
202 | } | 203 | } |
203 | 204 | ||
204 | hdr.frame_ctl = cpu_to_le16(fc); | 205 | hdr.frame_control = cpu_to_le16(fc); |
205 | 206 | ||
206 | skb_pull(skb, skip_header_bytes); | 207 | skb_pull(skb, skip_header_bytes); |
207 | need_headroom = local->func->need_tx_headroom + hdr_len + encaps_len; | 208 | need_headroom = local->func->need_tx_headroom + hdr_len + encaps_len; |
@@ -265,7 +266,7 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
265 | struct hostap_interface *iface; | 266 | struct hostap_interface *iface; |
266 | local_info_t *local; | 267 | local_info_t *local; |
267 | struct hostap_skb_tx_data *meta; | 268 | struct hostap_skb_tx_data *meta; |
268 | struct ieee80211_hdr_4addr *hdr; | 269 | struct ieee80211_hdr *hdr; |
269 | u16 fc; | 270 | u16 fc; |
270 | 271 | ||
271 | iface = netdev_priv(dev); | 272 | iface = netdev_priv(dev); |
@@ -287,10 +288,10 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
287 | meta->iface = iface; | 288 | meta->iface = iface; |
288 | 289 | ||
289 | if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) { | 290 | if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) { |
290 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 291 | hdr = (struct ieee80211_hdr *) skb->data; |
291 | fc = le16_to_cpu(hdr->frame_ctl); | 292 | fc = le16_to_cpu(hdr->frame_control); |
292 | if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && | 293 | if (ieee80211_is_data(hdr->frame_control) && |
293 | WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_DATA) { | 294 | (fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_DATA) { |
294 | u8 *pos = &skb->data[IEEE80211_DATA_HDR3_LEN + | 295 | u8 *pos = &skb->data[IEEE80211_DATA_HDR3_LEN + |
295 | sizeof(rfc1042_header)]; | 296 | sizeof(rfc1042_header)]; |
296 | meta->ethertype = (pos[0] << 8) | pos[1]; | 297 | meta->ethertype = (pos[0] << 8) | pos[1]; |
@@ -310,8 +311,7 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb, | |||
310 | { | 311 | { |
311 | struct hostap_interface *iface; | 312 | struct hostap_interface *iface; |
312 | local_info_t *local; | 313 | local_info_t *local; |
313 | struct ieee80211_hdr_4addr *hdr; | 314 | struct ieee80211_hdr *hdr; |
314 | u16 fc; | ||
315 | int prefix_len, postfix_len, hdr_len, res; | 315 | int prefix_len, postfix_len, hdr_len, res; |
316 | 316 | ||
317 | iface = netdev_priv(skb->dev); | 317 | iface = netdev_priv(skb->dev); |
@@ -324,7 +324,7 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb, | |||
324 | 324 | ||
325 | if (local->tkip_countermeasures && | 325 | if (local->tkip_countermeasures && |
326 | strcmp(crypt->ops->name, "TKIP") == 0) { | 326 | strcmp(crypt->ops->name, "TKIP") == 0) { |
327 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 327 | hdr = (struct ieee80211_hdr *) skb->data; |
328 | if (net_ratelimit()) { | 328 | if (net_ratelimit()) { |
329 | printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " | 329 | printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " |
330 | "TX packet to %pM\n", | 330 | "TX packet to %pM\n", |
@@ -349,9 +349,8 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb, | |||
349 | return NULL; | 349 | return NULL; |
350 | } | 350 | } |
351 | 351 | ||
352 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 352 | hdr = (struct ieee80211_hdr *) skb->data; |
353 | fc = le16_to_cpu(hdr->frame_ctl); | 353 | hdr_len = hostap_80211_get_hdrlen(hdr->frame_control); |
354 | hdr_len = hostap_80211_get_hdrlen(fc); | ||
355 | 354 | ||
356 | /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so | 355 | /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so |
357 | * call both MSDU and MPDU encryption functions from here. */ | 356 | * call both MSDU and MPDU encryption functions from here. */ |
@@ -384,7 +383,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
384 | ap_tx_ret tx_ret; | 383 | ap_tx_ret tx_ret; |
385 | struct hostap_skb_tx_data *meta; | 384 | struct hostap_skb_tx_data *meta; |
386 | int no_encrypt = 0; | 385 | int no_encrypt = 0; |
387 | struct ieee80211_hdr_4addr *hdr; | 386 | struct ieee80211_hdr *hdr; |
388 | 387 | ||
389 | iface = netdev_priv(dev); | 388 | iface = netdev_priv(dev); |
390 | local = iface->local; | 389 | local = iface->local; |
@@ -427,14 +426,14 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
427 | tx_ret = hostap_handle_sta_tx(local, &tx); | 426 | tx_ret = hostap_handle_sta_tx(local, &tx); |
428 | skb = tx.skb; | 427 | skb = tx.skb; |
429 | meta = (struct hostap_skb_tx_data *) skb->cb; | 428 | meta = (struct hostap_skb_tx_data *) skb->cb; |
430 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 429 | hdr = (struct ieee80211_hdr *) skb->data; |
431 | fc = le16_to_cpu(hdr->frame_ctl); | 430 | fc = le16_to_cpu(hdr->frame_control); |
432 | switch (tx_ret) { | 431 | switch (tx_ret) { |
433 | case AP_TX_CONTINUE: | 432 | case AP_TX_CONTINUE: |
434 | break; | 433 | break; |
435 | case AP_TX_CONTINUE_NOT_AUTHORIZED: | 434 | case AP_TX_CONTINUE_NOT_AUTHORIZED: |
436 | if (local->ieee_802_1x && | 435 | if (local->ieee_802_1x && |
437 | WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && | 436 | ieee80211_is_data(hdr->frame_control) && |
438 | meta->ethertype != ETH_P_PAE && | 437 | meta->ethertype != ETH_P_PAE && |
439 | !(meta->flags & HOSTAP_TX_FLAGS_WDS)) { | 438 | !(meta->flags & HOSTAP_TX_FLAGS_WDS)) { |
440 | printk(KERN_DEBUG "%s: dropped frame to unauthorized " | 439 | printk(KERN_DEBUG "%s: dropped frame to unauthorized " |
@@ -469,10 +468,10 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
469 | 468 | ||
470 | /* remove special version from the frame header */ | 469 | /* remove special version from the frame header */ |
471 | fc &= ~IEEE80211_FCTL_VERS; | 470 | fc &= ~IEEE80211_FCTL_VERS; |
472 | hdr->frame_ctl = cpu_to_le16(fc); | 471 | hdr->frame_control = cpu_to_le16(fc); |
473 | } | 472 | } |
474 | 473 | ||
475 | if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_DATA) { | 474 | if (!ieee80211_is_data(hdr->frame_control)) { |
476 | no_encrypt = 1; | 475 | no_encrypt = 1; |
477 | tx.crypt = NULL; | 476 | tx.crypt = NULL; |
478 | } | 477 | } |
@@ -493,9 +492,9 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
493 | /* Add ISWEP flag both for firmware and host based encryption | 492 | /* Add ISWEP flag both for firmware and host based encryption |
494 | */ | 493 | */ |
495 | fc |= IEEE80211_FCTL_PROTECTED; | 494 | fc |= IEEE80211_FCTL_PROTECTED; |
496 | hdr->frame_ctl = cpu_to_le16(fc); | 495 | hdr->frame_control = cpu_to_le16(fc); |
497 | } else if (local->drop_unencrypted && | 496 | } else if (local->drop_unencrypted && |
498 | WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && | 497 | ieee80211_is_data(hdr->frame_control) && |
499 | meta->ethertype != ETH_P_PAE) { | 498 | meta->ethertype != ETH_P_PAE) { |
500 | if (net_ratelimit()) { | 499 | if (net_ratelimit()) { |
501 | printk(KERN_DEBUG "%s: dropped unencrypted TX data " | 500 | printk(KERN_DEBUG "%s: dropped unencrypted TX data " |
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c index 0a4bf94dddfb..645862fd37d1 100644 --- a/drivers/net/wireless/hostap/hostap_ap.c +++ b/drivers/net/wireless/hostap/hostap_ap.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/proc_fs.h> | 19 | #include <linux/proc_fs.h> |
20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
21 | #include <linux/random.h> | 21 | #include <linux/random.h> |
22 | #include <linux/if_arp.h> | ||
22 | 23 | ||
23 | #include "hostap_wlan.h" | 24 | #include "hostap_wlan.h" |
24 | #include "hostap.h" | 25 | #include "hostap.h" |
@@ -588,26 +589,22 @@ void hostap_check_sta_fw_version(struct ap_data *ap, int sta_fw_ver) | |||
588 | static void hostap_ap_tx_cb(struct sk_buff *skb, int ok, void *data) | 589 | static void hostap_ap_tx_cb(struct sk_buff *skb, int ok, void *data) |
589 | { | 590 | { |
590 | struct ap_data *ap = data; | 591 | struct ap_data *ap = data; |
591 | u16 fc; | 592 | struct ieee80211_hdr *hdr; |
592 | struct ieee80211_hdr_4addr *hdr; | ||
593 | 593 | ||
594 | if (!ap->local->hostapd || !ap->local->apdev) { | 594 | if (!ap->local->hostapd || !ap->local->apdev) { |
595 | dev_kfree_skb(skb); | 595 | dev_kfree_skb(skb); |
596 | return; | 596 | return; |
597 | } | 597 | } |
598 | 598 | ||
599 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | ||
600 | fc = le16_to_cpu(hdr->frame_ctl); | ||
601 | |||
602 | /* Pass the TX callback frame to the hostapd; use 802.11 header version | 599 | /* Pass the TX callback frame to the hostapd; use 802.11 header version |
603 | * 1 to indicate failure (no ACK) and 2 success (frame ACKed) */ | 600 | * 1 to indicate failure (no ACK) and 2 success (frame ACKed) */ |
604 | 601 | ||
605 | fc &= ~IEEE80211_FCTL_VERS; | 602 | hdr = (struct ieee80211_hdr *) skb->data; |
606 | fc |= ok ? BIT(1) : BIT(0); | 603 | hdr->frame_control &= cpu_to_le16(~IEEE80211_FCTL_VERS); |
607 | hdr->frame_ctl = cpu_to_le16(fc); | 604 | hdr->frame_control |= cpu_to_le16(ok ? BIT(1) : BIT(0)); |
608 | 605 | ||
609 | skb->dev = ap->local->apdev; | 606 | skb->dev = ap->local->apdev; |
610 | skb_pull(skb, hostap_80211_get_hdrlen(fc)); | 607 | skb_pull(skb, hostap_80211_get_hdrlen(hdr->frame_control)); |
611 | skb->pkt_type = PACKET_OTHERHOST; | 608 | skb->pkt_type = PACKET_OTHERHOST; |
612 | skb->protocol = cpu_to_be16(ETH_P_802_2); | 609 | skb->protocol = cpu_to_be16(ETH_P_802_2); |
613 | memset(skb->cb, 0, sizeof(skb->cb)); | 610 | memset(skb->cb, 0, sizeof(skb->cb)); |
@@ -621,8 +618,8 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data) | |||
621 | { | 618 | { |
622 | struct ap_data *ap = data; | 619 | struct ap_data *ap = data; |
623 | struct net_device *dev = ap->local->dev; | 620 | struct net_device *dev = ap->local->dev; |
624 | struct ieee80211_hdr_4addr *hdr; | 621 | struct ieee80211_hdr *hdr; |
625 | u16 fc, auth_alg, auth_transaction, status; | 622 | u16 auth_alg, auth_transaction, status; |
626 | __le16 *pos; | 623 | __le16 *pos; |
627 | struct sta_info *sta = NULL; | 624 | struct sta_info *sta = NULL; |
628 | char *txt = NULL; | 625 | char *txt = NULL; |
@@ -632,10 +629,8 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data) | |||
632 | return; | 629 | return; |
633 | } | 630 | } |
634 | 631 | ||
635 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 632 | hdr = (struct ieee80211_hdr *) skb->data; |
636 | fc = le16_to_cpu(hdr->frame_ctl); | 633 | if (!ieee80211_is_auth(hdr->frame_control) || |
637 | if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT || | ||
638 | WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_AUTH || | ||
639 | skb->len < IEEE80211_MGMT_HDR_LEN + 6) { | 634 | skb->len < IEEE80211_MGMT_HDR_LEN + 6) { |
640 | printk(KERN_DEBUG "%s: hostap_ap_tx_cb_auth received invalid " | 635 | printk(KERN_DEBUG "%s: hostap_ap_tx_cb_auth received invalid " |
641 | "frame\n", dev->name); | 636 | "frame\n", dev->name); |
@@ -691,7 +686,7 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data) | |||
691 | { | 686 | { |
692 | struct ap_data *ap = data; | 687 | struct ap_data *ap = data; |
693 | struct net_device *dev = ap->local->dev; | 688 | struct net_device *dev = ap->local->dev; |
694 | struct ieee80211_hdr_4addr *hdr; | 689 | struct ieee80211_hdr *hdr; |
695 | u16 fc, status; | 690 | u16 fc, status; |
696 | __le16 *pos; | 691 | __le16 *pos; |
697 | struct sta_info *sta = NULL; | 692 | struct sta_info *sta = NULL; |
@@ -702,11 +697,10 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data) | |||
702 | return; | 697 | return; |
703 | } | 698 | } |
704 | 699 | ||
705 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 700 | hdr = (struct ieee80211_hdr *) skb->data; |
706 | fc = le16_to_cpu(hdr->frame_ctl); | 701 | fc = le16_to_cpu(hdr->frame_control); |
707 | if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT || | 702 | if ((!ieee80211_is_assoc_resp(hdr->frame_control) && |
708 | (WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_ASSOC_RESP && | 703 | !ieee80211_is_reassoc_resp(hdr->frame_control)) || |
709 | WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_REASSOC_RESP) || | ||
710 | skb->len < IEEE80211_MGMT_HDR_LEN + 4) { | 704 | skb->len < IEEE80211_MGMT_HDR_LEN + 4) { |
711 | printk(KERN_DEBUG "%s: hostap_ap_tx_cb_assoc received invalid " | 705 | printk(KERN_DEBUG "%s: hostap_ap_tx_cb_assoc received invalid " |
712 | "frame\n", dev->name); | 706 | "frame\n", dev->name); |
@@ -757,12 +751,12 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data) | |||
757 | static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data) | 751 | static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data) |
758 | { | 752 | { |
759 | struct ap_data *ap = data; | 753 | struct ap_data *ap = data; |
760 | struct ieee80211_hdr_4addr *hdr; | 754 | struct ieee80211_hdr *hdr; |
761 | struct sta_info *sta; | 755 | struct sta_info *sta; |
762 | 756 | ||
763 | if (skb->len < 24) | 757 | if (skb->len < 24) |
764 | goto fail; | 758 | goto fail; |
765 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 759 | hdr = (struct ieee80211_hdr *) skb->data; |
766 | if (ok) { | 760 | if (ok) { |
767 | spin_lock(&ap->sta_table_lock); | 761 | spin_lock(&ap->sta_table_lock); |
768 | sta = ap_get_sta(ap, hdr->addr1); | 762 | sta = ap_get_sta(ap, hdr->addr1); |
@@ -917,7 +911,7 @@ static void prism2_send_mgmt(struct net_device *dev, | |||
917 | { | 911 | { |
918 | struct hostap_interface *iface; | 912 | struct hostap_interface *iface; |
919 | local_info_t *local; | 913 | local_info_t *local; |
920 | struct ieee80211_hdr_4addr *hdr; | 914 | struct ieee80211_hdr *hdr; |
921 | u16 fc; | 915 | u16 fc; |
922 | struct sk_buff *skb; | 916 | struct sk_buff *skb; |
923 | struct hostap_skb_tx_data *meta; | 917 | struct hostap_skb_tx_data *meta; |
@@ -942,8 +936,8 @@ static void prism2_send_mgmt(struct net_device *dev, | |||
942 | } | 936 | } |
943 | 937 | ||
944 | fc = type_subtype; | 938 | fc = type_subtype; |
945 | hdrlen = hostap_80211_get_hdrlen(fc); | 939 | hdrlen = hostap_80211_get_hdrlen(cpu_to_le16(type_subtype)); |
946 | hdr = (struct ieee80211_hdr_4addr *) skb_put(skb, hdrlen); | 940 | hdr = (struct ieee80211_hdr *) skb_put(skb, hdrlen); |
947 | if (body) | 941 | if (body) |
948 | memcpy(skb_put(skb, body_len), body, body_len); | 942 | memcpy(skb_put(skb, body_len), body, body_len); |
949 | 943 | ||
@@ -954,11 +948,11 @@ static void prism2_send_mgmt(struct net_device *dev, | |||
954 | 948 | ||
955 | 949 | ||
956 | memcpy(hdr->addr1, addr, ETH_ALEN); /* DA / RA */ | 950 | memcpy(hdr->addr1, addr, ETH_ALEN); /* DA / RA */ |
957 | if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) { | 951 | if (ieee80211_is_data(hdr->frame_control)) { |
958 | fc |= IEEE80211_FCTL_FROMDS; | 952 | fc |= IEEE80211_FCTL_FROMDS; |
959 | memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* BSSID */ | 953 | memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* BSSID */ |
960 | memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */ | 954 | memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */ |
961 | } else if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL) { | 955 | } else if (ieee80211_is_ctl(hdr->frame_control)) { |
962 | /* control:ACK does not have addr2 or addr3 */ | 956 | /* control:ACK does not have addr2 or addr3 */ |
963 | memset(hdr->addr2, 0, ETH_ALEN); | 957 | memset(hdr->addr2, 0, ETH_ALEN); |
964 | memset(hdr->addr3, 0, ETH_ALEN); | 958 | memset(hdr->addr3, 0, ETH_ALEN); |
@@ -967,7 +961,7 @@ static void prism2_send_mgmt(struct net_device *dev, | |||
967 | memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* BSSID */ | 961 | memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* BSSID */ |
968 | } | 962 | } |
969 | 963 | ||
970 | hdr->frame_ctl = cpu_to_le16(fc); | 964 | hdr->frame_control = cpu_to_le16(fc); |
971 | 965 | ||
972 | meta = (struct hostap_skb_tx_data *) skb->cb; | 966 | meta = (struct hostap_skb_tx_data *) skb->cb; |
973 | memset(meta, 0, sizeof(*meta)); | 967 | memset(meta, 0, sizeof(*meta)); |
@@ -1284,22 +1278,21 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb, | |||
1284 | struct hostap_80211_rx_status *rx_stats) | 1278 | struct hostap_80211_rx_status *rx_stats) |
1285 | { | 1279 | { |
1286 | struct net_device *dev = local->dev; | 1280 | struct net_device *dev = local->dev; |
1287 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; | 1281 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
1288 | size_t hdrlen; | 1282 | size_t hdrlen; |
1289 | struct ap_data *ap = local->ap; | 1283 | struct ap_data *ap = local->ap; |
1290 | char body[8 + WLAN_AUTH_CHALLENGE_LEN], *challenge = NULL; | 1284 | char body[8 + WLAN_AUTH_CHALLENGE_LEN], *challenge = NULL; |
1291 | int len, olen; | 1285 | int len, olen; |
1292 | u16 auth_alg, auth_transaction, status_code; | 1286 | u16 auth_alg, auth_transaction, status_code; |
1293 | __le16 *pos; | 1287 | __le16 *pos; |
1294 | u16 resp = WLAN_STATUS_SUCCESS, fc; | 1288 | u16 resp = WLAN_STATUS_SUCCESS; |
1295 | struct sta_info *sta = NULL; | 1289 | struct sta_info *sta = NULL; |
1296 | struct lib80211_crypt_data *crypt; | 1290 | struct lib80211_crypt_data *crypt; |
1297 | char *txt = ""; | 1291 | char *txt = ""; |
1298 | 1292 | ||
1299 | len = skb->len - IEEE80211_MGMT_HDR_LEN; | 1293 | len = skb->len - IEEE80211_MGMT_HDR_LEN; |
1300 | 1294 | ||
1301 | fc = le16_to_cpu(hdr->frame_ctl); | 1295 | hdrlen = hostap_80211_get_hdrlen(hdr->frame_control); |
1302 | hdrlen = hostap_80211_get_hdrlen(fc); | ||
1303 | 1296 | ||
1304 | if (len < 6) { | 1297 | if (len < 6) { |
1305 | PDEBUG(DEBUG_AP, "%s: handle_authen - too short payload " | 1298 | PDEBUG(DEBUG_AP, "%s: handle_authen - too short payload " |
@@ -1435,7 +1428,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb, | |||
1435 | challenge == NULL || | 1428 | challenge == NULL || |
1436 | memcmp(sta->u.sta.challenge, challenge, | 1429 | memcmp(sta->u.sta.challenge, challenge, |
1437 | WLAN_AUTH_CHALLENGE_LEN) != 0 || | 1430 | WLAN_AUTH_CHALLENGE_LEN) != 0 || |
1438 | !(fc & IEEE80211_FCTL_PROTECTED)) { | 1431 | !ieee80211_has_protected(hdr->frame_control)) { |
1439 | txt = "challenge response incorrect"; | 1432 | txt = "challenge response incorrect"; |
1440 | resp = WLAN_STATUS_CHALLENGE_FAIL; | 1433 | resp = WLAN_STATUS_CHALLENGE_FAIL; |
1441 | goto fail; | 1434 | goto fail; |
@@ -1488,7 +1481,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb, | |||
1488 | "trans#=%d stat=%d len=%d fc=%04x) ==> %d (%s)\n", | 1481 | "trans#=%d stat=%d len=%d fc=%04x) ==> %d (%s)\n", |
1489 | dev->name, hdr->addr2, | 1482 | dev->name, hdr->addr2, |
1490 | auth_alg, auth_transaction, status_code, len, | 1483 | auth_alg, auth_transaction, status_code, len, |
1491 | fc, resp, txt); | 1484 | le16_to_cpu(hdr->frame_control), resp, txt); |
1492 | } | 1485 | } |
1493 | } | 1486 | } |
1494 | 1487 | ||
@@ -1498,7 +1491,7 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb, | |||
1498 | struct hostap_80211_rx_status *rx_stats, int reassoc) | 1491 | struct hostap_80211_rx_status *rx_stats, int reassoc) |
1499 | { | 1492 | { |
1500 | struct net_device *dev = local->dev; | 1493 | struct net_device *dev = local->dev; |
1501 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; | 1494 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
1502 | char body[12], *p, *lpos; | 1495 | char body[12], *p, *lpos; |
1503 | int len, left; | 1496 | int len, left; |
1504 | __le16 *pos; | 1497 | __le16 *pos; |
@@ -1707,7 +1700,7 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb, | |||
1707 | struct hostap_80211_rx_status *rx_stats) | 1700 | struct hostap_80211_rx_status *rx_stats) |
1708 | { | 1701 | { |
1709 | struct net_device *dev = local->dev; | 1702 | struct net_device *dev = local->dev; |
1710 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; | 1703 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
1711 | char *body = (char *) (skb->data + IEEE80211_MGMT_HDR_LEN); | 1704 | char *body = (char *) (skb->data + IEEE80211_MGMT_HDR_LEN); |
1712 | int len; | 1705 | int len; |
1713 | u16 reason_code; | 1706 | u16 reason_code; |
@@ -1749,7 +1742,7 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb, | |||
1749 | struct hostap_80211_rx_status *rx_stats) | 1742 | struct hostap_80211_rx_status *rx_stats) |
1750 | { | 1743 | { |
1751 | struct net_device *dev = local->dev; | 1744 | struct net_device *dev = local->dev; |
1752 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; | 1745 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
1753 | char *body = skb->data + IEEE80211_MGMT_HDR_LEN; | 1746 | char *body = skb->data + IEEE80211_MGMT_HDR_LEN; |
1754 | int len; | 1747 | int len; |
1755 | u16 reason_code; | 1748 | u16 reason_code; |
@@ -1788,7 +1781,7 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb, | |||
1788 | 1781 | ||
1789 | /* Called only as a scheduled task for pending AP frames. */ | 1782 | /* Called only as a scheduled task for pending AP frames. */ |
1790 | static void ap_handle_data_nullfunc(local_info_t *local, | 1783 | static void ap_handle_data_nullfunc(local_info_t *local, |
1791 | struct ieee80211_hdr_4addr *hdr) | 1784 | struct ieee80211_hdr *hdr) |
1792 | { | 1785 | { |
1793 | struct net_device *dev = local->dev; | 1786 | struct net_device *dev = local->dev; |
1794 | 1787 | ||
@@ -1805,7 +1798,7 @@ static void ap_handle_data_nullfunc(local_info_t *local, | |||
1805 | 1798 | ||
1806 | /* Called only as a scheduled task for pending AP frames. */ | 1799 | /* Called only as a scheduled task for pending AP frames. */ |
1807 | static void ap_handle_dropped_data(local_info_t *local, | 1800 | static void ap_handle_dropped_data(local_info_t *local, |
1808 | struct ieee80211_hdr_4addr *hdr) | 1801 | struct ieee80211_hdr *hdr) |
1809 | { | 1802 | { |
1810 | struct net_device *dev = local->dev; | 1803 | struct net_device *dev = local->dev; |
1811 | struct sta_info *sta; | 1804 | struct sta_info *sta; |
@@ -1863,7 +1856,7 @@ static void pspoll_send_buffered(local_info_t *local, struct sta_info *sta, | |||
1863 | 1856 | ||
1864 | /* Called only as a scheduled task for pending AP frames. */ | 1857 | /* Called only as a scheduled task for pending AP frames. */ |
1865 | static void handle_pspoll(local_info_t *local, | 1858 | static void handle_pspoll(local_info_t *local, |
1866 | struct ieee80211_hdr_4addr *hdr, | 1859 | struct ieee80211_hdr *hdr, |
1867 | struct hostap_80211_rx_status *rx_stats) | 1860 | struct hostap_80211_rx_status *rx_stats) |
1868 | { | 1861 | { |
1869 | struct net_device *dev = local->dev; | 1862 | struct net_device *dev = local->dev; |
@@ -1872,8 +1865,7 @@ static void handle_pspoll(local_info_t *local, | |||
1872 | struct sk_buff *skb; | 1865 | struct sk_buff *skb; |
1873 | 1866 | ||
1874 | PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=%pM, TA=%pM PWRMGT=%d\n", | 1867 | PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=%pM, TA=%pM PWRMGT=%d\n", |
1875 | hdr->addr1, hdr->addr2, | 1868 | hdr->addr1, hdr->addr2, !!ieee80211_has_pm(hdr->frame_control)); |
1876 | !!(le16_to_cpu(hdr->frame_ctl) & IEEE80211_FCTL_PM)); | ||
1877 | 1869 | ||
1878 | if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { | 1870 | if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { |
1879 | PDEBUG(DEBUG_AP, | 1871 | PDEBUG(DEBUG_AP, |
@@ -1984,7 +1976,7 @@ static void handle_wds_oper_queue(struct work_struct *work) | |||
1984 | static void handle_beacon(local_info_t *local, struct sk_buff *skb, | 1976 | static void handle_beacon(local_info_t *local, struct sk_buff *skb, |
1985 | struct hostap_80211_rx_status *rx_stats) | 1977 | struct hostap_80211_rx_status *rx_stats) |
1986 | { | 1978 | { |
1987 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; | 1979 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
1988 | char *body = skb->data + IEEE80211_MGMT_HDR_LEN; | 1980 | char *body = skb->data + IEEE80211_MGMT_HDR_LEN; |
1989 | int len, left; | 1981 | int len, left; |
1990 | u16 beacon_int, capability; | 1982 | u16 beacon_int, capability; |
@@ -2143,14 +2135,14 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb, | |||
2143 | struct net_device *dev = local->dev; | 2135 | struct net_device *dev = local->dev; |
2144 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ | 2136 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ |
2145 | u16 fc, type, stype; | 2137 | u16 fc, type, stype; |
2146 | struct ieee80211_hdr_4addr *hdr; | 2138 | struct ieee80211_hdr *hdr; |
2147 | 2139 | ||
2148 | /* FIX: should give skb->len to handler functions and check that the | 2140 | /* FIX: should give skb->len to handler functions and check that the |
2149 | * buffer is long enough */ | 2141 | * buffer is long enough */ |
2150 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 2142 | hdr = (struct ieee80211_hdr *) skb->data; |
2151 | fc = le16_to_cpu(hdr->frame_ctl); | 2143 | fc = le16_to_cpu(hdr->frame_control); |
2152 | type = WLAN_FC_GET_TYPE(fc); | 2144 | type = fc & IEEE80211_FCTL_FTYPE; |
2153 | stype = WLAN_FC_GET_STYPE(fc); | 2145 | stype = fc & IEEE80211_FCTL_STYPE; |
2154 | 2146 | ||
2155 | #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT | 2147 | #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT |
2156 | if (!local->hostapd && type == IEEE80211_FTYPE_DATA) { | 2148 | if (!local->hostapd && type == IEEE80211_FTYPE_DATA) { |
@@ -2262,8 +2254,7 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb, | |||
2262 | { | 2254 | { |
2263 | struct hostap_interface *iface; | 2255 | struct hostap_interface *iface; |
2264 | local_info_t *local; | 2256 | local_info_t *local; |
2265 | u16 fc; | 2257 | struct ieee80211_hdr *hdr; |
2266 | struct ieee80211_hdr_4addr *hdr; | ||
2267 | 2258 | ||
2268 | iface = netdev_priv(dev); | 2259 | iface = netdev_priv(dev); |
2269 | local = iface->local; | 2260 | local = iface->local; |
@@ -2273,12 +2264,10 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb, | |||
2273 | 2264 | ||
2274 | local->stats.rx_packets++; | 2265 | local->stats.rx_packets++; |
2275 | 2266 | ||
2276 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 2267 | hdr = (struct ieee80211_hdr *) skb->data; |
2277 | fc = le16_to_cpu(hdr->frame_ctl); | ||
2278 | 2268 | ||
2279 | if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL && | 2269 | if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL && |
2280 | WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT && | 2270 | ieee80211_is_beacon(hdr->frame_control)) |
2281 | WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_BEACON) | ||
2282 | goto drop; | 2271 | goto drop; |
2283 | 2272 | ||
2284 | skb->protocol = cpu_to_be16(ETH_P_HOSTAP); | 2273 | skb->protocol = cpu_to_be16(ETH_P_HOSTAP); |
@@ -2294,7 +2283,7 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb, | |||
2294 | static void schedule_packet_send(local_info_t *local, struct sta_info *sta) | 2283 | static void schedule_packet_send(local_info_t *local, struct sta_info *sta) |
2295 | { | 2284 | { |
2296 | struct sk_buff *skb; | 2285 | struct sk_buff *skb; |
2297 | struct ieee80211_hdr_4addr *hdr; | 2286 | struct ieee80211_hdr *hdr; |
2298 | struct hostap_80211_rx_status rx_stats; | 2287 | struct hostap_80211_rx_status rx_stats; |
2299 | 2288 | ||
2300 | if (skb_queue_empty(&sta->tx_buf)) | 2289 | if (skb_queue_empty(&sta->tx_buf)) |
@@ -2307,10 +2296,10 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta) | |||
2307 | return; | 2296 | return; |
2308 | } | 2297 | } |
2309 | 2298 | ||
2310 | hdr = (struct ieee80211_hdr_4addr *) skb_put(skb, 16); | 2299 | hdr = (struct ieee80211_hdr *) skb_put(skb, 16); |
2311 | 2300 | ||
2312 | /* Generate a fake pspoll frame to start packet delivery */ | 2301 | /* Generate a fake pspoll frame to start packet delivery */ |
2313 | hdr->frame_ctl = cpu_to_le16( | 2302 | hdr->frame_control = cpu_to_le16( |
2314 | IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL); | 2303 | IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL); |
2315 | memcpy(hdr->addr1, local->dev->dev_addr, ETH_ALEN); | 2304 | memcpy(hdr->addr1, local->dev->dev_addr, ETH_ALEN); |
2316 | memcpy(hdr->addr2, sta->addr, ETH_ALEN); | 2305 | memcpy(hdr->addr2, sta->addr, ETH_ALEN); |
@@ -2689,7 +2678,7 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx) | |||
2689 | struct sta_info *sta = NULL; | 2678 | struct sta_info *sta = NULL; |
2690 | struct sk_buff *skb = tx->skb; | 2679 | struct sk_buff *skb = tx->skb; |
2691 | int set_tim, ret; | 2680 | int set_tim, ret; |
2692 | struct ieee80211_hdr_4addr *hdr; | 2681 | struct ieee80211_hdr *hdr; |
2693 | struct hostap_skb_tx_data *meta; | 2682 | struct hostap_skb_tx_data *meta; |
2694 | 2683 | ||
2695 | meta = (struct hostap_skb_tx_data *) skb->cb; | 2684 | meta = (struct hostap_skb_tx_data *) skb->cb; |
@@ -2698,7 +2687,7 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx) | |||
2698 | meta->iface->type == HOSTAP_INTERFACE_STA) | 2687 | meta->iface->type == HOSTAP_INTERFACE_STA) |
2699 | goto out; | 2688 | goto out; |
2700 | 2689 | ||
2701 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 2690 | hdr = (struct ieee80211_hdr *) skb->data; |
2702 | 2691 | ||
2703 | if (hdr->addr1[0] & 0x01) { | 2692 | if (hdr->addr1[0] & 0x01) { |
2704 | /* broadcast/multicast frame - no AP related processing */ | 2693 | /* broadcast/multicast frame - no AP related processing */ |
@@ -2753,7 +2742,7 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx) | |||
2753 | 2742 | ||
2754 | if (meta->flags & HOSTAP_TX_FLAGS_ADD_MOREDATA) { | 2743 | if (meta->flags & HOSTAP_TX_FLAGS_ADD_MOREDATA) { |
2755 | /* indicate to STA that more frames follow */ | 2744 | /* indicate to STA that more frames follow */ |
2756 | hdr->frame_ctl |= | 2745 | hdr->frame_control |= |
2757 | cpu_to_le16(IEEE80211_FCTL_MOREDATA); | 2746 | cpu_to_le16(IEEE80211_FCTL_MOREDATA); |
2758 | } | 2747 | } |
2759 | 2748 | ||
@@ -2828,10 +2817,10 @@ void hostap_handle_sta_release(void *ptr) | |||
2828 | void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb) | 2817 | void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb) |
2829 | { | 2818 | { |
2830 | struct sta_info *sta; | 2819 | struct sta_info *sta; |
2831 | struct ieee80211_hdr_4addr *hdr; | 2820 | struct ieee80211_hdr *hdr; |
2832 | struct hostap_skb_tx_data *meta; | 2821 | struct hostap_skb_tx_data *meta; |
2833 | 2822 | ||
2834 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 2823 | hdr = (struct ieee80211_hdr *) skb->data; |
2835 | meta = (struct hostap_skb_tx_data *) skb->cb; | 2824 | meta = (struct hostap_skb_tx_data *) skb->cb; |
2836 | 2825 | ||
2837 | spin_lock(&local->ap->sta_table_lock); | 2826 | spin_lock(&local->ap->sta_table_lock); |
@@ -2898,8 +2887,8 @@ static void hostap_update_sta_ps2(local_info_t *local, struct sta_info *sta, | |||
2898 | 2887 | ||
2899 | 2888 | ||
2900 | /* Called only as a tasklet (software IRQ). Called for each RX frame to update | 2889 | /* Called only as a tasklet (software IRQ). Called for each RX frame to update |
2901 | * STA power saving state. pwrmgt is a flag from 802.11 frame_ctl field. */ | 2890 | * STA power saving state. pwrmgt is a flag from 802.11 frame_control field. */ |
2902 | int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr_4addr *hdr) | 2891 | int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr) |
2903 | { | 2892 | { |
2904 | struct sta_info *sta; | 2893 | struct sta_info *sta; |
2905 | u16 fc; | 2894 | u16 fc; |
@@ -2913,9 +2902,10 @@ int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr_4addr *hdr) | |||
2913 | if (!sta) | 2902 | if (!sta) |
2914 | return -1; | 2903 | return -1; |
2915 | 2904 | ||
2916 | fc = le16_to_cpu(hdr->frame_ctl); | 2905 | fc = le16_to_cpu(hdr->frame_control); |
2917 | hostap_update_sta_ps2(local, sta, fc & IEEE80211_FCTL_PM, | 2906 | hostap_update_sta_ps2(local, sta, fc & IEEE80211_FCTL_PM, |
2918 | WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc)); | 2907 | fc & IEEE80211_FCTL_FTYPE, |
2908 | fc & IEEE80211_FCTL_STYPE); | ||
2919 | 2909 | ||
2920 | atomic_dec(&sta->users); | 2910 | atomic_dec(&sta->users); |
2921 | return 0; | 2911 | return 0; |
@@ -2932,16 +2922,16 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, | |||
2932 | int ret; | 2922 | int ret; |
2933 | struct sta_info *sta; | 2923 | struct sta_info *sta; |
2934 | u16 fc, type, stype; | 2924 | u16 fc, type, stype; |
2935 | struct ieee80211_hdr_4addr *hdr; | 2925 | struct ieee80211_hdr *hdr; |
2936 | 2926 | ||
2937 | if (local->ap == NULL) | 2927 | if (local->ap == NULL) |
2938 | return AP_RX_CONTINUE; | 2928 | return AP_RX_CONTINUE; |
2939 | 2929 | ||
2940 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 2930 | hdr = (struct ieee80211_hdr *) skb->data; |
2941 | 2931 | ||
2942 | fc = le16_to_cpu(hdr->frame_ctl); | 2932 | fc = le16_to_cpu(hdr->frame_control); |
2943 | type = WLAN_FC_GET_TYPE(fc); | 2933 | type = fc & IEEE80211_FCTL_FTYPE; |
2944 | stype = WLAN_FC_GET_STYPE(fc); | 2934 | stype = fc & IEEE80211_FCTL_STYPE; |
2945 | 2935 | ||
2946 | spin_lock(&local->ap->sta_table_lock); | 2936 | spin_lock(&local->ap->sta_table_lock); |
2947 | sta = ap_get_sta(local->ap, hdr->addr2); | 2937 | sta = ap_get_sta(local->ap, hdr->addr2); |
@@ -3064,7 +3054,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, | |||
3064 | 3054 | ||
3065 | /* Called only as a tasklet (software IRQ) */ | 3055 | /* Called only as a tasklet (software IRQ) */ |
3066 | int hostap_handle_sta_crypto(local_info_t *local, | 3056 | int hostap_handle_sta_crypto(local_info_t *local, |
3067 | struct ieee80211_hdr_4addr *hdr, | 3057 | struct ieee80211_hdr *hdr, |
3068 | struct lib80211_crypt_data **crypt, | 3058 | struct lib80211_crypt_data **crypt, |
3069 | void **sta_ptr) | 3059 | void **sta_ptr) |
3070 | { | 3060 | { |
@@ -3166,7 +3156,7 @@ int hostap_add_sta(struct ap_data *ap, u8 *sta_addr) | |||
3166 | 3156 | ||
3167 | /* Called only as a tasklet (software IRQ) */ | 3157 | /* Called only as a tasklet (software IRQ) */ |
3168 | int hostap_update_rx_stats(struct ap_data *ap, | 3158 | int hostap_update_rx_stats(struct ap_data *ap, |
3169 | struct ieee80211_hdr_4addr *hdr, | 3159 | struct ieee80211_hdr *hdr, |
3170 | struct hostap_80211_rx_status *rx_stats) | 3160 | struct hostap_80211_rx_status *rx_stats) |
3171 | { | 3161 | { |
3172 | struct sta_info *sta; | 3162 | struct sta_info *sta; |
diff --git a/drivers/net/wireless/hostap/hostap_ap.h b/drivers/net/wireless/hostap/hostap_ap.h index d36e4b175336..655ceeba9612 100644 --- a/drivers/net/wireless/hostap/hostap_ap.h +++ b/drivers/net/wireless/hostap/hostap_ap.h | |||
@@ -235,7 +235,7 @@ struct hostap_tx_data { | |||
235 | ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx); | 235 | ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx); |
236 | void hostap_handle_sta_release(void *ptr); | 236 | void hostap_handle_sta_release(void *ptr); |
237 | void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb); | 237 | void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb); |
238 | int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr_4addr *hdr); | 238 | int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr); |
239 | typedef enum { | 239 | typedef enum { |
240 | AP_RX_CONTINUE, AP_RX_DROP, AP_RX_EXIT, AP_RX_CONTINUE_NOT_AUTHORIZED | 240 | AP_RX_CONTINUE, AP_RX_DROP, AP_RX_EXIT, AP_RX_CONTINUE_NOT_AUTHORIZED |
241 | } ap_rx_ret; | 241 | } ap_rx_ret; |
@@ -243,13 +243,13 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, | |||
243 | struct sk_buff *skb, | 243 | struct sk_buff *skb, |
244 | struct hostap_80211_rx_status *rx_stats, | 244 | struct hostap_80211_rx_status *rx_stats, |
245 | int wds); | 245 | int wds); |
246 | int hostap_handle_sta_crypto(local_info_t *local, struct ieee80211_hdr_4addr *hdr, | 246 | int hostap_handle_sta_crypto(local_info_t *local, struct ieee80211_hdr *hdr, |
247 | struct lib80211_crypt_data **crypt, | 247 | struct lib80211_crypt_data **crypt, |
248 | void **sta_ptr); | 248 | void **sta_ptr); |
249 | int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr); | 249 | int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr); |
250 | int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr); | 250 | int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr); |
251 | int hostap_add_sta(struct ap_data *ap, u8 *sta_addr); | 251 | int hostap_add_sta(struct ap_data *ap, u8 *sta_addr); |
252 | int hostap_update_rx_stats(struct ap_data *ap, struct ieee80211_hdr_4addr *hdr, | 252 | int hostap_update_rx_stats(struct ap_data *ap, struct ieee80211_hdr *hdr, |
253 | struct hostap_80211_rx_status *rx_stats); | 253 | struct hostap_80211_rx_status *rx_stats); |
254 | void hostap_update_rates(local_info_t *local); | 254 | void hostap_update_rates(local_info_t *local); |
255 | void hostap_add_wds_links(local_info_t *local); | 255 | void hostap_add_wds_links(local_info_t *local); |
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index 0f27059bbe85..3d9e7b7a17b0 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/rtnetlink.h> | 46 | #include <linux/rtnetlink.h> |
47 | #include <linux/wireless.h> | 47 | #include <linux/wireless.h> |
48 | #include <net/iw_handler.h> | 48 | #include <net/iw_handler.h> |
49 | #include <net/ieee80211.h> | ||
50 | #include <net/lib80211.h> | 49 | #include <net/lib80211.h> |
51 | #include <asm/irq.h> | 50 | #include <asm/irq.h> |
52 | 51 | ||
@@ -1840,8 +1839,8 @@ static int prism2_tx_80211(struct sk_buff *skb, struct net_device *dev) | |||
1840 | hdr_len = 24; | 1839 | hdr_len = 24; |
1841 | skb_copy_from_linear_data(skb, &txdesc.frame_control, hdr_len); | 1840 | skb_copy_from_linear_data(skb, &txdesc.frame_control, hdr_len); |
1842 | fc = le16_to_cpu(txdesc.frame_control); | 1841 | fc = le16_to_cpu(txdesc.frame_control); |
1843 | if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && | 1842 | if (ieee80211_is_data(txdesc.frame_control) && |
1844 | (fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS) && | 1843 | ieee80211_has_a4(txdesc.frame_control) && |
1845 | skb->len >= 30) { | 1844 | skb->len >= 30) { |
1846 | /* Addr4 */ | 1845 | /* Addr4 */ |
1847 | skb_copy_from_linear_data_offset(skb, hdr_len, txdesc.addr4, | 1846 | skb_copy_from_linear_data_offset(skb, hdr_len, txdesc.addr4, |
@@ -2082,7 +2081,7 @@ static void hostap_rx_skb(local_info_t *local, struct sk_buff *skb) | |||
2082 | stats.rate = rxdesc->rate; | 2081 | stats.rate = rxdesc->rate; |
2083 | 2082 | ||
2084 | /* Convert Prism2 RX structure into IEEE 802.11 header */ | 2083 | /* Convert Prism2 RX structure into IEEE 802.11 header */ |
2085 | hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(rxdesc->frame_control)); | 2084 | hdrlen = hostap_80211_get_hdrlen(rxdesc->frame_control); |
2086 | if (hdrlen > rx_hdrlen) | 2085 | if (hdrlen > rx_hdrlen) |
2087 | hdrlen = rx_hdrlen; | 2086 | hdrlen = rx_hdrlen; |
2088 | 2087 | ||
@@ -2204,7 +2203,7 @@ static void hostap_tx_callback(local_info_t *local, | |||
2204 | return; | 2203 | return; |
2205 | } | 2204 | } |
2206 | 2205 | ||
2207 | hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(txdesc->frame_control)); | 2206 | hdrlen = hostap_80211_get_hdrlen(txdesc->frame_control); |
2208 | len = le16_to_cpu(txdesc->data_len); | 2207 | len = le16_to_cpu(txdesc->data_len); |
2209 | skb = dev_alloc_skb(hdrlen + len); | 2208 | skb = dev_alloc_skb(hdrlen + len); |
2210 | if (skb == NULL) { | 2209 | if (skb == NULL) { |
@@ -2315,8 +2314,7 @@ static void hostap_sta_tx_exc_tasklet(unsigned long data) | |||
2315 | if (skb->len >= sizeof(*txdesc)) { | 2314 | if (skb->len >= sizeof(*txdesc)) { |
2316 | /* Convert Prism2 RX structure into IEEE 802.11 header | 2315 | /* Convert Prism2 RX structure into IEEE 802.11 header |
2317 | */ | 2316 | */ |
2318 | u16 fc = le16_to_cpu(txdesc->frame_control); | 2317 | int hdrlen = hostap_80211_get_hdrlen(txdesc->frame_control); |
2319 | int hdrlen = hostap_80211_get_hdrlen(fc); | ||
2320 | memmove(skb_pull(skb, sizeof(*txdesc) - hdrlen), | 2318 | memmove(skb_pull(skb, sizeof(*txdesc) - hdrlen), |
2321 | &txdesc->frame_control, hdrlen); | 2319 | &txdesc->frame_control, hdrlen); |
2322 | 2320 | ||
@@ -2394,12 +2392,12 @@ static void prism2_txexc(local_info_t *local) | |||
2394 | PDEBUG(DEBUG_EXTRA, " retry_count=%d tx_rate=%d fc=0x%04x " | 2392 | PDEBUG(DEBUG_EXTRA, " retry_count=%d tx_rate=%d fc=0x%04x " |
2395 | "(%s%s%s::%d%s%s)\n", | 2393 | "(%s%s%s::%d%s%s)\n", |
2396 | txdesc.retry_count, txdesc.tx_rate, fc, | 2394 | txdesc.retry_count, txdesc.tx_rate, fc, |
2397 | WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT ? "Mgmt" : "", | 2395 | ieee80211_is_mgmt(txdesc.frame_control) ? "Mgmt" : "", |
2398 | WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL ? "Ctrl" : "", | 2396 | ieee80211_is_ctl(txdesc.frame_control) ? "Ctrl" : "", |
2399 | WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA ? "Data" : "", | 2397 | ieee80211_is_data(txdesc.frame_control) ? "Data" : "", |
2400 | WLAN_FC_GET_STYPE(fc) >> 4, | 2398 | (fc & IEEE80211_FCTL_STYPE) >> 4, |
2401 | fc & IEEE80211_FCTL_TODS ? " ToDS" : "", | 2399 | ieee80211_has_tods(txdesc.frame_control) ? " ToDS" : "", |
2402 | fc & IEEE80211_FCTL_FROMDS ? " FromDS" : ""); | 2400 | ieee80211_has_fromds(txdesc.frame_control) ? " FromDS" : ""); |
2403 | PDEBUG(DEBUG_EXTRA, " A1=%pM A2=%pM A3=%pM A4=%pM\n", | 2401 | PDEBUG(DEBUG_EXTRA, " A1=%pM A2=%pM A3=%pM A4=%pM\n", |
2404 | txdesc.addr1, txdesc.addr2, | 2402 | txdesc.addr1, txdesc.addr2, |
2405 | txdesc.addr3, txdesc.addr4); | 2403 | txdesc.addr3, txdesc.addr4); |
diff --git a/drivers/net/wireless/hostap/hostap_info.c b/drivers/net/wireless/hostap/hostap_info.c index 99b4cf41edf2..6fa14a4e4b53 100644 --- a/drivers/net/wireless/hostap/hostap_info.c +++ b/drivers/net/wireless/hostap/hostap_info.c | |||
@@ -1,5 +1,6 @@ | |||
1 | /* Host AP driver Info Frame processing (part of hostap.o module) */ | 1 | /* Host AP driver Info Frame processing (part of hostap.o module) */ |
2 | 2 | ||
3 | #include <linux/if_arp.h> | ||
3 | #include "hostap_wlan.h" | 4 | #include "hostap_wlan.h" |
4 | #include "hostap.h" | 5 | #include "hostap.h" |
5 | #include "hostap_ap.h" | 6 | #include "hostap_ap.h" |
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index 8618b3355eb4..3f2bda881a4f 100644 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/hostap/hostap_ioctl.c | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | #include <linux/types.h> | 3 | #include <linux/types.h> |
4 | #include <linux/ethtool.h> | 4 | #include <linux/ethtool.h> |
5 | #include <linux/if_arp.h> | ||
5 | #include <net/lib80211.h> | 6 | #include <net/lib80211.h> |
6 | 7 | ||
7 | #include "hostap_wlan.h" | 8 | #include "hostap_wlan.h" |
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c index 02a312ca8607..5d55f92f654b 100644 --- a/drivers/net/wireless/hostap/hostap_main.c +++ b/drivers/net/wireless/hostap/hostap_main.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/etherdevice.h> | 26 | #include <linux/etherdevice.h> |
27 | #include <net/net_namespace.h> | 27 | #include <net/net_namespace.h> |
28 | #include <net/iw_handler.h> | 28 | #include <net/iw_handler.h> |
29 | #include <net/ieee80211.h> | ||
30 | #include <net/lib80211.h> | 29 | #include <net/lib80211.h> |
31 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
32 | 31 | ||
@@ -543,7 +542,8 @@ void hostap_dump_rx_header(const char *name, const struct hfa384x_rx_frame *rx) | |||
543 | fc = __le16_to_cpu(rx->frame_control); | 542 | fc = __le16_to_cpu(rx->frame_control); |
544 | printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x " | 543 | printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x " |
545 | "data_len=%d%s%s\n", | 544 | "data_len=%d%s%s\n", |
546 | fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, | 545 | fc, (fc & IEEE80211_FCTL_FTYPE) >> 2, |
546 | (fc & IEEE80211_FCTL_STYPE) >> 4, | ||
547 | __le16_to_cpu(rx->duration_id), __le16_to_cpu(rx->seq_ctrl), | 547 | __le16_to_cpu(rx->duration_id), __le16_to_cpu(rx->seq_ctrl), |
548 | __le16_to_cpu(rx->data_len), | 548 | __le16_to_cpu(rx->data_len), |
549 | fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", | 549 | fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", |
@@ -570,7 +570,8 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx) | |||
570 | fc = __le16_to_cpu(tx->frame_control); | 570 | fc = __le16_to_cpu(tx->frame_control); |
571 | printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x " | 571 | printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x " |
572 | "data_len=%d%s%s\n", | 572 | "data_len=%d%s%s\n", |
573 | fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, | 573 | fc, (fc & IEEE80211_FCTL_FTYPE) >> 2, |
574 | (fc & IEEE80211_FCTL_STYPE) >> 4, | ||
574 | __le16_to_cpu(tx->duration_id), __le16_to_cpu(tx->seq_ctrl), | 575 | __le16_to_cpu(tx->duration_id), __le16_to_cpu(tx->seq_ctrl), |
575 | __le16_to_cpu(tx->data_len), | 576 | __le16_to_cpu(tx->data_len), |
576 | fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", | 577 | fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", |
@@ -593,29 +594,16 @@ static int hostap_80211_header_parse(const struct sk_buff *skb, | |||
593 | } | 594 | } |
594 | 595 | ||
595 | 596 | ||
596 | int hostap_80211_get_hdrlen(u16 fc) | 597 | int hostap_80211_get_hdrlen(__le16 fc) |
597 | { | 598 | { |
598 | int hdrlen = 24; | 599 | if (ieee80211_is_data(fc) && ieee80211_has_a4 (fc)) |
599 | 600 | return 30; /* Addr4 */ | |
600 | switch (WLAN_FC_GET_TYPE(fc)) { | 601 | else if (ieee80211_is_cts(fc) || ieee80211_is_ack(fc)) |
601 | case IEEE80211_FTYPE_DATA: | 602 | return 10; |
602 | if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) | 603 | else if (ieee80211_is_ctl(fc)) |
603 | hdrlen = 30; /* Addr4 */ | 604 | return 16; |
604 | break; | 605 | |
605 | case IEEE80211_FTYPE_CTL: | 606 | return 24; |
606 | switch (WLAN_FC_GET_STYPE(fc)) { | ||
607 | case IEEE80211_STYPE_CTS: | ||
608 | case IEEE80211_STYPE_ACK: | ||
609 | hdrlen = 10; | ||
610 | break; | ||
611 | default: | ||
612 | hdrlen = 16; | ||
613 | break; | ||
614 | } | ||
615 | break; | ||
616 | } | ||
617 | |||
618 | return hdrlen; | ||
619 | } | 607 | } |
620 | 608 | ||
621 | 609 | ||