diff options
author | Joe Perches <joe@perches.com> | 2012-05-13 17:56:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-15 13:45:03 -0400 |
commit | e87cc4728f0e2fb663e592a1141742b1d6c63256 (patch) | |
tree | b8219696d37f0c8d0521d5853560b97fc96dc667 /net/wireless | |
parent | 3a3bfb61e64476ff1e4ac3122cb6dec9c79b795c (diff) |
net: Convert net_ratelimit uses to net_<level>_ratelimited
Standardize the net core ratelimited logging functions.
Coalesce formats, align arguments.
Change a printk then vprintk sequence to use printf extension %pV.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/lib80211_crypt_ccmp.c | 33 | ||||
-rw-r--r-- | net/wireless/lib80211_crypt_tkip.c | 50 |
2 files changed, 27 insertions, 56 deletions
diff --git a/net/wireless/lib80211_crypt_ccmp.c b/net/wireless/lib80211_crypt_ccmp.c index 755738d26bb4..1526c211db66 100644 --- a/net/wireless/lib80211_crypt_ccmp.c +++ b/net/wireless/lib80211_crypt_ccmp.c | |||
@@ -304,10 +304,8 @@ static int lib80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
304 | pos = skb->data + hdr_len; | 304 | pos = skb->data + hdr_len; |
305 | keyidx = pos[3]; | 305 | keyidx = pos[3]; |
306 | if (!(keyidx & (1 << 5))) { | 306 | if (!(keyidx & (1 << 5))) { |
307 | if (net_ratelimit()) { | 307 | net_dbg_ratelimited("CCMP: received packet without ExtIV flag from %pM\n", |
308 | printk(KERN_DEBUG "CCMP: received packet without ExtIV" | 308 | hdr->addr2); |
309 | " flag from %pM\n", hdr->addr2); | ||
310 | } | ||
311 | key->dot11RSNAStatsCCMPFormatErrors++; | 309 | key->dot11RSNAStatsCCMPFormatErrors++; |
312 | return -2; | 310 | return -2; |
313 | } | 311 | } |
@@ -318,11 +316,8 @@ static int lib80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
318 | return -6; | 316 | return -6; |
319 | } | 317 | } |
320 | if (!key->key_set) { | 318 | if (!key->key_set) { |
321 | if (net_ratelimit()) { | 319 | net_dbg_ratelimited("CCMP: received packet from %pM with keyid=%d that does not have a configured key\n", |
322 | printk(KERN_DEBUG "CCMP: received packet from %pM" | 320 | hdr->addr2, keyidx); |
323 | " with keyid=%d that does not have a configured" | ||
324 | " key\n", hdr->addr2, keyidx); | ||
325 | } | ||
326 | return -3; | 321 | return -3; |
327 | } | 322 | } |
328 | 323 | ||
@@ -336,15 +331,11 @@ static int lib80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
336 | 331 | ||
337 | if (ccmp_replay_check(pn, key->rx_pn)) { | 332 | if (ccmp_replay_check(pn, key->rx_pn)) { |
338 | #ifdef CONFIG_LIB80211_DEBUG | 333 | #ifdef CONFIG_LIB80211_DEBUG |
339 | if (net_ratelimit()) { | 334 | net_dbg_ratelimited("CCMP: replay detected: STA=%pM previous PN %02x%02x%02x%02x%02x%02x received PN %02x%02x%02x%02x%02x%02x\n", |
340 | printk(KERN_DEBUG "CCMP: replay detected: STA=%pM " | 335 | hdr->addr2, |
341 | "previous PN %02x%02x%02x%02x%02x%02x " | 336 | key->rx_pn[0], key->rx_pn[1], key->rx_pn[2], |
342 | "received PN %02x%02x%02x%02x%02x%02x\n", | 337 | key->rx_pn[3], key->rx_pn[4], key->rx_pn[5], |
343 | hdr->addr2, | 338 | pn[0], pn[1], pn[2], pn[3], pn[4], pn[5]); |
344 | key->rx_pn[0], key->rx_pn[1], key->rx_pn[2], | ||
345 | key->rx_pn[3], key->rx_pn[4], key->rx_pn[5], | ||
346 | pn[0], pn[1], pn[2], pn[3], pn[4], pn[5]); | ||
347 | } | ||
348 | #endif | 339 | #endif |
349 | key->dot11RSNAStatsCCMPReplays++; | 340 | key->dot11RSNAStatsCCMPReplays++; |
350 | return -4; | 341 | return -4; |
@@ -370,10 +361,8 @@ static int lib80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
370 | } | 361 | } |
371 | 362 | ||
372 | if (memcmp(mic, a, CCMP_MIC_LEN) != 0) { | 363 | if (memcmp(mic, a, CCMP_MIC_LEN) != 0) { |
373 | if (net_ratelimit()) { | 364 | net_dbg_ratelimited("CCMP: decrypt failed: STA=%pM\n", |
374 | printk(KERN_DEBUG "CCMP: decrypt failed: STA=" | 365 | hdr->addr2); |
375 | "%pM\n", hdr->addr2); | ||
376 | } | ||
377 | key->dot11RSNAStatsCCMPDecryptErrors++; | 366 | key->dot11RSNAStatsCCMPDecryptErrors++; |
378 | return -5; | 367 | return -5; |
379 | } | 368 | } |
diff --git a/net/wireless/lib80211_crypt_tkip.c b/net/wireless/lib80211_crypt_tkip.c index 38734846c19e..d475cfc8568f 100644 --- a/net/wireless/lib80211_crypt_tkip.c +++ b/net/wireless/lib80211_crypt_tkip.c | |||
@@ -360,12 +360,9 @@ static int lib80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
360 | struct scatterlist sg; | 360 | struct scatterlist sg; |
361 | 361 | ||
362 | if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { | 362 | if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { |
363 | if (net_ratelimit()) { | 363 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
364 | struct ieee80211_hdr *hdr = | 364 | net_dbg_ratelimited("TKIP countermeasures: dropped TX packet to %pM\n", |
365 | (struct ieee80211_hdr *)skb->data; | 365 | hdr->addr1); |
366 | printk(KERN_DEBUG ": TKIP countermeasures: dropped " | ||
367 | "TX packet to %pM\n", hdr->addr1); | ||
368 | } | ||
369 | return -1; | 366 | return -1; |
370 | } | 367 | } |
371 | 368 | ||
@@ -420,10 +417,8 @@ static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
420 | hdr = (struct ieee80211_hdr *)skb->data; | 417 | hdr = (struct ieee80211_hdr *)skb->data; |
421 | 418 | ||
422 | if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { | 419 | if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { |
423 | if (net_ratelimit()) { | 420 | net_dbg_ratelimited("TKIP countermeasures: dropped received packet from %pM\n", |
424 | printk(KERN_DEBUG ": TKIP countermeasures: dropped " | 421 | hdr->addr2); |
425 | "received packet from %pM\n", hdr->addr2); | ||
426 | } | ||
427 | return -1; | 422 | return -1; |
428 | } | 423 | } |
429 | 424 | ||
@@ -433,10 +428,8 @@ static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
433 | pos = skb->data + hdr_len; | 428 | pos = skb->data + hdr_len; |
434 | keyidx = pos[3]; | 429 | keyidx = pos[3]; |
435 | if (!(keyidx & (1 << 5))) { | 430 | if (!(keyidx & (1 << 5))) { |
436 | if (net_ratelimit()) { | 431 | net_dbg_ratelimited("TKIP: received packet without ExtIV flag from %pM\n", |
437 | printk(KERN_DEBUG "TKIP: received packet without ExtIV" | 432 | hdr->addr2); |
438 | " flag from %pM\n", hdr->addr2); | ||
439 | } | ||
440 | return -2; | 433 | return -2; |
441 | } | 434 | } |
442 | keyidx >>= 6; | 435 | keyidx >>= 6; |
@@ -446,11 +439,8 @@ static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
446 | return -6; | 439 | return -6; |
447 | } | 440 | } |
448 | if (!tkey->key_set) { | 441 | if (!tkey->key_set) { |
449 | if (net_ratelimit()) { | 442 | net_dbg_ratelimited("TKIP: received packet from %pM with keyid=%d that does not have a configured key\n", |
450 | printk(KERN_DEBUG "TKIP: received packet from %pM" | 443 | hdr->addr2, keyidx); |
451 | " with keyid=%d that does not have a configured" | ||
452 | " key\n", hdr->addr2, keyidx); | ||
453 | } | ||
454 | return -3; | 444 | return -3; |
455 | } | 445 | } |
456 | iv16 = (pos[0] << 8) | pos[2]; | 446 | iv16 = (pos[0] << 8) | pos[2]; |
@@ -459,12 +449,9 @@ static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
459 | 449 | ||
460 | if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) { | 450 | if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) { |
461 | #ifdef CONFIG_LIB80211_DEBUG | 451 | #ifdef CONFIG_LIB80211_DEBUG |
462 | if (net_ratelimit()) { | 452 | net_dbg_ratelimited("TKIP: replay detected: STA=%pM previous TSC %08x%04x received TSC %08x%04x\n", |
463 | printk(KERN_DEBUG "TKIP: replay detected: STA=%pM" | 453 | hdr->addr2, tkey->rx_iv32, tkey->rx_iv16, |
464 | " previous TSC %08x%04x received TSC " | 454 | iv32, iv16); |
465 | "%08x%04x\n", hdr->addr2, | ||
466 | tkey->rx_iv32, tkey->rx_iv16, iv32, iv16); | ||
467 | } | ||
468 | #endif | 455 | #endif |
469 | tkey->dot11RSNAStatsTKIPReplays++; | 456 | tkey->dot11RSNAStatsTKIPReplays++; |
470 | return -4; | 457 | return -4; |
@@ -481,11 +468,8 @@ static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
481 | crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); | 468 | crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); |
482 | sg_init_one(&sg, pos, plen + 4); | 469 | sg_init_one(&sg, pos, plen + 4); |
483 | if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { | 470 | if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { |
484 | if (net_ratelimit()) { | 471 | net_dbg_ratelimited("TKIP: failed to decrypt received packet from %pM\n", |
485 | printk(KERN_DEBUG ": TKIP: failed to decrypt " | 472 | hdr->addr2); |
486 | "received packet from %pM\n", | ||
487 | hdr->addr2); | ||
488 | } | ||
489 | return -7; | 473 | return -7; |
490 | } | 474 | } |
491 | 475 | ||
@@ -501,10 +485,8 @@ static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
501 | tkey->rx_phase1_done = 0; | 485 | tkey->rx_phase1_done = 0; |
502 | } | 486 | } |
503 | #ifdef CONFIG_LIB80211_DEBUG | 487 | #ifdef CONFIG_LIB80211_DEBUG |
504 | if (net_ratelimit()) { | 488 | net_dbg_ratelimited("TKIP: ICV error detected: STA=%pM\n", |
505 | printk(KERN_DEBUG "TKIP: ICV error detected: STA=" | 489 | hdr->addr2); |
506 | "%pM\n", hdr->addr2); | ||
507 | } | ||
508 | #endif | 490 | #endif |
509 | tkey->dot11RSNAStatsTKIPICVErrors++; | 491 | tkey->dot11RSNAStatsTKIPICVErrors++; |
510 | return -5; | 492 | return -5; |