]> git.ozlabs.org Git - petitboot/blobdiff - discover/network.c
discover/network: Fix incorrect udhcpc command if we have no platform definition
[petitboot] / discover / network.c
index ca4cc44acf1ba3d1334452b547326041c33f8b13..36807f0aecbd9881ef015b1a182f2091aabac60e 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) {
@@ -220,6 +229,7 @@ static void configure_interface_dhcp(struct interface *interface)
                pb_system_apps.udhcpc,
                "-R",
                "-n",
+               "-f",
                "-O", "pxeconffile",
                "-O", "pxepathprefix",
                "-p", pidfile,
@@ -235,7 +245,7 @@ static void configure_interface_dhcp(struct interface *interface)
        if (platform && platform->dhcp_arch_id != 0xffff)
                snprintf(id, sizeof(id), "0x5d:%04x", platform->dhcp_arch_id);
        else
-               argv[11] = NULL;
+               argv[12] = NULL;
 
        process = process_create(interface);