diff options
author | Guillaume Chazarain <guichaz@yahoo.fr> | 2007-11-19 04:07:00 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-11-20 16:43:17 -0500 |
commit | 92468c53cf5af0aea06caec7b7d416c18e973685 (patch) | |
tree | f030ad479614a0832585d549d51d4ff8fb3f264f | |
parent | 4b50e388f88ab08f6c2f54f0a33e696ff2de269f (diff) |
ieee80211: Stop net_ratelimit/IEEE80211_DEBUG_DROP log pollution
if (net_ratelimit())
IEEE80211_DEBUG_DROP(...)
can pollute the logs with messages like:
printk: 1 messages suppressed.
printk: 2 messages suppressed.
printk: 7 messages suppressed.
if debugging information is disabled. These messages are printed by
net_ratelimit(). Add a wrapper to net_ratelimit() that takes into account
the log level, so that net_ratelimit() is called only when we really want
to print something.
Signed-off-by: Guillaume Chazarain <guichaz@yahoo.fr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | include/net/ieee80211.h | 8 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_crypt_ccmp.c | 2 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_crypt_tkip.c | 4 |
3 files changed, 11 insertions, 3 deletions
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index 164d13211165..d8ae48439f12 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -115,8 +115,16 @@ extern u32 ieee80211_debug_level; | |||
115 | do { if (ieee80211_debug_level & (level)) \ | 115 | do { if (ieee80211_debug_level & (level)) \ |
116 | printk(KERN_DEBUG "ieee80211: %c %s " fmt, \ | 116 | printk(KERN_DEBUG "ieee80211: %c %s " fmt, \ |
117 | in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) | 117 | in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) |
118 | static inline bool ieee80211_ratelimit_debug(u32 level) | ||
119 | { | ||
120 | return (ieee80211_debug_level & level) && net_ratelimit(); | ||
121 | } | ||
118 | #else | 122 | #else |
119 | #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) | 123 | #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) |
124 | static inline bool ieee80211_ratelimit_debug(u32 level) | ||
125 | { | ||
126 | return false; | ||
127 | } | ||
120 | #endif /* CONFIG_IEEE80211_DEBUG */ | 128 | #endif /* CONFIG_IEEE80211_DEBUG */ |
121 | 129 | ||
122 | /* escape_essid() is intended to be used in debug (and possibly error) | 130 | /* escape_essid() is intended to be used in debug (and possibly error) |
diff --git a/net/ieee80211/ieee80211_crypt_ccmp.c b/net/ieee80211/ieee80211_crypt_ccmp.c index c6d760d9fbbe..208bf35b5546 100644 --- a/net/ieee80211/ieee80211_crypt_ccmp.c +++ b/net/ieee80211/ieee80211_crypt_ccmp.c | |||
@@ -338,7 +338,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
338 | pos += 8; | 338 | pos += 8; |
339 | 339 | ||
340 | if (ccmp_replay_check(pn, key->rx_pn)) { | 340 | if (ccmp_replay_check(pn, key->rx_pn)) { |
341 | if (net_ratelimit()) { | 341 | if (ieee80211_ratelimit_debug(IEEE80211_DL_DROP)) { |
342 | IEEE80211_DEBUG_DROP("CCMP: replay detected: STA=%s " | 342 | IEEE80211_DEBUG_DROP("CCMP: replay detected: STA=%s " |
343 | "previous PN %02x%02x%02x%02x%02x%02x " | 343 | "previous PN %02x%02x%02x%02x%02x%02x " |
344 | "received PN %02x%02x%02x%02x%02x%02x\n", | 344 | "received PN %02x%02x%02x%02x%02x%02x\n", |
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c index 58b22619ab15..8e146949fc6f 100644 --- a/net/ieee80211/ieee80211_crypt_tkip.c +++ b/net/ieee80211/ieee80211_crypt_tkip.c | |||
@@ -464,7 +464,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
464 | pos += 8; | 464 | pos += 8; |
465 | 465 | ||
466 | if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) { | 466 | if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) { |
467 | if (net_ratelimit()) { | 467 | if (ieee80211_ratelimit_debug(IEEE80211_DL_DROP)) { |
468 | IEEE80211_DEBUG_DROP("TKIP: replay detected: STA=%s" | 468 | IEEE80211_DEBUG_DROP("TKIP: replay detected: STA=%s" |
469 | " previous TSC %08x%04x received TSC " | 469 | " previous TSC %08x%04x received TSC " |
470 | "%08x%04x\n", print_mac(mac, hdr->addr2), | 470 | "%08x%04x\n", print_mac(mac, hdr->addr2), |
@@ -504,7 +504,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
504 | * it needs to be recalculated for the next packet. */ | 504 | * it needs to be recalculated for the next packet. */ |
505 | tkey->rx_phase1_done = 0; | 505 | tkey->rx_phase1_done = 0; |
506 | } | 506 | } |
507 | if (net_ratelimit()) { | 507 | if (ieee80211_ratelimit_debug(IEEE80211_DL_DROP)) { |
508 | IEEE80211_DEBUG_DROP("TKIP: ICV error detected: STA=" | 508 | IEEE80211_DEBUG_DROP("TKIP: ICV error detected: STA=" |
509 | "%s\n", print_mac(mac, hdr->addr2)); | 509 | "%s\n", print_mac(mac, hdr->addr2)); |
510 | } | 510 | } |