tree 5e447369eb409e4a41c0f76df564bf8911c8bcdd
parent 5df7ab462a407ad91e8e91f4aa41ca7eb8ab4ef1
author Patrick McHardy <[EMAIL PROTECTED]> Mon, 01 Aug 2005 10:18:03 -0700
committer David S. Miller <[EMAIL PROTECTED]> Mon, 01 Aug 2005 10:18:03 -0700

[NETFILTER]: Fix ip6t_LOG sit tunnel logging

Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>

 net/ipv6/netfilter/ip6t_LOG.c |   58 +++++++++++++++++-------------------------
 1 files changed, 24 insertions(+), 34 deletions(-)

diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c
--- a/net/ipv6/netfilter/ip6t_LOG.c
+++ b/net/ipv6/netfilter/ip6t_LOG.c
@@ -363,7 +363,6 @@ ip6t_log_target(struct sk_buff **pskb,
                const void *targinfo,
                void *userinfo)
 {
-       struct ipv6hdr *ipv6h = (*pskb)->nh.ipv6h;
        const struct ip6t_log_info *loginfo = targinfo;
        char level_string[4] = "< >";
 
@@ -375,41 +374,32 @@ ip6t_log_target(struct sk_buff **pskb,
                in ? in->name : "",
                out ? out->name : "");
        if (in && !out) {
+               unsigned int len;
                /* MAC logging for input chain only. */
                printk("MAC=");
-               if ((*pskb)->dev && (*pskb)->dev->hard_header_len && 
(*pskb)->mac.raw != (void*)ipv6h) {
-                       if ((*pskb)->dev->type != ARPHRD_SIT){
-                         int i;
-                         unsigned char *p = (*pskb)->mac.raw;
-                         for (i = 0; i < (*pskb)->dev->hard_header_len; 
i++,p++)
-                               printk("%02x%c", *p,
-                                       i==(*pskb)->dev->hard_header_len - 1
-                                       ? ' ':':');
-                       } else {
-                         int i;
-                         unsigned char *p = (*pskb)->mac.raw;
-                         if ( p - (ETH_ALEN*2+2) > (*pskb)->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 (((*pskb)->dev->addr_len == 4) &&
-                             (*pskb)->dev->hard_header_len > 20){
-                           printk("TUNNEL=");
-                           p = (*pskb)->mac.raw + 12;
-                           for (i = 0; i < 4; i++,p++)
-                               printk("%3d%s", *p,
-                                       i == 3 ? "->" : ".");
-                           for (i = 0; i < 4; i++,p++)
-                               printk("%3d%c", *p,
-                                       i == 3 ? ' ' : '.');
-                         }
+               if ((*pskb)->dev && (len = (*pskb)->dev->hard_header_len) &&
+                   (*pskb)->mac.raw != (*pskb)->nh.raw) {
+                       unsigned char *p = (*pskb)->mac.raw;
+                       int i;
+
+                       if ((*pskb)->dev->type == ARPHRD_SIT &&
+                           (p -= ETH_HLEN) < (*pskb)->head)
+                               p = NULL;
+
+                       if (p != NULL) {
+                               for (i = 0; i < len; i++)
+                                       printk("%02x%s", p[i],
+                                              i == len - 1 ? "" : ":");
+                       }
+                       printk(" ");
+
+                       if ((*pskb)->dev->type == ARPHRD_SIT) {
+                               struct iphdr *iph;
+                               
+                               iph = (struct iphdr *)(*pskb)->mac.raw;
+                               printk("TUNNEL=%u.%u.%u.%u->%u.%u.%u.%u ",
+                                      NIPQUAD(iph->saddr),
+                                      NIPQUAD(iph->daddr));
                        }
                } else
                        printk(" ");
-
To unsubscribe from this list: send the line "unsubscribe git-commits-24" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to