netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch fixes strict aliasing
@ 2006-09-14 13:58 Petr Ostadal
  2007-02-13 11:24 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Ostadal @ 2006-09-14 13:58 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 408 bytes --]

Hi,

I attached patch which fixes strict aliasing. (https://bugzilla.netfilter.org/bugzilla/show_bug.cgi?id=510)

	Petr
--
Best Regards,

Petr Ostadal
Software Developer
---------------------------------------------------------------------
SUSE LINUX, s.r.o. 			e-mail: postadal@suse.cz
Lihovarska 1060/12			tel:	+420 284 028 967
190 00 Praha 9 				fax:	+420 284 028 951
Czech Republic 				http://www.suse.cz

[-- Attachment #2: Type: TEXT/x-patch, Size: 2783 bytes --]

--- ip6tables.c
+++ ip6tables.c
@@ -1724,6 +1724,7 @@
 	const char *modprobe = NULL;
 	int proto_used = 0;
 	char icmp6p[] = "icmpv6";
+	u_int64_t *p_cnt;
 
 	memset(&fw, 0, sizeof(fw));
 
@@ -2030,13 +2031,15 @@
 				exit_error(PARAMETER_PROBLEM,
 					"-%c requires packet and byte counter",
 					opt2char(OPT_COUNTERS));

-			if (sscanf(pcnt, "%llu", (unsigned long long *)&fw.counters.pcnt) != 1)
+			p_cnt = &fw.counters.pcnt;
+			if (sscanf(pcnt, "%llu", (unsigned long long *)p_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)
+			p_cnt = &fw.counters.bcnt;
+			if (sscanf(bcnt, "%llu", (unsigned long long *)p_cnt) != 1)
 				exit_error(PARAMETER_PROBLEM,
 					"-%c byte counter not numeric",
 					opt2char(OPT_COUNTERS));
--- ip6tables-restore.c
+++ ip6tables-restore.c
@@ -76,7 +76,9 @@
 
 int parse_counters(char *string, struct ip6t_counters *ctr)
 {
-	return (sscanf(string, "[%llu:%llu]", (unsigned long long *)&ctr->pcnt, (unsigned long long *)&ctr->bcnt) == 2);
+	u_int64_t *p_pcnt = &ctr->pcnt;
+	u_int64_t *p_bcnt = &ctr->bcnt;
+	return (sscanf(string, "[%llu:%llu]", (unsigned long long *)p_pcnt, (unsigned long long *)p_bcnt) == 2);
 }
 
 /* global new argv and argc */
--- iptables.c
+++ iptables.c
@@ -1846,7 +1846,8 @@
 	char *protocol = NULL;
 	const char *modprobe = NULL;
 	int proto_used = 0;
-
+    u_int64_t *p_cnt;
+    
 	memset(&fw, 0, sizeof(fw));
 
 	/* re-set optind to 0 in case do_command gets called
@@ -2159,12 +2160,14 @@
 					"-%c requires packet and byte counter",
 					opt2char(OPT_COUNTERS));
 
-			if (sscanf(pcnt, "%llu", (unsigned long long *)&fw.counters.pcnt) != 1)
+			p_cnt = &fw.counters.pcnt;
+			if (sscanf(pcnt, "%llu", (unsigned long long *)p_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)
+			p_cnt = &fw.counters.bcnt;
+			if (sscanf(bcnt, "%llu", (unsigned long long *)p_cnt) != 1)
 				exit_error(PARAMETER_PROBLEM,
 					"-%c byte counter not numeric",
 					opt2char(OPT_COUNTERS));
--- iptables-restore.c
+++ iptables-restore.c
@@ -73,7 +73,9 @@
 
 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 *p_pcnt = &ctr->pcnt;
+	u_int64_t *p_bcnt = &ctr->bcnt;
+	return (sscanf(string, "[%llu:%llu]", (unsigned long long *)p_pcnt, (unsigned long long *)p_bcnt) == 2);
 }
 
 /* global new argv and argc */

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-13 11:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-14 13:58 Patch fixes strict aliasing Petr Ostadal
2007-02-13 11:24 ` Patrick McHardy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).