}
void
-fw3_destroy_ipsets(struct fw3_state *state)
+fw3_destroy_ipsets(struct list_head *statefile)
{
- FILE *sf;
+ struct fw3_statefile_entry *e;
- char *p;
- char line[128];
-
- sf = fopen(FW3_STATEFILE, "r");
-
- if (!sf)
- return;
-
- info("Destroying ipsets ...");
-
- while (fgets(line, sizeof(line), sf))
+ if (statefile)
{
- if (strncmp(line, "ipset ", 6))
- continue;
+ info("Destroying ipsets ...");
- p = strtok(line+6, " \t\n");
-
- if (!p || !strlen(p))
- continue;
+ list_for_each_entry(e, statefile, list)
+ {
+ if (e->type != FW3_TYPE_IPSET)
+ continue;
- info(" * %s", p);
+ info(" * %s", e->name);
- fw3_pr("flush %s\n", p);
- fw3_pr("destroy %s\n", p);
+ fw3_pr("flush %s\n", e->name);
+ fw3_pr("destroy %s\n", e->name);
+ }
}
-
- fw3_pr("quit\n");
}
void