From: Jonathan Lebon Date: Tue, 21 Jan 2020 22:57:31 +0000 (-0500) Subject: network-legacy/ifup: nuke pid and lease files if dhclient failed X-Git-Tag: 050~68 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fdracut.git;a=commitdiff_plain;h=d0de58f23252a9da4a8badd71777e7c8418fa4b7 network-legacy/ifup: nuke pid and lease files if dhclient failed 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 --- diff --git a/modules.d/35network-legacy/ifup.sh b/modules.d/35network-legacy/ifup.sh index eda88ca35..1d5a2e895 100755 --- a/modules.d/35network-legacy/ifup.sh +++ b/modules.d/35network-legacy/ifup.sh @@ -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 }