[netfilter-cvslog] r3278 - trunk/nfsim/tools

rusty at netfilter.org rusty at netfilter.org
Thu Nov 11 06:05:39 CET 2004


Author: rusty at netfilter.org
Date: 2004-11-11 06:05:38 +0100 (Thu, 11 Nov 2004)
New Revision: 3278

Modified:
   trunk/nfsim/tools/gen_err.c
   trunk/nfsim/tools/gen_ip.c
   trunk/nfsim/tools/gen_ip.h
Log:
Keep valgrind happy by initializing all of data (some was inside union).


Modified: trunk/nfsim/tools/gen_err.c
===================================================================
--- trunk/nfsim/tools/gen_err.c	2004-11-11 05:04:59 UTC (rev 3277)
+++ trunk/nfsim/tools/gen_err.c	2004-11-11 05:05:38 UTC (rev 3278)
@@ -71,7 +71,7 @@
 	packet->u.icmph.checksum = 0;
 	packet->u.icmph.un.gateway = 0; /* MBZ */
 
-	memcpy(packet->u.raw + sizeof(struct icmphdr), &orig->iph, origlen);
+	memcpy(&packet->u.icmph + 1, &orig->iph, origlen);
 
 	packet->u.icmph.checksum
 		= ~csum_partial(&packet->u,

Modified: trunk/nfsim/tools/gen_ip.c
===================================================================
--- trunk/nfsim/tools/gen_ip.c	2004-11-11 05:04:59 UTC (rev 3277)
+++ trunk/nfsim/tools/gen_ip.c	2004-11-11 05:05:38 UTC (rev 3278)
@@ -494,7 +494,7 @@
 
 	skb->mac.ethernet = (void *)(skb->data + offsetof(struct packet, ehdr));
 	skb->nh.iph       = (void *)(skb->data + offsetof(struct packet, iph));
-	skb->h.raw        = skb->data + offsetof(struct packet, u.raw);
+	skb->h.raw        = skb->data + offsetof(struct packet, u);
 
 	skb->protocol = skb->mac.ethernet->h_proto;
 
@@ -662,7 +662,7 @@
 		argv++;
 	}
 
-	memset(packet->data, 0, sizeof(packet->data));
+	memset(&packet->u, 0, sizeof(packet->u));
 	datalen = parse_header(packet, argv[1], argv[2], argv[3], argv[4],
 			       tos);
 	if (datalen < 0)

Modified: trunk/nfsim/tools/gen_ip.h
===================================================================
--- trunk/nfsim/tools/gen_ip.h	2004-11-11 05:04:59 UTC (rev 3277)
+++ trunk/nfsim/tools/gen_ip.h	2004-11-11 05:05:38 UTC (rev 3278)
@@ -11,10 +11,9 @@
 	union {
 		struct tcphdr tcph;
 		struct udphdr udph;
-		struct icmphdr icmph;
-		unsigned char raw[0];
+		struct icmphdr icmph;	
+		unsigned char raw_data[65536];
 	} u;
-	unsigned char data[65535];
 };
 
 /* Fill in packet, given arguments. */




More information about the netfilter-cvslog mailing list