diff options
-rw-r--r-- | net/ipv6/netfilter/ip6t_LOG.c | 54 |
1 files changed, 19 insertions, 35 deletions
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c index bfc3d0185d19..c44685e391b7 100644 --- a/net/ipv6/netfilter/ip6t_LOG.c +++ b/net/ipv6/netfilter/ip6t_LOG.c | |||
@@ -366,8 +366,6 @@ ip6t_log_packet(unsigned int hooknum, | |||
366 | const char *level_string, | 366 | const char *level_string, |
367 | const char *prefix) | 367 | const char *prefix) |
368 | { | 368 | { |
369 | struct ipv6hdr *ipv6h = skb->nh.ipv6h; | ||
370 | |||
371 | spin_lock_bh(&log_lock); | 369 | spin_lock_bh(&log_lock); |
372 | printk(level_string); | 370 | printk(level_string); |
373 | printk("%sIN=%s OUT=%s ", | 371 | printk("%sIN=%s OUT=%s ", |
@@ -377,39 +375,25 @@ ip6t_log_packet(unsigned int hooknum, | |||
377 | if (in && !out) { | 375 | if (in && !out) { |
378 | /* MAC logging for input chain only. */ | 376 | /* MAC logging for input chain only. */ |
379 | printk("MAC="); | 377 | printk("MAC="); |
380 | if (skb->dev && skb->dev->hard_header_len && skb->mac.raw != (void*)ipv6h) { | 378 | if (skb->dev && skb->dev->hard_header_len && |
381 | if (skb->dev->type != ARPHRD_SIT){ | 379 | skb->mac.raw != skb->nh.raw) { |
382 | int i; | 380 | unsigned char *p = skb->mac.raw; |
383 | unsigned char *p = skb->mac.raw; | 381 | int i; |
384 | for (i = 0; i < skb->dev->hard_header_len; i++,p++) | 382 | |
385 | printk("%02x%c", *p, | 383 | if (skb->dev->type == ARPHRD_SIT && |
386 | i==skb->dev->hard_header_len - 1 | 384 | (p -= ETH_HLEN) < skb->head) |
387 | ? ' ':':'); | 385 | p = NULL; |
388 | } else { | 386 | |
389 | int i; | 387 | if (p != NULL) |
390 | unsigned char *p = skb->mac.raw; | 388 | for (i = 0; i < skb->dev->hard_header_len; i++) |
391 | if ( p - (ETH_ALEN*2+2) > skb->head ){ | 389 | printk("%02x", p[i]); |
392 | p -= (ETH_ALEN+2); | 390 | printk(" "); |
393 | for (i = 0; i < (ETH_ALEN); i++,p++) | 391 | |
394 | printk("%02x%s", *p, | 392 | if (skb->dev->type == ARPHRD_SIT) { |
395 | i == ETH_ALEN-1 ? "->" : ":"); | 393 | struct iphdr *iph = (struct iphdr *)skb->mac.raw; |
396 | p -= (ETH_ALEN*2); | 394 | printk("TUNNEL=%u.%u.%u.%u->%u.%u.%u.%u ", |
397 | for (i = 0; i < (ETH_ALEN); i++,p++) | 395 | NIPQUAD(iph->saddr), |
398 | printk("%02x%c", *p, | 396 | NIPQUAD(iph->daddr)); |
399 | i == ETH_ALEN-1 ? ' ' : ':'); | ||
400 | } | ||
401 | |||
402 | if ((skb->dev->addr_len == 4) && | ||
403 | skb->dev->hard_header_len > 20){ | ||
404 | printk("TUNNEL="); | ||
405 | p = skb->mac.raw + 12; | ||
406 | for (i = 0; i < 4; i++,p++) | ||
407 | printk("%3d%s", *p, | ||
408 | i == 3 ? "->" : "."); | ||
409 | for (i = 0; i < 4; i++,p++) | ||
410 | printk("%3d%c", *p, | ||
411 | i == 3 ? ' ' : '.'); | ||
412 | } | ||
413 | } | 397 | } |
414 | } else | 398 | } else |
415 | printk(" "); | 399 | printk(" "); |