From: Jo-Philipp Wich Date: Wed, 27 Feb 2013 13:49:09 +0000 (+0100) Subject: clear conntrack table on flush X-Git-Url: http://git.archive.openwrt.org/?p=project%2Ffirewall3.git;a=commitdiff_plain;h=c79bb766d587799bbe012defc00ed70644ceb7f5 clear conntrack table on flush --- diff --git a/main.c b/main.c index 1135c50..79d3b0b 100644 --- a/main.c +++ b/main.c @@ -162,6 +162,8 @@ family_set(struct fw3_state *state, enum fw3_family family, bool set) static int stop(struct fw3_state *state, bool complete, bool reload) { + FILE *ct; + int rv = 1; enum fw3_family family; enum fw3_table table; @@ -228,6 +230,14 @@ stop(struct fw3_state *state, bool complete, bool reload) fw3_command_close(); } + if (complete && (ct = fopen("/proc/net/nf_conntrack", "w")) != NULL) + { + info("Flushing conntrack table ..."); + + fwrite("f\n", 2, 1, ct); + fclose(ct); + } + if (!rv) fw3_write_statefile(state);