}
void
-fw3_destroy_ipsets(struct fw3_state *state, enum fw3_family family)
+fw3_destroy_ipsets(struct fw3_state *state)
{
- struct fw3_ipset *s, *tmp;
+ struct fw3_ipset *s;
- list_for_each_entry_safe(s, tmp, &state->ipsets, list)
+ list_for_each_entry(s, &state->ipsets, list)
{
- del(s->flags, family, family);
+ info(" * Deleting ipset %s", s->name);
- if (fw3_no_family(s->flags[family == FW3_FAMILY_V6]))
- {
- info(" * Deleting ipset %s", s->name);
-
- fw3_pr("flush %s\n", s->name);
- fw3_pr("destroy %s\n", s->name);
- }
+ fw3_pr("flush %s\n", s->name);
+ fw3_pr("destroy %s\n", s->name);
}
}
struct fw3_ipset * fw3_alloc_ipset(void);
void fw3_load_ipsets(struct fw3_state *state, struct uci_package *p);
void fw3_create_ipsets(struct fw3_state *state);
-void fw3_destroy_ipsets(struct fw3_state *state, enum fw3_family family);
+void fw3_destroy_ipsets(struct fw3_state *state);
struct fw3_ipset * fw3_lookup_ipset(struct fw3_state *state, const char *name);
}
fw3_command_close();
+ family_set(run_state, family, false);
+ family_set(cfg_state, family, false);
- if (!reload && run_state)
- {
- if (fw3_command_pipe(false, "ipset", "-exist", "-"))
- {
- fw3_destroy_ipsets(run_state, family);
- fw3_command_close();
- }
+ rv = 0;
+ }
- family_set(run_state, family, false);
- family_set(cfg_state, family, false);
+ if (!reload && run_state)
+ {
+ if (fw3_command_pipe(false, "ipset", "-exist", "-"))
+ {
+ fw3_destroy_ipsets(run_state);
+ fw3_command_close();
}
-
- rv = 0;
}
if (complete && (ct = fopen("/proc/net/nf_conntrack", "w")) != NULL)
write_ipset_uci(struct uci_context *ctx, struct fw3_ipset *s,
struct uci_package *dest)
{
- enum fw3_family fam = FW3_FAMILY_ANY;
-
char buf[sizeof("0xffffffff\0")];
struct uci_ptr ptr = { .p = dest };
if (!s->enabled || (s->external && *s->external))
return;
- if (fw3_no_family(s->flags[0]) && !fw3_no_family(s->flags[1]))
- fam = FW3_FAMILY_V6;
- else if (!fw3_no_family(s->flags[0]) && fw3_no_family(s->flags[1]))
- fam = FW3_FAMILY_V4;
- else if (fw3_no_family(s->flags[0]) && fw3_no_family(s->flags[1]))
- return;
-
uci_add_section(ctx, dest, "ipset", &ptr.s);
ptr.o = NULL;
ptr.value = s->name;
uci_set(ctx, &ptr);
- if (fam != FW3_FAMILY_ANY)
- {
- ptr.o = NULL;
- ptr.option = "family";
- ptr.value = fw3_flag_names[fam];
- uci_set(ctx, &ptr);
- }
-
sprintf(buf, "0x%x", s->flags[0]);
ptr.o = NULL;
ptr.option = "__flags_v4";