discover/network: flush addresses when bringing an interface down
authorJeremy Kerr <jk@ozlabs.org>
Wed, 2 Apr 2014 07:44:44 +0000 (15:44 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Wed, 2 Apr 2014 07:44:44 +0000 (15:44 +0800)
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/network.c

index ca4cc44acf1ba3d1334452b547326041c33f8b13..2b7e94cbbdad0a4987cb7cb54d820a2df8f0d3dc 100644 (file)
@@ -181,6 +181,15 @@ static int interface_change(struct interface *interface, bool up)
                process_release(interface->udhcpc_process);
        }
 
+       if (!up) {
+               rc = process_run_simple(interface, pb_system_apps.ip,
+                               "address", "flush", "dev", interface->name,
+                               NULL);
+               if (rc)
+                       pb_log("failed to flush addresses from interface %s\n",
+                               interface->name);
+       }
+
        rc = process_run_simple(interface, pb_system_apps.ip,
                        "link", "set", interface->name, statestr, NULL);
        if (rc) {