interface: fix removing main_dev on config reload changes if ifname is reset to NULL
authorFelix Fietkau <nbd@openwrt.org>
Thu, 25 Apr 2013 16:27:20 +0000 (18:27 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 25 Apr 2013 16:27:20 +0000 (18:27 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
interface.c

index 3a8fd3427846a1a60811b06df143e634c6608c43..a2c3f44fb6c84b57953e58f2c58ef2b4d10f9adc 100644 (file)
@@ -328,9 +328,14 @@ interface_claim_device(struct interface *iface)
 static void
 interface_cleanup_state(struct interface *iface)
 {
+       interface_set_available(iface, false);
+
        interface_flush_state(iface);
        interface_clear_errors(iface);
        interface_set_proto_state(iface, NULL);
+
+       if (iface->main_dev.dev)
+               interface_set_main_dev(iface, NULL);
 }
 
 static void
@@ -345,9 +350,6 @@ interface_cleanup(struct interface *iface)
                interface_remove_user(dep);
 
        interface_ip_flush(&iface->config_ip);
-       if (iface->main_dev.dev)
-               interface_set_main_dev(iface, NULL);
-
        interface_cleanup_state(iface);
 }