Commit f4ea83dd authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

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: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 49461622
...@@ -88,10 +88,16 @@ config MAC80211_DEBUGFS ...@@ -88,10 +88,16 @@ config MAC80211_DEBUGFS
Say N unless you know you need this. Say N unless you know you need this.
menuconfig MAC80211_DEBUG_MENU
bool "Select mac80211 debugging features"
depends on MAC80211
---help---
This option collects various mac80211 debug settings.
config MAC80211_DEBUG_PACKET_ALIGNMENT config MAC80211_DEBUG_PACKET_ALIGNMENT
bool "Enable packet alignment debugging" bool "Enable packet alignment debugging"
depends on MAC80211 depends on MAC80211_DEBUG_MENU
help ---help---
This option is recommended for driver authors and strongly This option is recommended for driver authors and strongly
discouraged for everybody else, it will trigger a warning discouraged for everybody else, it will trigger a warning
when a driver hands mac80211 a buffer that is aligned in when a driver hands mac80211 a buffer that is aligned in
...@@ -100,33 +106,95 @@ config MAC80211_DEBUG_PACKET_ALIGNMENT ...@@ -100,33 +106,95 @@ config MAC80211_DEBUG_PACKET_ALIGNMENT
Say N unless you're writing a mac80211 based driver. Say N unless you're writing a mac80211 based driver.
config MAC80211_DEBUG config MAC80211_NOINLINE
bool "Enable debugging output" bool "Do not inline TX/RX handlers"
depends on MAC80211 depends on MAC80211_DEBUG_MENU
---help--- ---help---
This option will enable debug tracing output for the This option affects code generation in mac80211, when
ieee80211 network stack. selected some functions are marked "noinline" to allow
easier debugging of problems in the transmit and receive
paths.
This option increases code size a bit and inserts a lot
of function calls in the code, but is otherwise safe to
enable.
If you are not trying to debug or develop the ieee80211 If unsure, say N unless you expect to be finding problems
subsystem, you most likely want to say N here. in mac80211.
config MAC80211_VERBOSE_DEBUG
bool "Verbose debugging output"
depends on MAC80211_DEBUG_MENU
---help---
Selecting this option causes mac80211 to print out
many debugging messages. It should not be selected
on production systems as some of the messages are
remotely triggerable.
Do not select this option.
config MAC80211_HT_DEBUG config MAC80211_HT_DEBUG
bool "Enable HT debugging output" bool "Verbose HT debugging"
depends on MAC80211_DEBUG depends on MAC80211_DEBUG_MENU
---help--- ---help---
This option enables 802.11n High Throughput features This option enables 802.11n High Throughput features
debug tracing output. debug tracing output.
If you are not trying to debug of develop the ieee80211 It should not be selected on production systems as some
subsystem, you most likely want to say N here. of the messages are remotely triggerable.
config MAC80211_VERBOSE_DEBUG Do not select this option.
bool "Verbose debugging output"
depends on MAC80211_DEBUG config MAC80211_TKIP_DEBUG
bool "Verbose TKIP debugging"
depends on MAC80211_DEBUG_MENU
---help---
Selecting this option causes mac80211 to print out
very verbose TKIP debugging messages. It should not
be selected on production systems as those messages
are remotely triggerable.
Do not select this option.
config MAC80211_IBSS_DEBUG
bool "Verbose IBSS debugging"
depends on MAC80211_DEBUG_MENU
---help---
Selecting this option causes mac80211 to print out
very verbose IBSS debugging messages. It should not
be selected on production systems as those messages
are remotely triggerable.
Do not select this option.
config MAC80211_VERBOSE_PS_DEBUG
bool "Verbose powersave mode debugging"
depends on MAC80211_DEBUG_MENU
---help---
Selecting this option causes mac80211 to print out very
verbose power save mode debugging messages (when mac80211
is an AP and has power saving stations.)
It should not be selected on production systems as those
messages are remotely triggerable.
Do not select this option.
config MAC80211_VERBOSE_MPL_DEBUG
bool "Verbose mesh peer link debugging"
depends on MAC80211_DEBUG_MENU
depends on MAC80211_MESH
---help---
Selecting this option causes mac80211 to print out very
verbose mesh peer link debugging messages (when mac80211
is taking part in a mesh network).
It should not be selected on production systems as those
messages are remotely triggerable.
Do not select this option.
config MAC80211_LOWTX_FRAME_DUMP config MAC80211_LOWTX_FRAME_DUMP
bool "Debug frame dumping" bool "Debug frame dumping"
depends on MAC80211_DEBUG depends on MAC80211_DEBUG_MENU
---help--- ---help---
Selecting this option will cause the stack to Selecting this option will cause the stack to
print a message for each frame that is handed print a message for each frame that is handed
...@@ -137,33 +205,17 @@ config MAC80211_LOWTX_FRAME_DUMP ...@@ -137,33 +205,17 @@ config MAC80211_LOWTX_FRAME_DUMP
If unsure, say N and insert the debugging code If unsure, say N and insert the debugging code
you require into the driver you are debugging. you require into the driver you are debugging.
config MAC80211_TKIP_DEBUG
bool "TKIP debugging"
depends on MAC80211_DEBUG
config MAC80211_DEBUG_COUNTERS config MAC80211_DEBUG_COUNTERS
bool "Extra statistics for TX/RX debugging" bool "Extra statistics for TX/RX debugging"
depends on MAC80211_DEBUG depends on MAC80211_DEBUG
depends on MAC80211_DEBUG_MENU
config MAC80211_IBSS_DEBUG depends on MAC80211_DEBUGFS
bool "Support for IBSS testing"
depends on MAC80211_DEBUG
---help---
Say Y here if you intend to debug the IBSS code.
config MAC80211_VERBOSE_PS_DEBUG
bool "Verbose powersave mode debugging"
depends on MAC80211_DEBUG
---help--- ---help---
Say Y here to print out verbose powersave Selecting this option causes mac80211 to keep additional
mode debug messages. and very verbose statistics about TX and RX handler use
and show them in debugfs.
config MAC80211_VERBOSE_MPL_DEBUG If unsure, say N.
bool "Verbose mesh peer link debugging"
depends on MAC80211_DEBUG && MAC80211_MESH
---help---
Say Y here to print out verbose mesh peer link
debug messages.
config MAC80211_VERBOSE_SPECT_MGMT_DEBUG config MAC80211_VERBOSE_SPECT_MGMT_DEBUG
bool "Verbose Spectrum Management (IEEE 802.11h)debugging" bool "Verbose Spectrum Management (IEEE 802.11h)debugging"
......
...@@ -954,7 +954,7 @@ int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, ...@@ -954,7 +954,7 @@ int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx, void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx,
struct ieee80211_hdr *hdr); struct ieee80211_hdr *hdr);
#ifdef CONFIG_MAC80211_DEBUG #ifdef CONFIG_MAC80211_NOINLINE
#define debug_noinline noinline #define debug_noinline noinline
#else #else
#define debug_noinline #define debug_noinline
......
...@@ -184,9 +184,9 @@ void ieee80211_if_set_type(struct net_device *dev, int type) ...@@ -184,9 +184,9 @@ void ieee80211_if_set_type(struct net_device *dev, int type)
sdata->u.mntr_flags = MONITOR_FLAG_CONTROL | sdata->u.mntr_flags = MONITOR_FLAG_CONTROL |
MONITOR_FLAG_OTHER_BSS; MONITOR_FLAG_OTHER_BSS;
break; break;
default: case IEEE80211_IF_TYPE_INVALID:
printk(KERN_WARNING "%s: %s: Unknown interface type 0x%x", BUG();
dev->name, __func__, type); break;
} }
ieee80211_debugfs_change_if_type(sdata, oldtype); ieee80211_debugfs_change_if_type(sdata, oldtype);
} }
......
...@@ -151,9 +151,7 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu) ...@@ -151,9 +151,7 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
/* FIX: what would be proper limits for MTU? /* FIX: what would be proper limits for MTU?
* This interface uses 802.3 frames. */ * This interface uses 802.3 frames. */
if (new_mtu < 256 || if (new_mtu < 256 ||
new_mtu > IEEE80211_MAX_DATA_LEN - 24 - 6 - meshhdrlen) { new_mtu > IEEE80211_MAX_DATA_LEN - 24 - 6 - meshhdrlen) {
printk(KERN_WARNING "%s: invalid MTU %d\n",
dev->name, new_mtu);
return -EINVAL; return -EINVAL;
} }
...@@ -589,7 +587,9 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid) ...@@ -589,7 +587,9 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid)
sta = sta_info_get(local, ra); sta = sta_info_get(local, ra);
if (!sta) { if (!sta) {
#ifdef CONFIG_MAC80211_HT_DEBUG
printk(KERN_DEBUG "Could not find the station\n"); printk(KERN_DEBUG "Could not find the station\n");
#endif
ret = -ENOENT; ret = -ENOENT;
goto exit; goto exit;
} }
...@@ -617,9 +617,11 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid) ...@@ -617,9 +617,11 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid)
sta->ampdu_mlme.tid_tx[tid] = sta->ampdu_mlme.tid_tx[tid] =
kmalloc(sizeof(struct tid_ampdu_tx), GFP_ATOMIC); kmalloc(sizeof(struct tid_ampdu_tx), GFP_ATOMIC);
if (!sta->ampdu_mlme.tid_tx[tid]) { if (!sta->ampdu_mlme.tid_tx[tid]) {
#ifdef CONFIG_MAC80211_HT_DEBUG
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_ERR "allocate tx mlme to tid %d failed\n", printk(KERN_ERR "allocate tx mlme to tid %d failed\n",
tid); tid);
#endif
ret = -ENOMEM; ret = -ENOMEM;
goto err_unlock_sta; goto err_unlock_sta;
} }
...@@ -689,7 +691,9 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid) ...@@ -689,7 +691,9 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid)
sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.expires = sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.expires =
jiffies + ADDBA_RESP_INTERVAL; jiffies + ADDBA_RESP_INTERVAL;
add_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer); add_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer);
#ifdef CONFIG_MAC80211_HT_DEBUG
printk(KERN_DEBUG "activated addBA response timer on tid %d\n", tid); printk(KERN_DEBUG "activated addBA response timer on tid %d\n", tid);
#endif
goto exit; goto exit;
err_unlock_queue: err_unlock_queue:
...@@ -771,8 +775,10 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid) ...@@ -771,8 +775,10 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
DECLARE_MAC_BUF(mac); DECLARE_MAC_BUF(mac);
if (tid >= STA_TID_NUM) { if (tid >= STA_TID_NUM) {
#ifdef CONFIG_MAC80211_HT_DEBUG
printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n", printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n",
tid, STA_TID_NUM); tid, STA_TID_NUM);
#endif
return; return;
} }
...@@ -780,8 +786,10 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid) ...@@ -780,8 +786,10 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
sta = sta_info_get(local, ra); sta = sta_info_get(local, ra);
if (!sta) { if (!sta) {
rcu_read_unlock(); rcu_read_unlock();
#ifdef CONFIG_MAC80211_HT_DEBUG
printk(KERN_DEBUG "Could not find station: %s\n", printk(KERN_DEBUG "Could not find station: %s\n",
print_mac(mac, ra)); print_mac(mac, ra));
#endif
return; return;
} }
...@@ -789,8 +797,10 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid) ...@@ -789,8 +797,10 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
spin_lock_bh(&sta->lock); spin_lock_bh(&sta->lock);
if (!(*state & HT_ADDBA_REQUESTED_MSK)) { if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
#ifdef CONFIG_MAC80211_HT_DEBUG
printk(KERN_DEBUG "addBA was not requested yet, state is %d\n", printk(KERN_DEBUG "addBA was not requested yet, state is %d\n",
*state); *state);
#endif
spin_unlock_bh(&sta->lock); spin_unlock_bh(&sta->lock);
rcu_read_unlock(); rcu_read_unlock();
return; return;
...@@ -801,7 +811,9 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid) ...@@ -801,7 +811,9 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
*state |= HT_ADDBA_DRV_READY_MSK; *state |= HT_ADDBA_DRV_READY_MSK;
if (*state == HT_AGG_STATE_OPERATIONAL) { if (*state == HT_AGG_STATE_OPERATIONAL) {
#ifdef CONFIG_MAC80211_HT_DEBUG
printk(KERN_DEBUG "Aggregation is on for tid %d \n", tid); printk(KERN_DEBUG "Aggregation is on for tid %d \n", tid);
#endif
ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]);
} }
spin_unlock_bh(&sta->lock); spin_unlock_bh(&sta->lock);
...@@ -818,8 +830,10 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid) ...@@ -818,8 +830,10 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid)
DECLARE_MAC_BUF(mac); DECLARE_MAC_BUF(mac);
if (tid >= STA_TID_NUM) { if (tid >= STA_TID_NUM) {
#ifdef CONFIG_MAC80211_HT_DEBUG
printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n", printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n",
tid, STA_TID_NUM); tid, STA_TID_NUM);
#endif
return; return;
} }
...@@ -831,8 +845,10 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid) ...@@ -831,8 +845,10 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid)
rcu_read_lock(); rcu_read_lock();
sta = sta_info_get(local, ra); sta = sta_info_get(local, ra);
if (!sta) { if (!sta) {
#ifdef CONFIG_MAC80211_HT_DEBUG
printk(KERN_DEBUG "Could not find station: %s\n", printk(KERN_DEBUG "Could not find station: %s\n",
print_mac(mac, ra)); print_mac(mac, ra));
#endif
rcu_read_unlock(); rcu_read_unlock();
return; return;
} }
...@@ -842,7 +858,9 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid) ...@@ -842,7 +858,9 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid)
* ieee80211_stop_tx_ba_session will let only * ieee80211_stop_tx_ba_session will let only
* one stop call to pass through per sta/tid */ * one stop call to pass through per sta/tid */
if ((*state & HT_AGG_STATE_REQ_STOP_BA_MSK) == 0) { if ((*state & HT_AGG_STATE_REQ_STOP_BA_MSK) == 0) {
#ifdef CONFIG_MAC80211_HT_DEBUG
printk(KERN_DEBUG "unexpected callback to A-MPDU stop\n"); printk(KERN_DEBUG "unexpected callback to A-MPDU stop\n");
#endif
rcu_read_unlock(); rcu_read_unlock();
return; return;
} }
...@@ -884,9 +902,11 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, ...@@ -884,9 +902,11 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw,
struct sk_buff *skb = dev_alloc_skb(0); struct sk_buff *skb = dev_alloc_skb(0);
if (unlikely(!skb)) { if (unlikely(!skb)) {
#ifdef CONFIG_MAC80211_HT_DEBUG
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING "%s: Not enough memory, " printk(KERN_WARNING "%s: Not enough memory, "
"dropping start BA session", skb->dev->name); "dropping start BA session", skb->dev->name);
#endif
return; return;
} }
ra_tid = (struct ieee80211_ra_tid *) &skb->cb; ra_tid = (struct ieee80211_ra_tid *) &skb->cb;
...@@ -907,9 +927,11 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, ...@@ -907,9 +927,11 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw,
struct sk_buff *skb = dev_alloc_skb(0); struct sk_buff *skb = dev_alloc_skb(0);
if (unlikely(!skb)) { if (unlikely(!skb)) {
#ifdef CONFIG_MAC80211_HT_DEBUG
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING "%s: Not enough memory, " printk(KERN_WARNING "%s: Not enough memory, "
"dropping stop BA session", skb->dev->name); "dropping stop BA session", skb->dev->name);
#endif
return; return;
} }
ra_tid = (struct ieee80211_ra_tid *) &skb->cb; ra_tid = (struct ieee80211_ra_tid *) &skb->cb;
...@@ -1236,9 +1258,8 @@ static void ieee80211_tasklet_handler(unsigned long data) ...@@ -1236,9 +1258,8 @@ static void ieee80211_tasklet_handler(unsigned long data)
ra_tid->ra, ra_tid->tid); ra_tid->ra, ra_tid->tid);
dev_kfree_skb(skb); dev_kfree_skb(skb);
break ; break ;
default: /* should never get here! */ default:
printk(KERN_ERR "%s: Unknown message type (%d)\n", WARN_ON(1);
wiphy_name(local->hw.wiphy), skb->pkt_type);
dev_kfree_skb(skb); dev_kfree_skb(skb);
break; break;
} }
...@@ -1365,12 +1386,14 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, ...@@ -1365,12 +1386,14 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
return; return;
} }
#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_DEBUG "%s: dropped TX filtered frame, " printk(KERN_DEBUG "%s: dropped TX filtered frame, "
"queue_len=%d PS=%d @%lu\n", "queue_len=%d PS=%d @%lu\n",
wiphy_name(local->hw.wiphy), wiphy_name(local->hw.wiphy),
skb_queue_len(&sta->tx_filtered), skb_queue_len(&sta->tx_filtered),
!!test_sta_flags(sta, WLAN_STA_PS), jiffies); !!test_sta_flags(sta, WLAN_STA_PS), jiffies);
#endif
dev_kfree_skb(skb); dev_kfree_skb(skb);
} }
......
This diff is collapsed.
...@@ -613,11 +613,6 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) ...@@ -613,11 +613,6 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
rx->key->tx_rx_count++; rx->key->tx_rx_count++;
/* TODO: add threshold stuff again */ /* TODO: add threshold stuff again */
} else { } else {
#ifdef CONFIG_MAC80211_DEBUG
if (net_ratelimit())
printk(KERN_DEBUG "%s: RX protected frame,"
" but have no key\n", rx->dev->name);
#endif /* CONFIG_MAC80211_DEBUG */
return RX_DROP_MONITOR; return RX_DROP_MONITOR;
} }
...@@ -789,7 +784,7 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata, ...@@ -789,7 +784,7 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata,
sdata->fragment_next = 0; sdata->fragment_next = 0;
if (!skb_queue_empty(&entry->skb_list)) { if (!skb_queue_empty(&entry->skb_list)) {
#ifdef CONFIG_MAC80211_DEBUG #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
struct ieee80211_hdr *hdr = struct ieee80211_hdr *hdr =
(struct ieee80211_hdr *) entry->skb_list.next->data; (struct ieee80211_hdr *) entry->skb_list.next->data;
DECLARE_MAC_BUF(mac); DECLARE_MAC_BUF(mac);
...@@ -801,7 +796,7 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata, ...@@ -801,7 +796,7 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata,
jiffies - entry->first_frag_time, entry->seq, jiffies - entry->first_frag_time, entry->seq,
entry->last_frag, print_mac(mac, hdr->addr1), entry->last_frag, print_mac(mac, hdr->addr1),
print_mac(mac2, hdr->addr2)); print_mac(mac2, hdr->addr2));
#endif /* CONFIG_MAC80211_DEBUG */ #endif
__skb_queue_purge(&entry->skb_list); __skb_queue_purge(&entry->skb_list);
} }
...@@ -922,18 +917,8 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) ...@@ -922,18 +917,8 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
break; break;
} }
rpn = rx->key->u.ccmp.rx_pn[rx->queue]; rpn = rx->key->u.ccmp.rx_pn[rx->queue];
if (memcmp(pn, rpn, CCMP_PN_LEN) != 0) { if (memcmp(pn, rpn, CCMP_PN_LEN))
if (net_ratelimit())
printk(KERN_DEBUG "%s: defrag: CCMP PN not "
"sequential A2=%s"
" PN=%02x%02x%02x%02x%02x%02x "
"(expected %02x%02x%02x%02x%02x%02x)\n",
rx->dev->name, print_mac(mac, hdr->addr2),
rpn[0], rpn[1], rpn[2], rpn[3], rpn[4],
rpn[5], pn[0], pn[1], pn[2], pn[3],
pn[4], pn[5]);
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
}
memcpy(entry->last_pn, pn, CCMP_PN_LEN); memcpy(entry->last_pn, pn, CCMP_PN_LEN);
} }
...@@ -1037,7 +1022,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx) ...@@ -1037,7 +1022,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx)
* have nothing buffered for it? * have nothing buffered for it?
*/ */
printk(KERN_DEBUG "%s: STA %s sent PS Poll even " printk(KERN_DEBUG "%s: STA %s sent PS Poll even "
"though there is no buffered frames for it\n", "though there are no buffered frames for it\n",
rx->dev->name, print_mac(mac, rx->sta->addr)); rx->dev->name, print_mac(mac, rx->sta->addr));
#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
} }
...@@ -1073,14 +1058,8 @@ static int ...@@ -1073,14 +1058,8 @@ static int
ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx) ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx)
{ {
if (unlikely(!rx->sta || if (unlikely(!rx->sta ||
!test_sta_flags(rx->sta, WLAN_STA_AUTHORIZED))) { !test_sta_flags(rx->sta, WLAN_STA_AUTHORIZED)))
#ifdef CONFIG_MAC80211_DEBUG
if (net_ratelimit())
printk(KERN_DEBUG "%s: dropped frame "
"(unauthorized port)\n", rx->dev->name);
#endif /* CONFIG_MAC80211_DEBUG */
return -EACCES; return -EACCES;
}
return 0; return 0;
} }
...@@ -1160,16 +1139,8 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx) ...@@ -1160,16 +1139,8 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
memcpy(src, hdr->addr2, ETH_ALEN); memcpy(src, hdr->addr2, ETH_ALEN);
if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_AP && if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_AP &&
sdata->vif.type != IEEE80211_IF_TYPE_VLAN)) { sdata->vif.type != IEEE80211_IF_TYPE_VLAN))
if (net_ratelimit())
printk(KERN_DEBUG "%s: dropped ToDS frame "
"(BSSID=%s SA=%s DA=%s)\n",
dev->name,
print_mac(mac, hdr->addr1),
print_mac(mac2, hdr->addr2),
print_mac(mac3, hdr->addr3));
return -1; return -1;
}
break; break;
case (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS): case (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS):
/* RA TA DA SA */ /* RA TA DA SA */
...@@ -1177,17 +1148,8 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx) ...@@ -1177,17 +1148,8 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
memcpy(src, hdr->addr4, ETH_ALEN); memcpy(src, hdr->addr4, ETH_ALEN);
if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_WDS && if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_WDS &&
sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)) { sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT))
if (net_ratelimit())
printk(KERN_DEBUG "%s: dropped FromDS&ToDS "
"frame (RA=%s TA=%s DA=%s SA=%s)\n",
rx->dev->name,
print_mac(mac, hdr->addr1),
print_mac(mac2, hdr->addr2),
print_mac(mac3, hdr->addr3),
print_mac(mac4, hdr->addr4));
return -1; return -1;
}
break; break;
case IEEE80211_FCTL_FROMDS: case IEEE80211_FCTL_FROMDS:
/* DA BSSID SA */ /* DA BSSID SA */
...@@ -1204,27 +1166,13 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx) ...@@ -1204,27 +1166,13 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
memcpy(dst, hdr->addr1, ETH_ALEN); memcpy(dst, hdr->addr1, ETH_ALEN);
memcpy(src, hdr->addr2, ETH_ALEN); memcpy(src, hdr->addr2, ETH_ALEN);
if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS) { if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS)
if (net_ratelimit()) {
printk(KERN_DEBUG "%s: dropped IBSS frame "
"(DA=%s SA=%s BSSID=%s)\n",
dev->name,
print_mac(mac, hdr->addr1),
print_mac(mac2, hdr->addr2),
print_mac(mac3, hdr->addr3));
}
return -1; return -1;
}
break; break;
} }
if (unlikely(skb->len - hdrlen < 8)) { if (unlikely(skb->len - hdrlen < 8))
if (net_ratelimit()) {
printk(KERN_DEBUG "%s: RX too short data frame "
"payload\n", dev->name);
}
return -1; return -1;
}
payload = skb->data + hdrlen; payload = skb->data + hdrlen;
ethertype = (payload[6] << 8) | payload[7]; ethertype = (payload[6] << 8) | payload[7];
...@@ -1416,10 +1364,8 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) ...@@ -1416,10 +1364,8 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
padding = ((4 - subframe_len) & 0x3); padding = ((4 - subframe_len) & 0x3);
/* the last MSDU has no padding */ /* the last MSDU has no padding */
if (subframe_len > remaining) { if (subframe_len > remaining)
printk(KERN_DEBUG "%s: wrong buffer size\n", dev->name);
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
}
skb_pull(skb, sizeof(struct ethhdr)); skb_pull(skb, sizeof(struct ethhdr));
/* if last subframe reuse skb */ /* if last subframe reuse skb */
...@@ -1440,8 +1386,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) ...@@ -1440,8 +1386,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
eth = (struct ethhdr *) skb_pull(skb, ntohs(len) + eth = (struct ethhdr *) skb_pull(skb, ntohs(len) +
padding); padding);
if (!eth) { if (!eth) {
printk(KERN_DEBUG "%s: wrong buffer size\n",
dev->name);
dev_kfree_skb(frame); dev_kfree_skb(frame);
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
} }
...@@ -1593,31 +1537,16 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev, ...@@ -1593,31 +1537,16 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev,
else else
keyidx = -1; keyidx = -1;
if (net_ratelimit())
printk(KERN_DEBUG "%s: TKIP hwaccel reported Michael MIC "
"failure from %s to %s keyidx=%d\n",
dev->name, print_mac(mac, hdr->addr2),
print_mac(mac2, hdr->addr1), keyidx);
if (!rx->sta) { if (!rx->sta) {
/* /*
* Some hardware seem to generate incorrect Michael MIC * Some hardware seem to generate incorrect Michael MIC
* reports; ignore them to avoid triggering countermeasures. * reports; ignore them to avoid triggering countermeasures.
*/ */
if (net_ratelimit())
printk(KERN_DEBUG "%s: ignored spurious Michael MIC "
"error for unknown address %s\n",
dev->name, print_mac(mac, hdr->addr2));
goto ignore; goto ignore;
} }
if (!(rx->fc & IEEE80211_FCTL_PROTECTED)) { if (!(rx->fc & IEEE80211_FCTL_PROTECTED))
if (net_ratelimit())
printk(KERN_DEBUG "%s: ignored spurious Michael MIC "
"error for a frame with no PROTECTED flag (src "
"%s)\n", dev->name, print_mac(mac, hdr->addr2));
goto ignore; goto ignore;
}
if (rx->sdata->vif.type == IEEE80211_IF_TYPE_AP && keyidx) { if (rx->sdata->vif.type == IEEE80211_IF_TYPE_AP && keyidx) {
/* /*
...@@ -1626,24 +1555,13 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev, ...@@ -1626,24 +1555,13 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev,
* group keys and only the AP is sending real multicast * group keys and only the AP is sending real multicast
* frames in the BSS. * frames in the BSS.
*/ */
if (net_ratelimit())
printk(KERN_DEBUG "%s: ignored Michael MIC error for "
"a frame with non-zero keyidx (%d)"
" (src %s)\n", dev->name, keyidx,
print_mac(mac, hdr->addr2));
goto ignore; goto ignore;
} }
if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA && if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA &&
((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT || ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT ||
(rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_AUTH)) { (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_AUTH))
if (net_ratelimit())
printk(KERN_DEBUG "%s: ignored spurious Michael MIC "
"error for a frame that cannot be encrypted "
"(fc=0x%04x) (src %s)\n",
dev->name, rx->fc, print_mac(mac, hdr->addr2));
goto ignore; goto ignore;
}
mac80211_ev_michael_mic_failure(rx->dev, keyidx, hdr); mac80211_ev_michael_mic_failure(rx->dev, keyidx, hdr);
ignore: ignore:
......
...@@ -554,8 +554,10 @@ static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local, ...@@ -554,8 +554,10 @@ static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
sdata = sta->sdata; sdata = sta->sdata;
local->total_ps_buffered--; local->total_ps_buffered--;
#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
printk(KERN_DEBUG "Buffered frame expired (STA " printk(KERN_DEBUG "Buffered frame expired (STA "
"%s)\n", print_mac(mac, sta->addr)); "%s)\n", print_mac(mac, sta->addr));
#endif
dev_kfree_skb(skb); dev_kfree_skb(skb);
if (skb_queue_empty(&sta->ps_tx_buf)) if (skb_queue_empty(&sta->ps_tx_buf))
......
...@@ -327,8 +327,10 @@ static void purge_old_ps_buffers(struct ieee80211_local *local) ...@@ -327,8 +327,10 @@ static void purge_old_ps_buffers(struct ieee80211_local *local)
rcu_read_unlock(); rcu_read_unlock();
local->total_ps_buffered = total; local->total_ps_buffered = total;
#ifdef MAC80211_VERBOSE_PS_DEBUG
printk(KERN_DEBUG "%s: PS buffers full - purged %d frames\n", printk(KERN_DEBUG "%s: PS buffers full - purged %d frames\n",
wiphy_name(local->hw.wiphy), purged); wiphy_name(local->hw.wiphy), purged);
#endif
} }
static ieee80211_tx_result static ieee80211_tx_result
...@@ -358,11 +360,13 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) ...@@ -358,11 +360,13 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
purge_old_ps_buffers(tx->local); purge_old_ps_buffers(tx->local);
if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >= if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >=
AP_MAX_BC_BUFFER) { AP_MAX_BC_BUFFER) {
#ifdef MAC80211_VERBOSE_PS_DEBUG
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_DEBUG "%s: BC TX buffer full - " printk(KERN_DEBUG "%s: BC TX buffer full - "
"dropping the oldest frame\n", "dropping the oldest frame\n",
tx->dev->name); tx->dev->name);
} }
#endif
dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf)); dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf));
} else } else
tx->local->total_ps_buffered++; tx->local->total_ps_buffered++;
...@@ -403,11 +407,13 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) ...@@ -403,11 +407,13 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
purge_old_ps_buffers(tx->local); purge_old_ps_buffers(tx->local);
if (skb_queue_len(&sta->ps_tx_buf) >= STA_MAX_TX_BUFFER) { if (skb_queue_len(&sta->ps_tx_buf) >= STA_MAX_TX_BUFFER) {
struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf); struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf);
#ifdef MAC80211_VERBOSE_PS_DEBUG
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_DEBUG "%s: STA %s TX " printk(KERN_DEBUG "%s: STA %s TX "
"buffer full - dropping oldest frame\n", "buffer full - dropping oldest frame\n",
tx->dev->name, print_mac(mac, sta->addr)); tx->dev->name, print_mac(mac, sta->addr));
} }
#endif
dev_kfree_skb(old); dev_kfree_skb(old);
} else } else
tx->local->total_ps_buffered++; tx->local->total_ps_buffered++;
...@@ -713,7 +719,6 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) ...@@ -713,7 +719,6 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
return TX_CONTINUE; return TX_CONTINUE;
fail: fail:
printk(KERN_DEBUG "%s: failed to fragment frame\n", tx->dev->name);
if (frags) { if (frags) {
for (i = 0; i < num_fragm - 1; i++) for (i = 0; i < num_fragm - 1; i++)
if (frags[i]) if (frags[i])
...@@ -1404,8 +1409,6 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, ...@@ -1404,8 +1409,6 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
sdata = IEEE80211_DEV_TO_SUB_IF(dev); sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (unlikely(skb->len < ETH_HLEN)) { if (unlikely(skb->len < ETH_HLEN)) {
printk(KERN_DEBUG "%s: short skb (len=%d)\n",
dev->name, skb->len);
ret = 0; ret = 0;
goto fail; goto fail;
} }
......
...@@ -253,11 +253,8 @@ int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb, ...@@ -253,11 +253,8 @@ int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb,
if (ieee80211_wep_decrypt_data(local->wep_rx_tfm, rc4key, klen, if (ieee80211_wep_decrypt_data(local->wep_rx_tfm, rc4key, klen,
skb->data + hdrlen + WEP_IV_LEN, skb->data + hdrlen + WEP_IV_LEN,
len)) { len))
if (net_ratelimit())
printk(KERN_DEBUG "WEP decrypt failed (ICV)\n");
ret = -1; ret = -1;
}
kfree(rc4key); kfree(rc4key);
...@@ -301,14 +298,8 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx) ...@@ -301,14 +298,8 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx)
return RX_CONTINUE; return RX_CONTINUE;
if (!(rx->status->flag & RX_FLAG_DECRYPTED)) { if (!(rx->status->flag & RX_FLAG_DECRYPTED)) {
if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) { if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key))
#ifdef CONFIG_MAC80211_DEBUG
if (net_ratelimit())
printk(KERN_DEBUG "%s: RX WEP frame, decrypt "
"failed\n", rx->dev->name);
#endif /* CONFIG_MAC80211_DEBUG */
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
}
} else if (!(rx->status->flag & RX_FLAG_IV_STRIPPED)) { } else if (!(rx->status->flag & RX_FLAG_IV_STRIPPED)) {
ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key); ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key);
/* remove ICV */ /* remove ICV */
......
...@@ -680,7 +680,6 @@ void ieee80211_requeue(struct ieee80211_local *local, int queue) ...@@ -680,7 +680,6 @@ void ieee80211_requeue(struct ieee80211_local *local, int queue)
if (!qdisc || !qdisc->dequeue) if (!qdisc || !qdisc->dequeue)
return; return;
printk(KERN_DEBUG "requeue: qlen = %d\n", qdisc->q.qlen);
for (len = qdisc->q.qlen; len > 0; len--) { for (len = qdisc->q.qlen; len > 0; len--) {
skb = qdisc->dequeue(qdisc); skb = qdisc->dequeue(qdisc);
root_qd->q.qlen--; root_qd->q.qlen--;
......
...@@ -146,9 +146,6 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) ...@@ -146,9 +146,6 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
if (!(rx->flags & IEEE80211_RX_RA_MATCH)) if (!(rx->flags & IEEE80211_RX_RA_MATCH))
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
printk(KERN_DEBUG "%s: invalid Michael MIC in data frame from "
"%s\n", rx->dev->name, print_mac(mac, sa));
mac80211_ev_michael_mic_failure(rx->dev, rx->key->conf.keyidx, mac80211_ev_michael_mic_failure(rx->dev, rx->key->conf.keyidx,
(void *) skb->data); (void *) skb->data);
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
...@@ -282,15 +279,8 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx) ...@@ -282,15 +279,8 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
hdr->addr1, hwaccel, rx->queue, hdr->addr1, hwaccel, rx->queue,
&rx->tkip_iv32, &rx->tkip_iv32,
&rx->tkip_iv16); &rx->tkip_iv16);
if (res != TKIP_DECRYPT_OK || wpa_test) { if (res != TKIP_DECRYPT_OK || wpa_test)
#ifdef CONFIG_MAC80211_DEBUG
if (net_ratelimit())
printk(KERN_DEBUG "%s: TKIP decrypt failed for RX "
"frame from %s (res=%d)\n", rx->dev->name,
print_mac(mac, rx->sta->addr), res);
#endif /* CONFIG_MAC80211_DEBUG */
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
}
/* Trim ICV */ /* Trim ICV */
skb_trim(skb, skb->len - TKIP_ICV_LEN); skb_trim(skb, skb->len - TKIP_ICV_LEN);
...@@ -512,16 +502,6 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) ...@@ -512,16 +502,6 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
(void) ccmp_hdr2pn(pn, skb->data + hdrlen); (void) ccmp_hdr2pn(pn, skb->data + hdrlen);
if (memcmp(pn, key->u.ccmp.rx_pn[rx->queue], CCMP_PN_LEN) <= 0) { if (memcmp(pn, key->u.ccmp.rx_pn[rx->queue], CCMP_PN_LEN) <= 0) {
#ifdef CONFIG_MAC80211_DEBUG
u8 *ppn = key->u.ccmp.rx_pn[rx->queue];
printk(KERN_DEBUG "%s: CCMP replay detected for RX frame from "
"%s (RX PN %02x%02x%02x%02x%02x%02x <= prev. PN "
"%02x%02x%02x%02x%02x%02x)\n", rx->dev->name,
print_mac(mac, rx->sta->addr),
pn[0], pn[1], pn[2], pn[3], pn[4], pn[5],
ppn[0], ppn[1], ppn[2], ppn[3], ppn[4], ppn[5]);
#endif /* CONFIG_MAC80211_DEBUG */
key->u.ccmp.replays++; key->u.ccmp.replays++;
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
} }
...@@ -541,12 +521,6 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) ...@@ -541,12 +521,6 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
skb->data + hdrlen + CCMP_HDR_LEN, data_len, skb->data + hdrlen + CCMP_HDR_LEN, data_len,
skb->data + skb->len - CCMP_MIC_LEN, skb->data + skb->len - CCMP_MIC_LEN,
skb->data + hdrlen + CCMP_HDR_LEN)) { skb->data + hdrlen + CCMP_HDR_LEN)) {
#ifdef CONFIG_MAC80211_DEBUG
if (net_ratelimit())
printk(KERN_DEBUG "%s: CCMP decrypt failed "
"for RX frame from %s\n", rx->dev->name,
print_mac(mac, rx->sta->addr));
#endif /* CONFIG_MAC80211_DEBUG */
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment