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 2c397b0..74706ff 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 2747a85..ab1d68b 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 79bf394..c3dc974 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 ab656ef..4bf7df4 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);
                }
        }