From c79bb766d587799bbe012defc00ed70644ceb7f5 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 27 Feb 2013 14:49:09 +0100 Subject: [PATCH] clear conntrack table on flush --- main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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); -- 2.11.0