delete all routes on interface down
[project/netifd.git] / interface.c
index f6c32f4..d8f7de3 100644 (file)
@@ -5,6 +5,7 @@
 #include "netifd.h"
 #include "device.h"
 #include "interface.h"
+#include "interface-ip.h"
 #include "proto.h"
 #include "ubus.h"
 #include "config.h"
@@ -88,6 +89,7 @@ interface_event(struct interface *iface, enum interface_event ev)
 static void
 mark_interface_down(struct interface *iface)
 {
+       interface_del_all_routes(iface);
        interface_del_ctx_addr(iface, NULL);
        device_release(&iface->main_dev);
        iface->state = IFS_DOWN;
@@ -237,6 +239,7 @@ interface_alloc(const char *name, struct blob_attr *attr)
        }
 
        netifd_ubus_add_interface(iface);
+       config_set_state(&iface->config, attr);
 
        return iface;
 }