Skip to contentSkip to conversation

Fix logging of SIT tunnels in ip6t_LOG

PATCH In review Harald Welte 2 participants 2 messages Oct 14, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix logging of SIT tunnels in ip6t_LOG

Hi Dave!

Below is a patch (by Andras Kis-Szabo) fixing the ip6tabels LOG target in order to correctly display the IPv4 encapsulation when SIT is used.

Please apply, thanks.

net/ipv6/netfilter/ip6t_LOG.c +32 -5
@@ -289,12 +289,39 @@
 		/* MAC logging for input chain only. */
 		printk("MAC=");
 		if ((*pskb)->dev && (*pskb)->dev->hard_header_len && (*pskb)->mac.raw != (void*)ipv6h) {
-			int i;
-			unsigned char *p = (*pskb)->mac.raw;
-			for (i = 0; i < (*pskb)->dev->hard_header_len; i++,p++)
+			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
-				       ? ' ':':');
+			       		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 ? ' ' : '.');
+			  }
+			}
 		} else
 			printk(" ");
 	}
Signature · 5 lines
Live long and prosper
- Harald Welte / [email protected]               http://www.gnumonks.org/
============================================================================
"If this were a dictatorship, it'd be a heck of a lot easier, just so long
 as I'm the dictator."  --  George W. Bush Dec 18, 2000
#1 lore raw

From: Harald Welte <[email protected]>
Date: Mon, 14 Oct 2002 13:30:50 +0200

Below is a patch (by Andras Kis-Szabo) fixing the ip6tabels LOG target in order to correctly display the IPv4 encapsulation when SIT is used.

I will apply this to both 2.4.x and 2.5.x, thanks.

On the 2.4.x side, I'd like to defer these netfilter patches you are sending today until 2.4.21-pre1. I hope this won't be a huge problem?

I really don't want to contribute to 2.4.20 being delayed further. :)