diff --git a/package/gluon-radv-filterd/src/gluon-radv-filterd.c b/package/gluon-radv-filterd/src/gluon-radv-filterd.c index e47ea543..262509db 100644 --- a/package/gluon-radv-filterd/src/gluon-radv-filterd.c +++ b/package/gluon-radv-filterd/src/gluon-radv-filterd.c @@ -118,6 +118,8 @@ static struct global { .mesh_iface = "bat0", }; +static int fork_execvp_timeout(struct timespec *timeout, const char *file, + const char *const argv[]); static void error_message(int status, int errnum, char *message, ...) { va_list ap; @@ -149,6 +151,10 @@ static int timespec_diff(struct timespec *tv1, struct timespec *tv2, static void cleanup(void) { struct router *router; + struct timespec timeout = { + .tv_nsec = EBTABLES_TIMEOUT, + }; + close(G.sock); while (G.routers != NULL) { @@ -156,6 +162,17 @@ static void cleanup(void) { G.routers = router->next; free(router); } + + if (G.chain) { + /* Reset chain to accept everything again */ + if (fork_execvp_timeout(&timeout, "ebtables", (const char *[]) + { "ebtables", "-F", G.chain, NULL })) + DEBUG_MSG("warning: flushing ebtables chain %s failed, not adding a new rule", G.chain); + + if (fork_execvp_timeout(&timeout, "ebtables", (const char *[]) + { "ebtables", "-A", G.chain, "-j", "ACCEPT", NULL })) + DEBUG_MSG("warning: adding new rule to ebtables chain %s failed", G.chain); + } } static void usage(const char *msg) {