diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-10-14 04:40:44 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-10-14 04:40:44 +0200 |
commit | ca3f00d45e72c4b28b2ce39afc9543fa2f225020 (patch) | |
tree | 07589adfd013188a4737a4d631eecb5346f3dd93 /system-linux.c | |
parent | 2f47fa5db2ce0fbe118ed9b6727c3956a48c85fb (diff) |
flush routes after bringing up/down an interface
Diffstat (limited to 'system-linux.c')
-rw-r--r-- | system-linux.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/system-linux.c b/system-linux.c index cf4e9c7..bb834a2 100644 --- a/system-linux.c +++ b/system-linux.c @@ -446,6 +446,25 @@ int system_del_route(struct device *dev, struct device_route *route) return system_rt(dev, route, RTM_DELROUTE); } +int system_flush_routes(void) +{ + const char *names[] = { + "/proc/sys/net/ipv4/route/flush", + "/proc/sys/net/ipv6/route/flush" + }; + int fd, i; + + for (i = 0; i < ARRAY_SIZE(names); i++) { + fd = open(names[i], O_WRONLY); + if (fd < 0) + continue; + + write(fd, "-1", 2); + close(fd); + } + return 0; +} + time_t system_get_rtime(void) { struct timespec ts; |