Commit 047601bf authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[NETFILTER]: Fix ip6t_LOG sit tunnel logging

Sit tunnel logging is currently broken:

MAC=01:23:45:67:89:ab->01:23:45:47:89:ac TUNNEL=123.123.  0.123-> 12.123.  6.123

Apart from the broken IP address, MAC addresses are printed differently
for sit tunnels than for everything else.
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2715bcf9
...@@ -366,8 +366,6 @@ ip6t_log_packet(unsigned int hooknum, ...@@ -366,8 +366,6 @@ ip6t_log_packet(unsigned int hooknum,
const char *level_string, const char *level_string,
const char *prefix) const char *prefix)
{ {
struct ipv6hdr *ipv6h = skb->nh.ipv6h;
spin_lock_bh(&log_lock); spin_lock_bh(&log_lock);
printk(level_string); printk(level_string);
printk("%sIN=%s OUT=%s ", printk("%sIN=%s OUT=%s ",
...@@ -377,39 +375,25 @@ ip6t_log_packet(unsigned int hooknum, ...@@ -377,39 +375,25 @@ ip6t_log_packet(unsigned int hooknum,
if (in && !out) { if (in && !out) {
/* MAC logging for input chain only. */ /* MAC logging for input chain only. */
printk("MAC="); printk("MAC=");
if (skb->dev && skb->dev->hard_header_len && skb->mac.raw != (void*)ipv6h) { if (skb->dev && skb->dev->hard_header_len &&
if (skb->dev->type != ARPHRD_SIT){ skb->mac.raw != skb->nh.raw) {
int i;
unsigned char *p = skb->mac.raw; unsigned char *p = skb->mac.raw;
for (i = 0; i < skb->dev->hard_header_len; i++,p++)
printk("%02x%c", *p,
i==skb->dev->hard_header_len - 1
? ' ':':');
} else {
int i; int i;
unsigned char *p = skb->mac.raw;
if ( p - (ETH_ALEN*2+2) > skb->head ){
p -= (ETH_ALEN+2);
for (i = 0; i < (ETH_ALEN); i++,p++)
printk("%02x%s", *p,
i == ETH_ALEN-1 ? "->" : ":");
p -= (ETH_ALEN*2);
for (i = 0; i < (ETH_ALEN); i++,p++)
printk("%02x%c", *p,
i == ETH_ALEN-1 ? ' ' : ':');
}
if ((skb->dev->addr_len == 4) && if (skb->dev->type == ARPHRD_SIT &&
skb->dev->hard_header_len > 20){ (p -= ETH_HLEN) < skb->head)
printk("TUNNEL="); p = NULL;
p = skb->mac.raw + 12;
for (i = 0; i < 4; i++,p++) if (p != NULL)
printk("%3d%s", *p, for (i = 0; i < skb->dev->hard_header_len; i++)
i == 3 ? "->" : "."); printk("%02x", p[i]);
for (i = 0; i < 4; i++,p++) printk(" ");
printk("%3d%c", *p,
i == 3 ? ' ' : '.'); if (skb->dev->type == ARPHRD_SIT) {
} struct iphdr *iph = (struct iphdr *)skb->mac.raw;
printk("TUNNEL=%u.%u.%u.%u->%u.%u.%u.%u ",
NIPQUAD(iph->saddr),
NIPQUAD(iph->daddr));
} }
} else } else
printk(" "); printk(" ");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment