Remove unused "running" argument form fw3_lookup_ipset()
[project/firewall3.git] / ipsets.c
index d6ff9bd..baa0949 100644 (file)
--- a/ipsets.c
+++ b/ipsets.c
@@ -296,7 +296,7 @@ create_ipset(struct fw3_ipset *ipset, struct fw3_state *state)
        if (ipset->external && *ipset->external)
                return;
 
-       info("Creating ipset %s", ipset->name);
+       info(" * Creating ipset %s", ipset->name);
 
        first = true;
        fw3_pr("create %s %s", ipset->name, methods[ipset->method]);
@@ -353,8 +353,6 @@ create_ipset(struct fw3_ipset *ipset, struct fw3_state *state)
                fw3_pr(" hashsize %u", ipset->hashsize);
 
        fw3_pr("\n");
-
-       fw3_set_running(ipset, &state->running_ipsets);
 }
 
 void
@@ -366,7 +364,7 @@ fw3_create_ipsets(struct fw3_state *state)
                return;
 
        list_for_each_entry(ipset, &state->ipsets, list)
-               if (!fw3_lookup_ipset(state, ipset->name, true))
+               if (!hasbit(ipset->flags[0], FW3_FLAG_DELETED))
                        create_ipset(ipset, state);
 
        fw3_pr("quit\n");
@@ -376,27 +374,23 @@ void
 fw3_destroy_ipsets(struct fw3_state *state, enum fw3_family family)
 {
        struct fw3_ipset *s, *tmp;
-       uint32_t family_mask = (1 << FW3_FAMILY_V4) | (1 << FW3_FAMILY_V6);
 
-       list_for_each_entry_safe(s, tmp, &state->running_ipsets, running_list)
+       list_for_each_entry_safe(s, tmp, &state->ipsets, list)
        {
-               if (hasbit(s->running_flags, family))
-                       delbit(s->flags, family);
+               del(s->flags, family, family);
 
-               if (!(s->flags & family_mask))
+               if (fw3_no_family(s->flags[family == FW3_FAMILY_V6]))
                {
-                       info("Deleting ipset %s", s->name);
+                       info(" * Deleting ipset %s", s->name);
 
                        fw3_pr("flush %s\n", s->name);
                        fw3_pr("destroy %s\n", s->name);
-
-                       fw3_set_running(s, NULL);
                }
        }
 }
 
 struct fw3_ipset *
-fw3_lookup_ipset(struct fw3_state *state, const char *name, bool running)
+fw3_lookup_ipset(struct fw3_state *state, const char *name)
 {
        struct fw3_ipset *s;
 
@@ -408,10 +402,7 @@ fw3_lookup_ipset(struct fw3_state *state, const char *name, bool running)
                if (strcmp(s->name, name))
                        continue;
 
-               if (!running || s->running_list.next)
-                       return s;
-
-               break;
+               return s;
        }
 
        return NULL;