aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-06-30 09:10:46 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-07-02 15:48:33 -0400
commitf4ea83dd743d3e1bec8fdf954ac911c6b12ae87a (patch)
tree2db594d668648779e1932981410e37258df76b2c /net/mac80211/mlme.c
parent49461622edf74cd1e1a1056cee3ca8dd90cd9556 (diff)
mac80211: rework debug settings and make debugging safer
This patch reworks the mac80211 debug settings making them more focused and adding help text for those that didn't have one. It also removes a number of printks that can be triggered remotely and add no value, e.g. "too short deauthentication frame received - ignoring". If somebody really needs to debug that they should just add a monitor interface and look at the frames in wireshark. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c206
1 files changed, 49 insertions, 157 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 0a310d09ab07..4a3bddd206d8 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -346,7 +346,7 @@ static void ieee80211_sta_wmm_params(struct net_device *dev,
346 params.cw_max = ecw2cw((pos[1] & 0xf0) >> 4); 346 params.cw_max = ecw2cw((pos[1] & 0xf0) >> 4);
347 params.cw_min = ecw2cw(pos[1] & 0x0f); 347 params.cw_min = ecw2cw(pos[1] & 0x0f);
348 params.txop = pos[2] | (pos[3] << 8); 348 params.txop = pos[2] | (pos[3] << 8);
349#ifdef CONFIG_MAC80211_DEBUG 349#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
350 printk(KERN_DEBUG "%s: WMM queue=%d aci=%d acm=%d aifs=%d " 350 printk(KERN_DEBUG "%s: WMM queue=%d aci=%d acm=%d aifs=%d "
351 "cWmin=%d cWmax=%d txop=%d\n", 351 "cWmin=%d cWmax=%d txop=%d\n",
352 dev->name, queue, aci, acm, params.aifs, params.cw_min, 352 dev->name, queue, aci, acm, params.aifs, params.cw_min,
@@ -371,6 +371,7 @@ static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata,
371 u32 changed = 0; 371 u32 changed = 0;
372 372
373 if (use_protection != bss_conf->use_cts_prot) { 373 if (use_protection != bss_conf->use_cts_prot) {
374#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
374 if (net_ratelimit()) { 375 if (net_ratelimit()) {
375 printk(KERN_DEBUG "%s: CTS protection %s (BSSID=" 376 printk(KERN_DEBUG "%s: CTS protection %s (BSSID="
376 "%s)\n", 377 "%s)\n",
@@ -378,11 +379,13 @@ static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata,
378 use_protection ? "enabled" : "disabled", 379 use_protection ? "enabled" : "disabled",
379 print_mac(mac, ifsta->bssid)); 380 print_mac(mac, ifsta->bssid));
380 } 381 }
382#endif
381 bss_conf->use_cts_prot = use_protection; 383 bss_conf->use_cts_prot = use_protection;
382 changed |= BSS_CHANGED_ERP_CTS_PROT; 384 changed |= BSS_CHANGED_ERP_CTS_PROT;
383 } 385 }
384 386
385 if (use_short_preamble != bss_conf->use_short_preamble) { 387 if (use_short_preamble != bss_conf->use_short_preamble) {
388#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
386 if (net_ratelimit()) { 389 if (net_ratelimit()) {
387 printk(KERN_DEBUG "%s: switched to %s barker preamble" 390 printk(KERN_DEBUG "%s: switched to %s barker preamble"
388 " (BSSID=%s)\n", 391 " (BSSID=%s)\n",
@@ -390,6 +393,7 @@ static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata,
390 use_short_preamble ? "short" : "long", 393 use_short_preamble ? "short" : "long",
391 print_mac(mac, ifsta->bssid)); 394 print_mac(mac, ifsta->bssid));
392 } 395 }
396#endif
393 bss_conf->use_short_preamble = use_short_preamble; 397 bss_conf->use_short_preamble = use_short_preamble;
394 changed |= BSS_CHANGED_ERP_PREAMBLE; 398 changed |= BSS_CHANGED_ERP_PREAMBLE;
395 } 399 }
@@ -1175,14 +1179,10 @@ static void ieee80211_auth_challenge(struct net_device *dev,
1175 u8 *pos; 1179 u8 *pos;
1176 struct ieee802_11_elems elems; 1180 struct ieee802_11_elems elems;
1177 1181
1178 printk(KERN_DEBUG "%s: replying to auth challenge\n", dev->name);
1179 pos = mgmt->u.auth.variable; 1182 pos = mgmt->u.auth.variable;
1180 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); 1183 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
1181 if (!elems.challenge) { 1184 if (!elems.challenge)
1182 printk(KERN_DEBUG "%s: no challenge IE in shared key auth "
1183 "frame\n", dev->name);
1184 return; 1185 return;
1185 }
1186 ieee80211_send_auth(dev, ifsta, 3, elems.challenge - 2, 1186 ieee80211_send_auth(dev, ifsta, 3, elems.challenge - 2,
1187 elems.challenge_len + 2, 1); 1187 elems.challenge_len + 2, 1);
1188} 1188}
@@ -1364,9 +1364,11 @@ static void ieee80211_sta_process_addba_request(struct net_device *dev,
1364 sta->ampdu_mlme.tid_rx[tid] = 1364 sta->ampdu_mlme.tid_rx[tid] =
1365 kmalloc(sizeof(struct tid_ampdu_rx), GFP_ATOMIC); 1365 kmalloc(sizeof(struct tid_ampdu_rx), GFP_ATOMIC);
1366 if (!sta->ampdu_mlme.tid_rx[tid]) { 1366 if (!sta->ampdu_mlme.tid_rx[tid]) {
1367#ifdef CONFIG_MAC80211_HT_DEBUG
1367 if (net_ratelimit()) 1368 if (net_ratelimit())
1368 printk(KERN_ERR "allocate rx mlme to tid %d failed\n", 1369 printk(KERN_ERR "allocate rx mlme to tid %d failed\n",
1369 tid); 1370 tid);
1371#endif
1370 goto end; 1372 goto end;
1371 } 1373 }
1372 /* rx timer */ 1374 /* rx timer */
@@ -1382,9 +1384,11 @@ static void ieee80211_sta_process_addba_request(struct net_device *dev,
1382 tid_agg_rx->reorder_buf = 1384 tid_agg_rx->reorder_buf =
1383 kmalloc(buf_size * sizeof(struct sk_buff *), GFP_ATOMIC); 1385 kmalloc(buf_size * sizeof(struct sk_buff *), GFP_ATOMIC);
1384 if (!tid_agg_rx->reorder_buf) { 1386 if (!tid_agg_rx->reorder_buf) {
1387#ifdef CONFIG_MAC80211_HT_DEBUG
1385 if (net_ratelimit()) 1388 if (net_ratelimit())
1386 printk(KERN_ERR "can not allocate reordering buffer " 1389 printk(KERN_ERR "can not allocate reordering buffer "
1387 "to tid %d\n", tid); 1390 "to tid %d\n", tid);
1391#endif
1388 kfree(sta->ampdu_mlme.tid_rx[tid]); 1392 kfree(sta->ampdu_mlme.tid_rx[tid]);
1389 goto end; 1393 goto end;
1390 } 1394 }
@@ -1451,8 +1455,6 @@ static void ieee80211_sta_process_addba_resp(struct net_device *dev,
1451 1455
1452 if (!(*state & HT_ADDBA_REQUESTED_MSK)) { 1456 if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
1453 spin_unlock_bh(&sta->lock); 1457 spin_unlock_bh(&sta->lock);
1454 printk(KERN_DEBUG "state not HT_ADDBA_REQUESTED_MSK:"
1455 "%d\n", *state);
1456 goto addba_resp_exit; 1458 goto addba_resp_exit;
1457 } 1459 }
1458 1460
@@ -1471,22 +1473,14 @@ static void ieee80211_sta_process_addba_resp(struct net_device *dev,
1471#endif /* CONFIG_MAC80211_HT_DEBUG */ 1473#endif /* CONFIG_MAC80211_HT_DEBUG */
1472 if (le16_to_cpu(mgmt->u.action.u.addba_resp.status) 1474 if (le16_to_cpu(mgmt->u.action.u.addba_resp.status)
1473 == WLAN_STATUS_SUCCESS) { 1475 == WLAN_STATUS_SUCCESS) {
1474 if (*state & HT_ADDBA_RECEIVED_MSK)
1475 printk(KERN_DEBUG "double addBA response\n");
1476
1477 *state |= HT_ADDBA_RECEIVED_MSK; 1476 *state |= HT_ADDBA_RECEIVED_MSK;
1478 sta->ampdu_mlme.addba_req_num[tid] = 0; 1477 sta->ampdu_mlme.addba_req_num[tid] = 0;
1479 1478
1480 if (*state == HT_AGG_STATE_OPERATIONAL) { 1479 if (*state == HT_AGG_STATE_OPERATIONAL)
1481 printk(KERN_DEBUG "Aggregation on for tid %d \n", tid);
1482 ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); 1480 ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]);
1483 }
1484 1481
1485 spin_unlock_bh(&sta->lock); 1482 spin_unlock_bh(&sta->lock);
1486 printk(KERN_DEBUG "recipient accepted agg: tid %d \n", tid);
1487 } else { 1483 } else {
1488 printk(KERN_DEBUG "recipient rejected agg: tid %d \n", tid);
1489
1490 sta->ampdu_mlme.addba_req_num[tid]++; 1484 sta->ampdu_mlme.addba_req_num[tid]++;
1491 /* this will allow the state check in stop_BA_session */ 1485 /* this will allow the state check in stop_BA_session */
1492 *state = HT_AGG_STATE_OPERATIONAL; 1486 *state = HT_AGG_STATE_OPERATIONAL;
@@ -1585,7 +1579,7 @@ void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *ra, u16 tid,
1585 ra, tid, NULL); 1579 ra, tid, NULL);
1586 if (ret) 1580 if (ret)
1587 printk(KERN_DEBUG "HW problem - can not stop rx " 1581 printk(KERN_DEBUG "HW problem - can not stop rx "
1588 "aggergation for tid %d\n", tid); 1582 "aggregation for tid %d\n", tid);
1589 1583
1590 /* shutdown timer has not expired */ 1584 /* shutdown timer has not expired */
1591 if (initiator != WLAN_BACK_TIMER) 1585 if (initiator != WLAN_BACK_TIMER)
@@ -1691,12 +1685,16 @@ void sta_addba_resp_timer_expired(unsigned long data)
1691 if (!(*state & HT_ADDBA_REQUESTED_MSK)) { 1685 if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
1692 spin_unlock_bh(&sta->lock); 1686 spin_unlock_bh(&sta->lock);
1693 *state = HT_AGG_STATE_IDLE; 1687 *state = HT_AGG_STATE_IDLE;
1688#ifdef CONFIG_MAC80211_HT_DEBUG
1694 printk(KERN_DEBUG "timer expired on tid %d but we are not " 1689 printk(KERN_DEBUG "timer expired on tid %d but we are not "
1695 "expecting addBA response there", tid); 1690 "expecting addBA response there", tid);
1691#endif
1696 goto timer_expired_exit; 1692 goto timer_expired_exit;
1697 } 1693 }
1698 1694
1695#ifdef CONFIG_MAC80211_HT_DEBUG
1699 printk(KERN_DEBUG "addBA response timer expired on tid %d\n", tid); 1696 printk(KERN_DEBUG "addBA response timer expired on tid %d\n", tid);
1697#endif
1700 1698
1701 /* go through the state check in stop_BA_session */ 1699 /* go through the state check in stop_BA_session */
1702 *state = HT_AGG_STATE_OPERATIONAL; 1700 *state = HT_AGG_STATE_OPERATIONAL;
@@ -1724,7 +1722,9 @@ static void sta_rx_agg_session_timer_expired(unsigned long data)
1724 struct sta_info *sta = container_of(timer_to_id, struct sta_info, 1722 struct sta_info *sta = container_of(timer_to_id, struct sta_info,
1725 timer_to_tid[0]); 1723 timer_to_tid[0]);
1726 1724
1725#ifdef CONFIG_MAC80211_HT_DEBUG
1727 printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid); 1726 printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid);
1727#endif
1728 ieee80211_sta_stop_rx_ba_session(sta->sdata->dev, sta->addr, 1728 ieee80211_sta_stop_rx_ba_session(sta->sdata->dev, sta->addr,
1729 (u16)*ptid, WLAN_BACK_TIMER, 1729 (u16)*ptid, WLAN_BACK_TIMER,
1730 WLAN_REASON_QSTA_TIMEOUT); 1730 WLAN_REASON_QSTA_TIMEOUT);
@@ -1819,47 +1819,24 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev,
1819 DECLARE_MAC_BUF(mac); 1819 DECLARE_MAC_BUF(mac);
1820 1820
1821 if (ifsta->state != IEEE80211_AUTHENTICATE && 1821 if (ifsta->state != IEEE80211_AUTHENTICATE &&
1822 sdata->vif.type != IEEE80211_IF_TYPE_IBSS) { 1822 sdata->vif.type != IEEE80211_IF_TYPE_IBSS)
1823 printk(KERN_DEBUG "%s: authentication frame received from "
1824 "%s, but not in authenticate state - ignored\n",
1825 dev->name, print_mac(mac, mgmt->sa));
1826 return; 1823 return;
1827 }
1828 1824
1829 if (len < 24 + 6) { 1825 if (len < 24 + 6)
1830 printk(KERN_DEBUG "%s: too short (%zd) authentication frame "
1831 "received from %s - ignored\n",
1832 dev->name, len, print_mac(mac, mgmt->sa));
1833 return; 1826 return;
1834 }
1835 1827
1836 if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS && 1828 if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
1837 memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { 1829 memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0)
1838 printk(KERN_DEBUG "%s: authentication frame received from "
1839 "unknown AP (SA=%s BSSID=%s) - "
1840 "ignored\n", dev->name, print_mac(mac, mgmt->sa),
1841 print_mac(mac, mgmt->bssid));
1842 return; 1830 return;
1843 }
1844 1831
1845 if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS && 1832 if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
1846 memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) { 1833 memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0)
1847 printk(KERN_DEBUG "%s: authentication frame received from "
1848 "unknown BSSID (SA=%s BSSID=%s) - "
1849 "ignored\n", dev->name, print_mac(mac, mgmt->sa),
1850 print_mac(mac, mgmt->bssid));
1851 return; 1834 return;
1852 }
1853 1835
1854 auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg); 1836 auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
1855 auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction); 1837 auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction);
1856 status_code = le16_to_cpu(mgmt->u.auth.status_code); 1838 status_code = le16_to_cpu(mgmt->u.auth.status_code);
1857 1839
1858 printk(KERN_DEBUG "%s: RX authentication from %s (alg=%d "
1859 "transaction=%d status=%d)\n",
1860 dev->name, print_mac(mac, mgmt->sa), auth_alg,
1861 auth_transaction, status_code);
1862
1863 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { 1840 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
1864 /* 1841 /*
1865 * IEEE 802.11 standard does not require authentication in IBSS 1842 * IEEE 802.11 standard does not require authentication in IBSS
@@ -1867,26 +1844,16 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev,
1867 * However, try to reply to authentication attempts if someone 1844 * However, try to reply to authentication attempts if someone
1868 * has actually implemented this. 1845 * has actually implemented this.
1869 */ 1846 */
1870 if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) { 1847 if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1)
1871 printk(KERN_DEBUG "%s: unexpected IBSS authentication "
1872 "frame (alg=%d transaction=%d)\n",
1873 dev->name, auth_alg, auth_transaction);
1874 return; 1848 return;
1875 }
1876 ieee80211_send_auth(dev, ifsta, 2, NULL, 0, 0); 1849 ieee80211_send_auth(dev, ifsta, 2, NULL, 0, 0);
1877 } 1850 }
1878 1851
1879 if (auth_alg != ifsta->auth_alg || 1852 if (auth_alg != ifsta->auth_alg ||
1880 auth_transaction != ifsta->auth_transaction) { 1853 auth_transaction != ifsta->auth_transaction)
1881 printk(KERN_DEBUG "%s: unexpected authentication frame "
1882 "(alg=%d transaction=%d)\n",
1883 dev->name, auth_alg, auth_transaction);
1884 return; 1854 return;
1885 }
1886 1855
1887 if (status_code != WLAN_STATUS_SUCCESS) { 1856 if (status_code != WLAN_STATUS_SUCCESS) {
1888 printk(KERN_DEBUG "%s: AP denied authentication (auth_alg=%d "
1889 "code=%d)\n", dev->name, ifsta->auth_alg, status_code);
1890 if (status_code == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) { 1857 if (status_code == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) {
1891 u8 algs[3]; 1858 u8 algs[3];
1892 const int num_algs = ARRAY_SIZE(algs); 1859 const int num_algs = ARRAY_SIZE(algs);
@@ -1915,9 +1882,6 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev,
1915 !ieee80211_sta_wep_configured(dev)) 1882 !ieee80211_sta_wep_configured(dev))
1916 continue; 1883 continue;
1917 ifsta->auth_alg = algs[pos]; 1884 ifsta->auth_alg = algs[pos];
1918 printk(KERN_DEBUG "%s: set auth_alg=%d for "
1919 "next try\n",
1920 dev->name, ifsta->auth_alg);
1921 break; 1885 break;
1922 } 1886 }
1923 } 1887 }
@@ -1947,27 +1911,14 @@ static void ieee80211_rx_mgmt_deauth(struct net_device *dev,
1947 u16 reason_code; 1911 u16 reason_code;
1948 DECLARE_MAC_BUF(mac); 1912 DECLARE_MAC_BUF(mac);
1949 1913
1950 if (len < 24 + 2) { 1914 if (len < 24 + 2)
1951 printk(KERN_DEBUG "%s: too short (%zd) deauthentication frame "
1952 "received from %s - ignored\n",
1953 dev->name, len, print_mac(mac, mgmt->sa));
1954 return; 1915 return;
1955 }
1956 1916
1957 if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { 1917 if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN))
1958 printk(KERN_DEBUG "%s: deauthentication frame received from "
1959 "unknown AP (SA=%s BSSID=%s) - "
1960 "ignored\n", dev->name, print_mac(mac, mgmt->sa),
1961 print_mac(mac, mgmt->bssid));
1962 return; 1918 return;
1963 }
1964 1919
1965 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); 1920 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);
1966 1921
1967 printk(KERN_DEBUG "%s: RX deauthentication from %s"
1968 " (reason=%d)\n",
1969 dev->name, print_mac(mac, mgmt->sa), reason_code);
1970
1971 if (ifsta->flags & IEEE80211_STA_AUTHENTICATED) 1922 if (ifsta->flags & IEEE80211_STA_AUTHENTICATED)
1972 printk(KERN_DEBUG "%s: deauthenticated\n", dev->name); 1923 printk(KERN_DEBUG "%s: deauthenticated\n", dev->name);
1973 1924
@@ -1992,27 +1943,14 @@ static void ieee80211_rx_mgmt_disassoc(struct net_device *dev,
1992 u16 reason_code; 1943 u16 reason_code;
1993 DECLARE_MAC_BUF(mac); 1944 DECLARE_MAC_BUF(mac);
1994 1945
1995 if (len < 24 + 2) { 1946 if (len < 24 + 2)
1996 printk(KERN_DEBUG "%s: too short (%zd) disassociation frame "
1997 "received from %s - ignored\n",
1998 dev->name, len, print_mac(mac, mgmt->sa));
1999 return; 1947 return;
2000 }
2001 1948
2002 if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { 1949 if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN))
2003 printk(KERN_DEBUG "%s: disassociation frame received from "
2004 "unknown AP (SA=%s BSSID=%s) - "
2005 "ignored\n", dev->name, print_mac(mac, mgmt->sa),
2006 print_mac(mac, mgmt->bssid));
2007 return; 1950 return;
2008 }
2009 1951
2010 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); 1952 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
2011 1953
2012 printk(KERN_DEBUG "%s: RX disassociation from %s"
2013 " (reason=%d)\n",
2014 dev->name, print_mac(mac, mgmt->sa), reason_code);
2015
2016 if (ifsta->flags & IEEE80211_STA_ASSOCIATED) 1954 if (ifsta->flags & IEEE80211_STA_ASSOCIATED)
2017 printk(KERN_DEBUG "%s: disassociated\n", dev->name); 1955 printk(KERN_DEBUG "%s: disassociated\n", dev->name);
2018 1956
@@ -2048,27 +1986,14 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2048 /* AssocResp and ReassocResp have identical structure, so process both 1986 /* AssocResp and ReassocResp have identical structure, so process both
2049 * of them in this function. */ 1987 * of them in this function. */
2050 1988
2051 if (ifsta->state != IEEE80211_ASSOCIATE) { 1989 if (ifsta->state != IEEE80211_ASSOCIATE)
2052 printk(KERN_DEBUG "%s: association frame received from "
2053 "%s, but not in associate state - ignored\n",
2054 dev->name, print_mac(mac, mgmt->sa));
2055 return; 1990 return;
2056 }
2057 1991
2058 if (len < 24 + 6) { 1992 if (len < 24 + 6)
2059 printk(KERN_DEBUG "%s: too short (%zd) association frame "
2060 "received from %s - ignored\n",
2061 dev->name, len, print_mac(mac, mgmt->sa));
2062 return; 1993 return;
2063 }
2064 1994
2065 if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { 1995 if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0)
2066 printk(KERN_DEBUG "%s: association frame received from "
2067 "unknown AP (SA=%s BSSID=%s) - "
2068 "ignored\n", dev->name, print_mac(mac, mgmt->sa),
2069 print_mac(mac, mgmt->bssid));
2070 return; 1996 return;
2071 }
2072 1997
2073 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); 1998 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info);
2074 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); 1999 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code);
@@ -2663,12 +2588,6 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
2663 if (!beacon && memcmp(mgmt->da, dev->dev_addr, ETH_ALEN)) 2588 if (!beacon && memcmp(mgmt->da, dev->dev_addr, ETH_ALEN))
2664 return; /* ignore ProbeResp to foreign address */ 2589 return; /* ignore ProbeResp to foreign address */
2665 2590
2666#if 0
2667 printk(KERN_DEBUG "%s: RX %s from %s to %s\n",
2668 dev->name, beacon ? "Beacon" : "Probe Response",
2669 print_mac(mac, mgmt->sa), print_mac(mac2, mgmt->da));
2670#endif
2671
2672 beacon_timestamp = le64_to_cpu(mgmt->u.beacon.timestamp); 2591 beacon_timestamp = le64_to_cpu(mgmt->u.beacon.timestamp);
2673 2592
2674 if (ieee80211_vif_is_mesh(&sdata->vif) && elems->mesh_id && 2593 if (ieee80211_vif_is_mesh(&sdata->vif) && elems->mesh_id &&
@@ -2698,15 +2617,6 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
2698 sta->supp_rates[rx_status->band] = 2617 sta->supp_rates[rx_status->band] =
2699 sdata->u.sta.supp_rates_bits[rx_status->band]; 2618 sdata->u.sta.supp_rates_bits[rx_status->band];
2700 } 2619 }
2701 if (sta->supp_rates[rx_status->band] != prev_rates) {
2702 printk(KERN_DEBUG "%s: updated supp_rates set for "
2703 "%s based on beacon info (0x%llx & 0x%llx -> "
2704 "0x%llx)\n",
2705 dev->name, print_mac(mac, sta->addr),
2706 (unsigned long long) prev_rates,
2707 (unsigned long long) supp_rates,
2708 (unsigned long long) sta->supp_rates[rx_status->band]);
2709 }
2710 } 2620 }
2711 2621
2712 rcu_read_unlock(); 2622 rcu_read_unlock();
@@ -2962,11 +2872,10 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
2962#endif /* CONFIG_MAC80211_IBSS_DEBUG */ 2872#endif /* CONFIG_MAC80211_IBSS_DEBUG */
2963 if (beacon_timestamp > rx_timestamp) { 2873 if (beacon_timestamp > rx_timestamp) {
2964#ifndef CONFIG_MAC80211_IBSS_DEBUG 2874#ifndef CONFIG_MAC80211_IBSS_DEBUG
2965 if (net_ratelimit()) 2875 printk(KERN_DEBUG "%s: beacon TSF higher than "
2876 "local TSF - IBSS merge with BSSID %s\n",
2877 dev->name, print_mac(mac, mgmt->bssid));
2966#endif 2878#endif
2967 printk(KERN_DEBUG "%s: beacon TSF higher than "
2968 "local TSF - IBSS merge with BSSID %s\n",
2969 dev->name, print_mac(mac, mgmt->bssid));
2970 ieee80211_sta_join_ibss(dev, &sdata->u.sta, bss); 2879 ieee80211_sta_join_ibss(dev, &sdata->u.sta, bss);
2971 ieee80211_ibss_add_sta(dev, NULL, 2880 ieee80211_ibss_add_sta(dev, NULL,
2972 mgmt->bssid, mgmt->sa, 2881 mgmt->bssid, mgmt->sa,
@@ -3106,11 +3015,11 @@ static void ieee80211_rx_mgmt_probe_req(struct net_device *dev,
3106 pos = mgmt->u.probe_req.variable; 3015 pos = mgmt->u.probe_req.variable;
3107 if (pos[0] != WLAN_EID_SSID || 3016 if (pos[0] != WLAN_EID_SSID ||
3108 pos + 2 + pos[1] > end) { 3017 pos + 2 + pos[1] > end) {
3109 if (net_ratelimit()) { 3018#ifdef CONFIG_MAC80211_IBSS_DEBUG
3110 printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " 3019 printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq "
3111 "from %s\n", 3020 "from %s\n",
3112 dev->name, print_mac(mac, mgmt->sa)); 3021 dev->name, print_mac(mac, mgmt->sa));
3113 } 3022#endif
3114 return; 3023 return;
3115 } 3024 }
3116 if (pos[1] != 0 && 3025 if (pos[1] != 0 &&
@@ -3179,11 +3088,6 @@ static void ieee80211_rx_mgmt_action(struct net_device *dev,
3179 break; 3088 break;
3180 ieee80211_sta_process_delba(dev, mgmt, len); 3089 ieee80211_sta_process_delba(dev, mgmt, len);
3181 break; 3090 break;
3182 default:
3183 if (net_ratelimit())
3184 printk(KERN_DEBUG "%s: Rx unknown A-MPDU action\n",
3185 dev->name);
3186 break;
3187 } 3091 }
3188 break; 3092 break;
3189 case PLINK_CATEGORY: 3093 case PLINK_CATEGORY:
@@ -3194,11 +3098,6 @@ static void ieee80211_rx_mgmt_action(struct net_device *dev,
3194 if (ieee80211_vif_is_mesh(&sdata->vif)) 3098 if (ieee80211_vif_is_mesh(&sdata->vif))
3195 mesh_rx_path_sel_frame(dev, mgmt, len); 3099 mesh_rx_path_sel_frame(dev, mgmt, len);
3196 break; 3100 break;
3197 default:
3198 if (net_ratelimit())
3199 printk(KERN_DEBUG "%s: Rx unknown action frame - "
3200 "category=%d\n", dev->name, mgmt->u.action.category);
3201 break;
3202 } 3101 }
3203} 3102}
3204 3103
@@ -3234,11 +3133,6 @@ void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb,
3234 skb_queue_tail(&ifsta->skb_queue, skb); 3133 skb_queue_tail(&ifsta->skb_queue, skb);
3235 queue_work(local->hw.workqueue, &ifsta->work); 3134 queue_work(local->hw.workqueue, &ifsta->work);
3236 return; 3135 return;
3237 default:
3238 printk(KERN_DEBUG "%s: received unknown management frame - "
3239 "stype=%d\n", dev->name,
3240 (fc & IEEE80211_FCTL_STYPE) >> 4);
3241 break;
3242 } 3136 }
3243 3137
3244 fail: 3138 fail:
@@ -3367,8 +3261,10 @@ static void ieee80211_sta_expire(struct net_device *dev, unsigned long exp_time)
3367 spin_lock_irqsave(&local->sta_lock, flags); 3261 spin_lock_irqsave(&local->sta_lock, flags);
3368 list_for_each_entry_safe(sta, tmp, &local->sta_list, list) 3262 list_for_each_entry_safe(sta, tmp, &local->sta_list, list)
3369 if (time_after(jiffies, sta->last_rx + exp_time)) { 3263 if (time_after(jiffies, sta->last_rx + exp_time)) {
3264#ifdef CONFIG_MAC80211_IBSS_DEBUG
3370 printk(KERN_DEBUG "%s: expiring inactive STA %s\n", 3265 printk(KERN_DEBUG "%s: expiring inactive STA %s\n",
3371 dev->name, print_mac(mac, sta->addr)); 3266 dev->name, print_mac(mac, sta->addr));
3267#endif
3372 __sta_info_unlink(&sta); 3268 __sta_info_unlink(&sta);
3373 if (sta) 3269 if (sta)
3374 list_add(&sta->list, &tmp_list); 3270 list_add(&sta->list, &tmp_list);
@@ -3451,13 +3347,10 @@ void ieee80211_sta_work(struct work_struct *work)
3451 if (local->sta_sw_scanning || local->sta_hw_scanning) 3347 if (local->sta_sw_scanning || local->sta_hw_scanning)
3452 return; 3348 return;
3453 3349
3454 if (sdata->vif.type != IEEE80211_IF_TYPE_STA && 3350 if (WARN_ON(sdata->vif.type != IEEE80211_IF_TYPE_STA &&
3455 sdata->vif.type != IEEE80211_IF_TYPE_IBSS && 3351 sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
3456 sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) { 3352 sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT))
3457 printk(KERN_DEBUG "%s: ieee80211_sta_work: non-STA interface "
3458 "(type=%d)\n", dev->name, sdata->vif.type);
3459 return; 3353 return;
3460 }
3461 ifsta = &sdata->u.sta; 3354 ifsta = &sdata->u.sta;
3462 3355
3463 while ((skb = skb_dequeue(&ifsta->skb_queue))) 3356 while ((skb = skb_dequeue(&ifsta->skb_queue)))
@@ -3511,8 +3404,7 @@ void ieee80211_sta_work(struct work_struct *work)
3511 break; 3404 break;
3512#endif 3405#endif
3513 default: 3406 default:
3514 printk(KERN_DEBUG "ieee80211_sta_work: Unknown state %d\n", 3407 WARN_ON(1);
3515 ifsta->state);
3516 break; 3408 break;
3517 } 3409 }
3518 3410
@@ -3547,8 +3439,6 @@ static void ieee80211_sta_reset_auth(struct net_device *dev,
3547 ifsta->auth_alg = WLAN_AUTH_LEAP; 3439 ifsta->auth_alg = WLAN_AUTH_LEAP;
3548 else 3440 else
3549 ifsta->auth_alg = WLAN_AUTH_OPEN; 3441 ifsta->auth_alg = WLAN_AUTH_OPEN;
3550 printk(KERN_DEBUG "%s: Initial auth_alg=%d\n", dev->name,
3551 ifsta->auth_alg);
3552 ifsta->auth_transaction = -1; 3442 ifsta->auth_transaction = -1;
3553 ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; 3443 ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;
3554 ifsta->auth_tries = ifsta->assoc_tries = 0; 3444 ifsta->auth_tries = ifsta->assoc_tries = 0;
@@ -4474,8 +4364,10 @@ struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev,
4474 if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) 4364 if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid))
4475 return NULL; 4365 return NULL;
4476 4366
4367#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
4477 printk(KERN_DEBUG "%s: Adding new IBSS station %s (dev=%s)\n", 4368 printk(KERN_DEBUG "%s: Adding new IBSS station %s (dev=%s)\n",
4478 wiphy_name(local->hw.wiphy), print_mac(mac, addr), dev->name); 4369 wiphy_name(local->hw.wiphy), print_mac(mac, addr), dev->name);
4370#endif
4479 4371
4480 sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); 4372 sta = sta_info_alloc(sdata, addr, GFP_ATOMIC);
4481 if (!sta) 4373 if (!sta)
@@ -4502,7 +4394,7 @@ int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason)
4502 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 4394 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
4503 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 4395 struct ieee80211_if_sta *ifsta = &sdata->u.sta;
4504 4396
4505 printk(KERN_DEBUG "%s: deauthenticate(reason=%d)\n", 4397 printk(KERN_DEBUG "%s: deauthenticating by local choice (reason=%d)\n",
4506 dev->name, reason); 4398 dev->name, reason);
4507 4399
4508 if (sdata->vif.type != IEEE80211_IF_TYPE_STA && 4400 if (sdata->vif.type != IEEE80211_IF_TYPE_STA &&
@@ -4520,7 +4412,7 @@ int ieee80211_sta_disassociate(struct net_device *dev, u16 reason)
4520 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 4412 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
4521 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 4413 struct ieee80211_if_sta *ifsta = &sdata->u.sta;
4522 4414
4523 printk(KERN_DEBUG "%s: disassociate(reason=%d)\n", 4415 printk(KERN_DEBUG "%s: disassociating by local choice (reason=%d)\n",
4524 dev->name, reason); 4416 dev->name, reason);
4525 4417
4526 if (sdata->vif.type != IEEE80211_IF_TYPE_STA) 4418 if (sdata->vif.type != IEEE80211_IF_TYPE_STA)