lib80211: silence excessive crypto debugging messages

When they were part of the now defunct ieee80211 component, these
messages were only visible when special debugging settings were enabled.
Let's mirror that with a new lib80211 debugging Kconfig option.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
John W. Linville 2009-03-11 11:05:25 -04:00
parent ea8dbdd170
commit 6f16bf3bdb
3 changed files with 16 additions and 0 deletions

View File

@ -102,3 +102,13 @@ config LIB80211_CRYPT_CCMP
config LIB80211_CRYPT_TKIP config LIB80211_CRYPT_TKIP
tristate tristate
config LIB80211_DEBUG
bool "lib80211 debugging messages"
depends on LIB80211
default n
---help---
You can enable this if you want verbose debugging messages
from lib80211.
If unsure, say N.

View File

@ -337,6 +337,7 @@ static int lib80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
pos += 8; pos += 8;
if (ccmp_replay_check(pn, key->rx_pn)) { if (ccmp_replay_check(pn, key->rx_pn)) {
#ifdef CONFIG_LIB80211_DEBUG
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_DEBUG "CCMP: replay detected: STA=%pM " printk(KERN_DEBUG "CCMP: replay detected: STA=%pM "
"previous PN %02x%02x%02x%02x%02x%02x " "previous PN %02x%02x%02x%02x%02x%02x "
@ -346,6 +347,7 @@ static int lib80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
key->rx_pn[3], key->rx_pn[4], key->rx_pn[5], key->rx_pn[3], key->rx_pn[4], key->rx_pn[5],
pn[0], pn[1], pn[2], pn[3], pn[4], pn[5]); pn[0], pn[1], pn[2], pn[3], pn[4], pn[5]);
} }
#endif
key->dot11RSNAStatsCCMPReplays++; key->dot11RSNAStatsCCMPReplays++;
return -4; return -4;
} }

View File

@ -465,12 +465,14 @@ static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
pos += 8; pos += 8;
if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) { if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) {
#ifdef CONFIG_LIB80211_DEBUG
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_DEBUG "TKIP: replay detected: STA=%pM" printk(KERN_DEBUG "TKIP: replay detected: STA=%pM"
" previous TSC %08x%04x received TSC " " previous TSC %08x%04x received TSC "
"%08x%04x\n", hdr->addr2, "%08x%04x\n", hdr->addr2,
tkey->rx_iv32, tkey->rx_iv16, iv32, iv16); tkey->rx_iv32, tkey->rx_iv16, iv32, iv16);
} }
#endif
tkey->dot11RSNAStatsTKIPReplays++; tkey->dot11RSNAStatsTKIPReplays++;
return -4; return -4;
} }
@ -505,10 +507,12 @@ static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
* it needs to be recalculated for the next packet. */ * it needs to be recalculated for the next packet. */
tkey->rx_phase1_done = 0; tkey->rx_phase1_done = 0;
} }
#ifdef CONFIG_LIB80211_DEBUG
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_DEBUG "TKIP: ICV error detected: STA=" printk(KERN_DEBUG "TKIP: ICV error detected: STA="
"%pM\n", hdr->addr2); "%pM\n", hdr->addr2);
} }
#endif
tkey->dot11RSNAStatsTKIPICVErrors++; tkey->dot11RSNAStatsTKIPICVErrors++;
return -5; return -5;
} }