[netfilter-cvslog] r7033 - trunk/iptables

kaber at trash.net kaber at trash.net
Wed Sep 5 16:10:53 CEST 2007


Author: kaber at trash.net
Date: 2007-09-05 16:10:53 +0200 (Wed, 05 Sep 2007)
New Revision: 7033

Modified:
   trunk/iptables/ip6tables.c
   trunk/iptables/iptables-restore.c
   trunk/iptables/iptables-xml.c
   trunk/iptables/iptables.c
Log:
Fix strict aliasing warnings


Modified: trunk/iptables/ip6tables.c
===================================================================
--- trunk/iptables/ip6tables.c	2007-09-05 14:02:28 UTC (rev 7032)
+++ trunk/iptables/ip6tables.c	2007-09-05 14:10:53 UTC (rev 7033)
@@ -1413,6 +1413,7 @@
 	const char *jumpto = "";
 	char *protocol = NULL;
 	int proto_used = 0;
+	u_int64_t *cnt;
 
 	memset(&fw, 0, sizeof(fw));
 
@@ -1727,12 +1728,14 @@
 					"-%c requires packet and byte counter",
 					opt2char(OPT_COUNTERS));
 
-			if (sscanf(pcnt, "%llu", (unsigned long long *)&fw.counters.pcnt) != 1)
+			cnt = &fw.counters.pcnt;
+			if (sscanf(pcnt, "%llu", (unsigned long long *)cnt) != 1)
 				exit_error(PARAMETER_PROBLEM,
 					"-%c packet counter not numeric",
 					opt2char(OPT_COUNTERS));
 
-			if (sscanf(bcnt, "%llu", (unsigned long long *)&fw.counters.bcnt) != 1)
+			cnt = &fw.counters.bcnt;
+			if (sscanf(bcnt, "%llu", (unsigned long long *)cnt) != 1)
 				exit_error(PARAMETER_PROBLEM,
 					"-%c byte counter not numeric",
 					opt2char(OPT_COUNTERS));

Modified: trunk/iptables/iptables-restore.c
===================================================================
--- trunk/iptables/iptables-restore.c	2007-09-05 14:02:28 UTC (rev 7032)
+++ trunk/iptables/iptables-restore.c	2007-09-05 14:10:53 UTC (rev 7033)
@@ -74,7 +74,11 @@
 
 static int parse_counters(char *string, struct ipt_counters *ctr)
 {
-	return (sscanf(string, "[%llu:%llu]", (unsigned long long *)&ctr->pcnt, (unsigned long long *)&ctr->bcnt) == 2);
+	u_int64_t *pcnt, *bcnt;
+
+	pcnt = &ctr->pcnt;
+	bcnt = &ctr->bcnt;
+	return (sscanf(string, "[%llu:%llu]", (unsigned long long *)pcnt, (unsigned long long *)bcnt) == 2);
 }
 
 /* global new argv and argc */

Modified: trunk/iptables/iptables-xml.c
===================================================================
--- trunk/iptables/iptables-xml.c	2007-09-05 14:02:28 UTC (rev 7032)
+++ trunk/iptables/iptables-xml.c	2007-09-05 14:10:53 UTC (rev 7033)
@@ -70,12 +70,16 @@
 static int
 parse_counters(char *string, struct ipt_counters *ctr)
 {
-	if (string != NULL)
+	u_int64_t *pcnt, *bcnt;
+
+	if (string != NULL) {
+		pcnt = &ctr->pcnt;
+		bcnt = &ctr->bcnt;
 		return (sscanf
 			(string, "[%llu:%llu]",
-			 (unsigned long long *) &ctr->pcnt,
-			 (unsigned long long *) &ctr->bcnt) == 2);
-	else
+			 (unsigned long long *)pcnt,
+			 (unsigned long long *)bcnt) == 2);
+	} else
 		return (0 == 2);
 }
 

Modified: trunk/iptables/iptables.c
===================================================================
--- trunk/iptables/iptables.c	2007-09-05 14:02:28 UTC (rev 7032)
+++ trunk/iptables/iptables.c	2007-09-05 14:10:53 UTC (rev 7033)
@@ -1469,6 +1469,7 @@
 	const char *jumpto = "";
 	char *protocol = NULL;
 	int proto_used = 0;
+	u_int64_t *cnt;
 
 	memset(&fw, 0, sizeof(fw));
 
@@ -1793,12 +1794,14 @@
 					"-%c requires packet and byte counter",
 					opt2char(OPT_COUNTERS));
 
-			if (sscanf(pcnt, "%llu", (unsigned long long *)&fw.counters.pcnt) != 1)
+			cnt = &fw.counters.pcnt;
+			if (sscanf(pcnt, "%llu", (unsigned long long *)cnt) != 1)
 				exit_error(PARAMETER_PROBLEM,
 					"-%c packet counter not numeric",
 					opt2char(OPT_COUNTERS));
 
-			if (sscanf(bcnt, "%llu", (unsigned long long *)&fw.counters.bcnt) != 1)
+			cnt = &fw.counters.bcnt;
+			if (sscanf(bcnt, "%llu", (unsigned long long *)cnt) != 1)
 				exit_error(PARAMETER_PROBLEM,
 					"-%c byte counter not numeric",
 					opt2char(OPT_COUNTERS));




More information about the netfilter-cvslog mailing list