if (iface->state != IFS_SETUP)
return;
+ system_flush_routes();
iface->state = IFS_UP;
iface->start_time = system_get_rtime();
interface_event(iface, IFEV_UP);
if (iface->state == IFS_DOWN)
return;
+ system_flush_routes();
mark_interface_down(iface);
interface_handle_config_change(iface);
if (iface->autostart)
return 0;
}
+int system_flush_routes(void)
+{
+ return 0;
+}
+
time_t system_get_rtime(void)
{
struct timeval tv;
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;
int system_add_route(struct device *dev, struct device_route *route);
int system_del_route(struct device *dev, struct device_route *route);
+int system_flush_routes(void);
time_t system_get_rtime(void);