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 /drivers/net/wireless/hostap/hostap_ap.c | |
| 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>
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_ap.c')
| -rw-r--r-- | drivers/net/wireless/hostap/hostap_ap.c | 138 |
1 files changed, 64 insertions, 74 deletions
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c index 0a4bf94dddf..645862fd37d 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; |
