diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2007-12-21 03:30:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:09:05 -0500 |
commit | 8a9faf3cd08b91aca1502dbe18e3b5063fda2e87 (patch) | |
tree | 4588f25ca8cd11833252370c3b0c7566004de050 /drivers/net/wireless/hostap/hostap_ap.c | |
parent | 3eb9b41f2474c53fe469fbe383955d5aae9e76e4 (diff) |
hostap annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
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 | 72 |
1 files changed, 38 insertions, 34 deletions
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c index 6bbdb76b32df..ad040a3bb8a7 100644 --- a/drivers/net/wireless/hostap/hostap_ap.c +++ b/drivers/net/wireless/hostap/hostap_ap.c | |||
@@ -258,7 +258,7 @@ static void ap_handle_timer(unsigned long data) | |||
258 | sta->addr, ap->tx_callback_poll); | 258 | sta->addr, ap->tx_callback_poll); |
259 | } else { | 259 | } else { |
260 | int deauth = sta->timeout_next == STA_DEAUTH; | 260 | int deauth = sta->timeout_next == STA_DEAUTH; |
261 | u16 resp; | 261 | __le16 resp; |
262 | PDEBUG(DEBUG_AP, "%s: sending %s info to STA %s" | 262 | PDEBUG(DEBUG_AP, "%s: sending %s info to STA %s" |
263 | "(last=%lu, jiffies=%lu)\n", | 263 | "(last=%lu, jiffies=%lu)\n", |
264 | local->dev->name, | 264 | local->dev->name, |
@@ -300,13 +300,13 @@ void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap, | |||
300 | int resend) | 300 | int resend) |
301 | { | 301 | { |
302 | u8 addr[ETH_ALEN]; | 302 | u8 addr[ETH_ALEN]; |
303 | u16 resp; | 303 | __le16 resp; |
304 | int i; | 304 | int i; |
305 | 305 | ||
306 | PDEBUG(DEBUG_AP, "%s: Deauthenticate all stations\n", dev->name); | 306 | PDEBUG(DEBUG_AP, "%s: Deauthenticate all stations\n", dev->name); |
307 | memset(addr, 0xff, ETH_ALEN); | 307 | memset(addr, 0xff, ETH_ALEN); |
308 | 308 | ||
309 | resp = __constant_cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID); | 309 | resp = cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID); |
310 | 310 | ||
311 | /* deauth message sent; try to resend it few times; the message is | 311 | /* deauth message sent; try to resend it few times; the message is |
312 | * broadcast, so it may be delayed until next DTIM; there is not much | 312 | * broadcast, so it may be delayed until next DTIM; there is not much |
@@ -462,7 +462,7 @@ void ap_control_flush_macs(struct mac_restrictions *mac_restrictions) | |||
462 | int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, u8 *mac) | 462 | int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, u8 *mac) |
463 | { | 463 | { |
464 | struct sta_info *sta; | 464 | struct sta_info *sta; |
465 | u16 resp; | 465 | __le16 resp; |
466 | 466 | ||
467 | spin_lock_bh(&ap->sta_table_lock); | 467 | spin_lock_bh(&ap->sta_table_lock); |
468 | sta = ap_get_sta(ap, mac); | 468 | sta = ap_get_sta(ap, mac); |
@@ -628,7 +628,8 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data) | |||
628 | struct ap_data *ap = data; | 628 | struct ap_data *ap = data; |
629 | struct net_device *dev = ap->local->dev; | 629 | struct net_device *dev = ap->local->dev; |
630 | struct ieee80211_hdr_4addr *hdr; | 630 | struct ieee80211_hdr_4addr *hdr; |
631 | u16 fc, *pos, auth_alg, auth_transaction, status; | 631 | u16 fc, auth_alg, auth_transaction, status; |
632 | __le16 *pos; | ||
632 | struct sta_info *sta = NULL; | 633 | struct sta_info *sta = NULL; |
633 | char *txt = NULL; | 634 | char *txt = NULL; |
634 | DECLARE_MAC_BUF(mac); | 635 | DECLARE_MAC_BUF(mac); |
@@ -649,7 +650,7 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data) | |||
649 | return; | 650 | return; |
650 | } | 651 | } |
651 | 652 | ||
652 | pos = (u16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); | 653 | pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); |
653 | auth_alg = le16_to_cpu(*pos++); | 654 | auth_alg = le16_to_cpu(*pos++); |
654 | auth_transaction = le16_to_cpu(*pos++); | 655 | auth_transaction = le16_to_cpu(*pos++); |
655 | status = le16_to_cpu(*pos++); | 656 | status = le16_to_cpu(*pos++); |
@@ -698,7 +699,8 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data) | |||
698 | struct ap_data *ap = data; | 699 | struct ap_data *ap = data; |
699 | struct net_device *dev = ap->local->dev; | 700 | struct net_device *dev = ap->local->dev; |
700 | struct ieee80211_hdr_4addr *hdr; | 701 | struct ieee80211_hdr_4addr *hdr; |
701 | u16 fc, *pos, status; | 702 | u16 fc, status; |
703 | __le16 *pos; | ||
702 | struct sta_info *sta = NULL; | 704 | struct sta_info *sta = NULL; |
703 | char *txt = NULL; | 705 | char *txt = NULL; |
704 | DECLARE_MAC_BUF(mac); | 706 | DECLARE_MAC_BUF(mac); |
@@ -736,7 +738,7 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data) | |||
736 | goto done; | 738 | goto done; |
737 | } | 739 | } |
738 | 740 | ||
739 | pos = (u16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); | 741 | pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); |
740 | pos++; | 742 | pos++; |
741 | status = le16_to_cpu(*pos++); | 743 | status = le16_to_cpu(*pos++); |
742 | if (status == WLAN_STATUS_SUCCESS) { | 744 | if (status == WLAN_STATUS_SUCCESS) { |
@@ -1298,7 +1300,8 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb, | |||
1298 | struct ap_data *ap = local->ap; | 1300 | struct ap_data *ap = local->ap; |
1299 | char body[8 + WLAN_AUTH_CHALLENGE_LEN], *challenge = NULL; | 1301 | char body[8 + WLAN_AUTH_CHALLENGE_LEN], *challenge = NULL; |
1300 | int len, olen; | 1302 | int len, olen; |
1301 | u16 auth_alg, auth_transaction, status_code, *pos; | 1303 | u16 auth_alg, auth_transaction, status_code; |
1304 | __le16 *pos; | ||
1302 | u16 resp = WLAN_STATUS_SUCCESS, fc; | 1305 | u16 resp = WLAN_STATUS_SUCCESS, fc; |
1303 | struct sta_info *sta = NULL; | 1306 | struct sta_info *sta = NULL; |
1304 | struct ieee80211_crypt_data *crypt; | 1307 | struct ieee80211_crypt_data *crypt; |
@@ -1332,7 +1335,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb, | |||
1332 | crypt = local->crypt[idx]; | 1335 | crypt = local->crypt[idx]; |
1333 | } | 1336 | } |
1334 | 1337 | ||
1335 | pos = (u16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); | 1338 | pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); |
1336 | auth_alg = __le16_to_cpu(*pos); | 1339 | auth_alg = __le16_to_cpu(*pos); |
1337 | pos++; | 1340 | pos++; |
1338 | auth_transaction = __le16_to_cpu(*pos); | 1341 | auth_transaction = __le16_to_cpu(*pos); |
@@ -1465,7 +1468,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb, | |||
1465 | } | 1468 | } |
1466 | 1469 | ||
1467 | fail: | 1470 | fail: |
1468 | pos = (u16 *) body; | 1471 | pos = (__le16 *) body; |
1469 | *pos = cpu_to_le16(auth_alg); | 1472 | *pos = cpu_to_le16(auth_alg); |
1470 | pos++; | 1473 | pos++; |
1471 | *pos = cpu_to_le16(auth_transaction + 1); | 1474 | *pos = cpu_to_le16(auth_transaction + 1); |
@@ -1510,7 +1513,7 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb, | |||
1510 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; | 1513 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; |
1511 | char body[12], *p, *lpos; | 1514 | char body[12], *p, *lpos; |
1512 | int len, left; | 1515 | int len, left; |
1513 | u16 *pos; | 1516 | __le16 *pos; |
1514 | u16 resp = WLAN_STATUS_SUCCESS; | 1517 | u16 resp = WLAN_STATUS_SUCCESS; |
1515 | struct sta_info *sta = NULL; | 1518 | struct sta_info *sta = NULL; |
1516 | int send_deauth = 0; | 1519 | int send_deauth = 0; |
@@ -1540,7 +1543,7 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb, | |||
1540 | atomic_inc(&sta->users); | 1543 | atomic_inc(&sta->users); |
1541 | spin_unlock_bh(&local->ap->sta_table_lock); | 1544 | spin_unlock_bh(&local->ap->sta_table_lock); |
1542 | 1545 | ||
1543 | pos = (u16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); | 1546 | pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); |
1544 | sta->capability = __le16_to_cpu(*pos); | 1547 | sta->capability = __le16_to_cpu(*pos); |
1545 | pos++; left -= 2; | 1548 | pos++; left -= 2; |
1546 | sta->listen_interval = __le16_to_cpu(*pos); | 1549 | sta->listen_interval = __le16_to_cpu(*pos); |
@@ -1636,25 +1639,24 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb, | |||
1636 | } | 1639 | } |
1637 | 1640 | ||
1638 | fail: | 1641 | fail: |
1639 | pos = (u16 *) body; | 1642 | pos = (__le16 *) body; |
1640 | 1643 | ||
1641 | if (send_deauth) { | 1644 | if (send_deauth) { |
1642 | *pos = __constant_cpu_to_le16( | 1645 | *pos = cpu_to_le16(WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH); |
1643 | WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH); | ||
1644 | pos++; | 1646 | pos++; |
1645 | } else { | 1647 | } else { |
1646 | /* FIX: CF-Pollable and CF-PollReq should be set to match the | 1648 | /* FIX: CF-Pollable and CF-PollReq should be set to match the |
1647 | * values in beacons/probe responses */ | 1649 | * values in beacons/probe responses */ |
1648 | /* FIX: how about privacy and WEP? */ | 1650 | /* FIX: how about privacy and WEP? */ |
1649 | /* capability */ | 1651 | /* capability */ |
1650 | *pos = __constant_cpu_to_le16(WLAN_CAPABILITY_ESS); | 1652 | *pos = cpu_to_le16(WLAN_CAPABILITY_ESS); |
1651 | pos++; | 1653 | pos++; |
1652 | 1654 | ||
1653 | /* status_code */ | 1655 | /* status_code */ |
1654 | *pos = __cpu_to_le16(resp); | 1656 | *pos = cpu_to_le16(resp); |
1655 | pos++; | 1657 | pos++; |
1656 | 1658 | ||
1657 | *pos = __cpu_to_le16((sta && sta->aid > 0 ? sta->aid : 0) | | 1659 | *pos = cpu_to_le16((sta && sta->aid > 0 ? sta->aid : 0) | |
1658 | BIT(14) | BIT(15)); /* AID */ | 1660 | BIT(14) | BIT(15)); /* AID */ |
1659 | pos++; | 1661 | pos++; |
1660 | 1662 | ||
@@ -1681,7 +1683,7 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb, | |||
1681 | 0x96 : 0x16; | 1683 | 0x96 : 0x16; |
1682 | (*lpos)++; | 1684 | (*lpos)++; |
1683 | } | 1685 | } |
1684 | pos = (u16 *) p; | 1686 | pos = (__le16 *) p; |
1685 | } | 1687 | } |
1686 | 1688 | ||
1687 | prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | | 1689 | prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | |
@@ -1718,7 +1720,8 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb, | |||
1718 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; | 1720 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; |
1719 | char *body = (char *) (skb->data + IEEE80211_MGMT_HDR_LEN); | 1721 | char *body = (char *) (skb->data + IEEE80211_MGMT_HDR_LEN); |
1720 | int len; | 1722 | int len; |
1721 | u16 reason_code, *pos; | 1723 | u16 reason_code; |
1724 | __le16 *pos; | ||
1722 | struct sta_info *sta = NULL; | 1725 | struct sta_info *sta = NULL; |
1723 | DECLARE_MAC_BUF(mac); | 1726 | DECLARE_MAC_BUF(mac); |
1724 | 1727 | ||
@@ -1729,8 +1732,8 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb, | |||
1729 | return; | 1732 | return; |
1730 | } | 1733 | } |
1731 | 1734 | ||
1732 | pos = (u16 *) body; | 1735 | pos = (__le16 *) body; |
1733 | reason_code = __le16_to_cpu(*pos); | 1736 | reason_code = le16_to_cpu(*pos); |
1734 | 1737 | ||
1735 | PDEBUG(DEBUG_AP, "%s: deauthentication: %s len=%d, " | 1738 | PDEBUG(DEBUG_AP, "%s: deauthentication: %s len=%d, " |
1736 | "reason_code=%d\n", dev->name, print_mac(mac, hdr->addr2), len, | 1739 | "reason_code=%d\n", dev->name, print_mac(mac, hdr->addr2), len, |
@@ -1760,7 +1763,8 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb, | |||
1760 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; | 1763 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; |
1761 | char *body = skb->data + IEEE80211_MGMT_HDR_LEN; | 1764 | char *body = skb->data + IEEE80211_MGMT_HDR_LEN; |
1762 | int len; | 1765 | int len; |
1763 | u16 reason_code, *pos; | 1766 | u16 reason_code; |
1767 | __le16 *pos; | ||
1764 | struct sta_info *sta = NULL; | 1768 | struct sta_info *sta = NULL; |
1765 | DECLARE_MAC_BUF(mac); | 1769 | DECLARE_MAC_BUF(mac); |
1766 | 1770 | ||
@@ -1771,8 +1775,8 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb, | |||
1771 | return; | 1775 | return; |
1772 | } | 1776 | } |
1773 | 1777 | ||
1774 | pos = (u16 *) body; | 1778 | pos = (__le16 *) body; |
1775 | reason_code = __le16_to_cpu(*pos); | 1779 | reason_code = le16_to_cpu(*pos); |
1776 | 1780 | ||
1777 | PDEBUG(DEBUG_AP, "%s: disassociation: %s len=%d, " | 1781 | PDEBUG(DEBUG_AP, "%s: disassociation: %s len=%d, " |
1778 | "reason_code=%d\n", dev->name, print_mac(mac, hdr->addr2), len, | 1782 | "reason_code=%d\n", dev->name, print_mac(mac, hdr->addr2), len, |
@@ -1817,7 +1821,7 @@ static void ap_handle_dropped_data(local_info_t *local, | |||
1817 | { | 1821 | { |
1818 | struct net_device *dev = local->dev; | 1822 | struct net_device *dev = local->dev; |
1819 | struct sta_info *sta; | 1823 | struct sta_info *sta; |
1820 | u16 reason; | 1824 | __le16 reason; |
1821 | 1825 | ||
1822 | spin_lock_bh(&local->ap->sta_table_lock); | 1826 | spin_lock_bh(&local->ap->sta_table_lock); |
1823 | sta = ap_get_sta(local->ap, hdr->addr2); | 1827 | sta = ap_get_sta(local->ap, hdr->addr2); |
@@ -1831,8 +1835,7 @@ static void ap_handle_dropped_data(local_info_t *local, | |||
1831 | return; | 1835 | return; |
1832 | } | 1836 | } |
1833 | 1837 | ||
1834 | reason = __constant_cpu_to_le16( | 1838 | reason = cpu_to_le16(WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); |
1835 | WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); | ||
1836 | prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | | 1839 | prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | |
1837 | ((sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) ? | 1840 | ((sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) ? |
1838 | IEEE80211_STYPE_DEAUTH : IEEE80211_STYPE_DISASSOC), | 1841 | IEEE80211_STYPE_DEAUTH : IEEE80211_STYPE_DISASSOC), |
@@ -1892,7 +1895,7 @@ static void handle_pspoll(local_info_t *local, | |||
1892 | return; | 1895 | return; |
1893 | } | 1896 | } |
1894 | 1897 | ||
1895 | aid = __le16_to_cpu(hdr->duration_id); | 1898 | aid = le16_to_cpu(hdr->duration_id); |
1896 | if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) { | 1899 | if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) { |
1897 | PDEBUG(DEBUG_PS, " PSPOLL and AID[15:14] not set\n"); | 1900 | PDEBUG(DEBUG_PS, " PSPOLL and AID[15:14] not set\n"); |
1898 | return; | 1901 | return; |
@@ -1998,7 +2001,8 @@ static void handle_beacon(local_info_t *local, struct sk_buff *skb, | |||
1998 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; | 2001 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; |
1999 | char *body = skb->data + IEEE80211_MGMT_HDR_LEN; | 2002 | char *body = skb->data + IEEE80211_MGMT_HDR_LEN; |
2000 | int len, left; | 2003 | int len, left; |
2001 | u16 *pos, beacon_int, capability; | 2004 | u16 beacon_int, capability; |
2005 | __le16 *pos; | ||
2002 | char *ssid = NULL; | 2006 | char *ssid = NULL; |
2003 | unsigned char *supp_rates = NULL; | 2007 | unsigned char *supp_rates = NULL; |
2004 | int ssid_len = 0, supp_rates_len = 0; | 2008 | int ssid_len = 0, supp_rates_len = 0; |
@@ -2013,16 +2017,16 @@ static void handle_beacon(local_info_t *local, struct sk_buff *skb, | |||
2013 | return; | 2017 | return; |
2014 | } | 2018 | } |
2015 | 2019 | ||
2016 | pos = (u16 *) body; | 2020 | pos = (__le16 *) body; |
2017 | left = len; | 2021 | left = len; |
2018 | 2022 | ||
2019 | /* Timestamp (8 octets) */ | 2023 | /* Timestamp (8 octets) */ |
2020 | pos += 4; left -= 8; | 2024 | pos += 4; left -= 8; |
2021 | /* Beacon interval (2 octets) */ | 2025 | /* Beacon interval (2 octets) */ |
2022 | beacon_int = __le16_to_cpu(*pos); | 2026 | beacon_int = le16_to_cpu(*pos); |
2023 | pos++; left -= 2; | 2027 | pos++; left -= 2; |
2024 | /* Capability information (2 octets) */ | 2028 | /* Capability information (2 octets) */ |
2025 | capability = __le16_to_cpu(*pos); | 2029 | capability = le16_to_cpu(*pos); |
2026 | pos++; left -= 2; | 2030 | pos++; left -= 2; |
2027 | 2031 | ||
2028 | if (local->ap->ap_policy != AP_OTHER_AP_EVEN_IBSS && | 2032 | if (local->ap->ap_policy != AP_OTHER_AP_EVEN_IBSS && |