]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
network-legacy/ifup: nuke pid and lease files if dhclient failed
authorJonathan Lebon <jonathan@jlebon.com>
Tue, 21 Jan 2020 22:57:31 +0000 (17:57 -0500)
committerHarald Hoyer <harald@hoyer.xyz>
Thu, 23 Jan 2020 08:32:25 +0000 (09:32 +0100)
Otherwise we won't retry dhclient again on that interface. In
FCOS/RHCOS, we want to bake in `ip=dhcp,dhcp6` so we automatically try
getting a DHCPv6 lease if DHCPv4 failed.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1793591

modules.d/35network-legacy/ifup.sh

index eda88ca35c763d4e2e9d9b0a9e2ca1350224d7cf..1d5a2e895b9d9b35c7cdb579cd6209707977769c 100755 (executable)
@@ -62,6 +62,9 @@ do_dhcp() {
         [ $_COUNT -lt $_DHCPRETRY ] && sleep 1
     done
     warn "dhcp for interface $netif failed"
+    # nuke those files since we failed; we might retry dhcp again if it's e.g.
+    # `ip=dhcp,dhcp6` and we check for the PID file at the top
+    rm -f /tmp/dhclient.$netif.{pid,lease}
     return 1
 }