]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Fix strict aliasing warnings
authorPatrick McHardy <kaber@trash.net>
Wed, 5 Sep 2007 14:10:53 +0000 (14:10 +0000)
committerPatrick McHardy <kaber@trash.net>
Wed, 5 Sep 2007 14:10:53 +0000 (14:10 +0000)
ip6tables.c
iptables-restore.c
iptables-xml.c
iptables.c

index 79c31bb9ede1913cdfb185b6de5c9ffb09ae5b35..d43029ebdbbd7a1cf076512f8d4ec0450d236632 100644 (file)
@@ -1413,6 +1413,7 @@ int do_command6(int argc, char *argv[], char **table, ip6tc_handle_t *handle)
        const char *jumpto = "";
        char *protocol = NULL;
        int proto_used = 0;
+       u_int64_t *cnt;
 
        memset(&fw, 0, sizeof(fw));
 
@@ -1727,12 +1728,14 @@ int do_command6(int argc, char *argv[], char **table, ip6tc_handle_t *handle)
                                        "-%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));
index 1a4beeb4238a183f2b3b989e74b40a8f52fdcb86..df351ad638f79d1cb047b63183a07d202335e87f 100644 (file)
@@ -74,7 +74,11 @@ iptc_handle_t create_handle(const char *tablename, const char* modprobe )
 
 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 */
index 1bb2e2034dbe7b308633d08443a8a9d8372905c9..2aefb1aa6af96b3f90ccc354b53111120796f9ff 100644 (file)
@@ -70,12 +70,16 @@ print_usage(const char *name, const char *version)
 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);
 }
 
index 344d2d65d4159b0befbaf49fe782a363fde37416..549c6cd035d08b3c233df621d6ebd4f45e2d781f 100644 (file)
@@ -1469,6 +1469,7 @@ int do_command(int argc, char *argv[], char **table, iptc_handle_t *handle)
        const char *jumpto = "";
        char *protocol = NULL;
        int proto_used = 0;
+       u_int64_t *cnt;
 
        memset(&fw, 0, sizeof(fw));
 
@@ -1793,12 +1794,14 @@ int do_command(int argc, char *argv[], char **table, iptc_handle_t *handle)
                                        "-%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));