X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=defaults.c;h=0992f58d695c08f4e9e5f4513a495db5f91dd654;hb=275a37dbf280bd471ebb2c673267c49a81071bbb;hp=2d646953684a551b6ef10d0398289fb68c0402f3;hpb=3968e2a659324a24bb1bd8d461c8bb83c5db7f72;p=project%2Ffirewall3.git diff --git a/defaults.c b/defaults.c index 2d64695..0992f58 100644 --- a/defaults.c +++ b/defaults.c @@ -295,30 +295,29 @@ reset_policy(enum fw3_table table) void fw3_flush_rules(enum fw3_table table, enum fw3_family family, - bool pass2, struct list_head *statefile) + bool pass2, struct fw3_state *state) { - struct fw3_statefile_entry *e; + struct fw3_defaults *d = &state->running_defaults; - list_for_each_entry(e, statefile, list) + if (!hasbit(d->flags, family)) + return; + + if (!pass2) { - if (e->type != FW3_TYPE_DEFAULTS) - continue; + reset_policy(table); - if (!pass2) - { - reset_policy(table); + print_chains(table, family, "-D %s\n", state->running_defaults.flags, + toplevel_rules, ARRAY_SIZE(toplevel_rules)); - print_chains(table, family, "-D %s\n", e->flags[0], - toplevel_rules, ARRAY_SIZE(toplevel_rules)); + print_chains(table, family, "-F %s\n", state->running_defaults.flags, + default_chains, ARRAY_SIZE(default_chains)); + } + else + { + print_chains(table, family, "-X %s\n", state->running_defaults.flags, + default_chains, ARRAY_SIZE(default_chains)); - print_chains(table, family, "-F %s\n", e->flags[0], - default_chains, ARRAY_SIZE(default_chains)); - } - else - { - print_chains(table, family, "-X %s\n", e->flags[0], - default_chains, ARRAY_SIZE(default_chains)); - } + delbit(d->flags, family); } }