Change fw3_no_family() macro to take bit field value directly
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 10 Mar 2013 20:21:03 +0000 (21:21 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 11 Mar 2013 11:35:23 +0000 (12:35 +0100)
ipsets.c
utils.c
utils.h
zones.c

index 2c397b0853be025bff5532201573dbba9785166f..74706ff5f05dc2d3029d9c52fa4865549f832302 100644 (file)
--- a/ipsets.c
+++ b/ipsets.c
@@ -379,10 +379,9 @@ fw3_destroy_ipsets(struct fw3_state *state, enum fw3_family family)
 
        list_for_each_entry_safe(s, tmp, &state->running_ipsets, running_list)
        {
-               if (hasbit(s->running_flags, family))
-                       delbit(s->flags, family);
+               delbit(s->running_flags, family);
 
-               if (fw3_no_family(s))
+               if (fw3_no_family(s->running_flags))
                {
                        info(" * Deleting ipset %s", s->name);
 
diff --git a/utils.c b/utils.c
index 2747a853a8b99f9b4e021b2c867092f8fd4d3156..ab1d68bbef66669b6955fe5af7c8c0d2ce3b8cbe 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -441,7 +441,7 @@ fw3_write_statefile(void *state)
        struct fw3_zone *z;
        struct fw3_ipset *i;
 
-       if (fw3_no_family(d))
+       if (fw3_no_family(d->flags))
        {
                if (unlink(FW3_STATEFILE))
                        warn("Unable to remove state %s: %s",
diff --git a/utils.h b/utils.h
index 79bf394677e0faa6a2750039c89f8f8658129c91..c3dc974bfea513a15003d9e0b5d81be7c7166f40 100644 (file)
--- a/utils.h
+++ b/utils.h
@@ -55,8 +55,8 @@ void info(const char *format, ...);
 #define fw3_is_family(p, f)                                                \
        (!p || (p)->family == FW3_FAMILY_ANY || (p)->family == f)
 
-#define fw3_no_family(p)                                                   \
-       (!p || !((p)->flags & ((1 << FW3_FAMILY_V4) | (1 << FW3_FAMILY_V6))))
+#define fw3_no_family(flags)                                               \
+       (!(flags & ((1 << FW3_FAMILY_V4) | (1 << FW3_FAMILY_V6))))
 
 const char * fw3_find_command(const char *cmd);
 
diff --git a/zones.c b/zones.c
index ab656ef75381e82d8dec10b04a9593250547099b..4bf7df4c1c79872368a99ecc2e601ab7f685e21e 100644 (file)
--- a/zones.c
+++ b/zones.c
@@ -563,9 +563,9 @@ fw3_flush_zones(enum fw3_table table, enum fw3_family family,
 
                if (pass2)
                {
-                       delbit(z->flags, family);
+                       delbit(z->running_flags, family);
 
-                       if (fw3_no_family(z))
+                       if (fw3_no_family(z->running_flags))
                                fw3_set_running(z, NULL);
                }
        }