clear all remaining addresses on interface down
[project/netifd.git] / interface.c
index 0576166..0a53151 100644 (file)
@@ -64,6 +64,7 @@ interface_event(struct interface *iface, enum interface_event ev)
 static void
 mark_interface_down(struct interface *iface)
 {
+       interface_del_ctx_addr(iface, NULL);
        release_device(iface->main_dev.dev);
        iface->state = IFS_DOWN;
 }
@@ -189,6 +190,8 @@ alloc_interface(const char *name, struct uci_section *s)
        strncpy(iface->name, name, sizeof(iface->name) - 1);
        list_add(&iface->list, &interfaces);
        INIT_LIST_HEAD(&iface->errors);
+       INIT_LIST_HEAD(&iface->address);
+       INIT_LIST_HEAD(&iface->routes);
 
        proto_attach_interface(iface, s);