clear all remaining addresses on interface down
authorFelix Fietkau <nbd@openwrt.org>
Mon, 2 May 2011 20:20:30 +0000 (22:20 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 2 May 2011 20:20:30 +0000 (22:20 +0200)
interface-ip.c
interface.c

index 20df281..797be58 100644 (file)
@@ -40,7 +40,7 @@ void interface_del_ctx_addr(struct interface *iface, void *ctx)
        struct interface_addr *addr, *tmp;
 
        list_for_each_entry_safe(addr, tmp, &iface->address, list) {
        struct interface_addr *addr, *tmp;
 
        list_for_each_entry_safe(addr, tmp, &iface->address, list) {
-               if (addr->ctx != ctx)
+               if (ctx && addr->ctx != ctx)
                        continue;
 
                interface_del_address(iface, addr);
                        continue;
 
                interface_del_address(iface, addr);
index 88cf682..0a53151 100644 (file)
@@ -64,6 +64,7 @@ interface_event(struct interface *iface, enum interface_event ev)
 static void
 mark_interface_down(struct interface *iface)
 {
 static void
 mark_interface_down(struct interface *iface)
 {
+       interface_del_ctx_addr(iface, NULL);
        release_device(iface->main_dev.dev);
        iface->state = IFS_DOWN;
 }
        release_device(iface->main_dev.dev);
        iface->state = IFS_DOWN;
 }