diff options
author | Joe Perches <joe@perches.com> | 2007-10-03 20:59:30 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:42 -0400 |
commit | 0795af5729b18218767fab27c44b1384f72dc9ad (patch) | |
tree | 67c16df84aa6ec219340b8ea1b5cfb0e8150a216 /net/ieee80211/ieee80211_crypt_ccmp.c | |
parent | 95ea36275f3c9a1d3d04c217b4b576c657c4e70e (diff) |
[NET]: Introduce and use print_mac() and DECLARE_MAC_BUF()
This is nicer than the MAC_FMT stuff.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ieee80211/ieee80211_crypt_ccmp.c')
-rw-r--r-- | net/ieee80211/ieee80211_crypt_ccmp.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/net/ieee80211/ieee80211_crypt_ccmp.c b/net/ieee80211/ieee80211_crypt_ccmp.c index 2e6b099fc84c..0936a3e0210b 100644 --- a/net/ieee80211/ieee80211_crypt_ccmp.c +++ b/net/ieee80211/ieee80211_crypt_ccmp.c | |||
@@ -297,6 +297,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
297 | int i, blocks, last, len; | 297 | int i, blocks, last, len; |
298 | size_t data_len = skb->len - hdr_len - CCMP_HDR_LEN - CCMP_MIC_LEN; | 298 | size_t data_len = skb->len - hdr_len - CCMP_HDR_LEN - CCMP_MIC_LEN; |
299 | u8 *mic = skb->data + skb->len - CCMP_MIC_LEN; | 299 | u8 *mic = skb->data + skb->len - CCMP_MIC_LEN; |
300 | DECLARE_MAC_BUF(mac); | ||
300 | 301 | ||
301 | if (skb->len < hdr_len + CCMP_HDR_LEN + CCMP_MIC_LEN) { | 302 | if (skb->len < hdr_len + CCMP_HDR_LEN + CCMP_MIC_LEN) { |
302 | key->dot11RSNAStatsCCMPFormatErrors++; | 303 | key->dot11RSNAStatsCCMPFormatErrors++; |
@@ -309,7 +310,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
309 | if (!(keyidx & (1 << 5))) { | 310 | if (!(keyidx & (1 << 5))) { |
310 | if (net_ratelimit()) { | 311 | if (net_ratelimit()) { |
311 | printk(KERN_DEBUG "CCMP: received packet without ExtIV" | 312 | printk(KERN_DEBUG "CCMP: received packet without ExtIV" |
312 | " flag from " MAC_FMT "\n", MAC_ARG(hdr->addr2)); | 313 | " flag from %s\n", print_mac(mac, hdr->addr2)); |
313 | } | 314 | } |
314 | key->dot11RSNAStatsCCMPFormatErrors++; | 315 | key->dot11RSNAStatsCCMPFormatErrors++; |
315 | return -2; | 316 | return -2; |
@@ -322,9 +323,9 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
322 | } | 323 | } |
323 | if (!key->key_set) { | 324 | if (!key->key_set) { |
324 | if (net_ratelimit()) { | 325 | if (net_ratelimit()) { |
325 | printk(KERN_DEBUG "CCMP: received packet from " MAC_FMT | 326 | printk(KERN_DEBUG "CCMP: received packet from %s" |
326 | " with keyid=%d that does not have a configured" | 327 | " with keyid=%d that does not have a configured" |
327 | " key\n", MAC_ARG(hdr->addr2), keyidx); | 328 | " key\n", print_mac(mac, hdr->addr2), keyidx); |
328 | } | 329 | } |
329 | return -3; | 330 | return -3; |
330 | } | 331 | } |
@@ -339,11 +340,13 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
339 | 340 | ||
340 | if (ccmp_replay_check(pn, key->rx_pn)) { | 341 | if (ccmp_replay_check(pn, key->rx_pn)) { |
341 | if (net_ratelimit()) { | 342 | if (net_ratelimit()) { |
342 | IEEE80211_DEBUG_DROP("CCMP: replay detected: STA=" MAC_FMT | 343 | IEEE80211_DEBUG_DROP("CCMP: replay detected: STA=%s " |
343 | " previous PN %02x%02x%02x%02x%02x%02x " | 344 | "previous PN %02x%02x%02x%02x%02x%02x " |
344 | "received PN %02x%02x%02x%02x%02x%02x\n", | 345 | "received PN %02x%02x%02x%02x%02x%02x\n", |
345 | MAC_ARG(hdr->addr2), MAC_ARG(key->rx_pn), | 346 | print_mac(mac, hdr->addr2), |
346 | MAC_ARG(pn)); | 347 | key->rx_pn[0], key->rx_pn[1], key->rx_pn[2], |
348 | key->rx_pn[3], key->rx_pn[4], key->rx_pn[5], | ||
349 | pn[0], pn[1], pn[2], pn[3], pn[4], pn[5]); | ||
347 | } | 350 | } |
348 | key->dot11RSNAStatsCCMPReplays++; | 351 | key->dot11RSNAStatsCCMPReplays++; |
349 | return -4; | 352 | return -4; |
@@ -371,7 +374,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
371 | if (memcmp(mic, a, CCMP_MIC_LEN) != 0) { | 374 | if (memcmp(mic, a, CCMP_MIC_LEN) != 0) { |
372 | if (net_ratelimit()) { | 375 | if (net_ratelimit()) { |
373 | printk(KERN_DEBUG "CCMP: decrypt failed: STA=" | 376 | printk(KERN_DEBUG "CCMP: decrypt failed: STA=" |
374 | MAC_FMT "\n", MAC_ARG(hdr->addr2)); | 377 | "%s\n", print_mac(mac, hdr->addr2)); |
375 | } | 378 | } |
376 | key->dot11RSNAStatsCCMPDecryptErrors++; | 379 | key->dot11RSNAStatsCCMPDecryptErrors++; |
377 | return -5; | 380 | return -5; |
@@ -443,12 +446,16 @@ static int ieee80211_ccmp_get_key(void *key, int len, u8 * seq, void *priv) | |||
443 | static char *ieee80211_ccmp_print_stats(char *p, void *priv) | 446 | static char *ieee80211_ccmp_print_stats(char *p, void *priv) |
444 | { | 447 | { |
445 | struct ieee80211_ccmp_data *ccmp = priv; | 448 | struct ieee80211_ccmp_data *ccmp = priv; |
449 | |||
446 | p += sprintf(p, "key[%d] alg=CCMP key_set=%d " | 450 | p += sprintf(p, "key[%d] alg=CCMP key_set=%d " |
447 | "tx_pn=%02x%02x%02x%02x%02x%02x " | 451 | "tx_pn=%02x%02x%02x%02x%02x%02x " |
448 | "rx_pn=%02x%02x%02x%02x%02x%02x " | 452 | "rx_pn=%02x%02x%02x%02x%02x%02x " |
449 | "format_errors=%d replays=%d decrypt_errors=%d\n", | 453 | "format_errors=%d replays=%d decrypt_errors=%d\n", |
450 | ccmp->key_idx, ccmp->key_set, | 454 | ccmp->key_idx, ccmp->key_set, |
451 | MAC_ARG(ccmp->tx_pn), MAC_ARG(ccmp->rx_pn), | 455 | ccmp->tx_pn[0], ccmp->tx_pn[1], ccmp->tx_pn[2], |
456 | ccmp->tx_pn[3], ccmp->tx_pn[4], ccmp->tx_pn[5], | ||
457 | ccmp->rx_pn[0], ccmp->rx_pn[1], ccmp->rx_pn[2], | ||
458 | ccmp->rx_pn[3], ccmp->rx_pn[4], ccmp->rx_pn[5], | ||
452 | ccmp->dot11RSNAStatsCCMPFormatErrors, | 459 | ccmp->dot11RSNAStatsCCMPFormatErrors, |
453 | ccmp->dot11RSNAStatsCCMPReplays, | 460 | ccmp->dot11RSNAStatsCCMPReplays, |
454 | ccmp->dot11RSNAStatsCCMPDecryptErrors); | 461 | ccmp->dot11RSNAStatsCCMPDecryptErrors); |