From 6a7581ccbdbc468a6362f100a9393203fedc4700 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 11 Aug 2010 17:44:21 +0200 Subject: [PATCH] Flush the route cache after changing routes --- route.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/route.c b/route.c index f436691..5425d51 100644 --- a/route.c +++ b/route.c @@ -20,12 +20,25 @@ #include #include #include +#include #include "relayd.h" static struct uloop_fd rtnl_sock; static unsigned int rtnl_seq, rtnl_dump_seq; +static void rtnl_flush(void) +{ + int fd; + + fd = open("/proc/sys/net/ipv4/route/flush", O_WRONLY); + if (fd < 0) + return; + + write(fd, "-1", 2); + close(fd); +} + static void rtnl_route_set(struct relayd_host *host, bool add) { static struct { @@ -70,6 +83,7 @@ static void rtnl_route_set(struct relayd_host *host, bool add) } send(rtnl_sock.fd, &req, sizeof(req), 0); + rtnl_flush(); } void relayd_add_route(struct relayd_host *host) -- 2.25.1