diff --git a/modules.d/35network-legacy/dhcp-multi.sh b/modules.d/35network-legacy/dhcp-multi.sh index df091a521f..1c1415a3d2 100755 --- a/modules.d/35network-legacy/dhcp-multi.sh +++ b/modules.d/35network-legacy/dhcp-multi.sh @@ -21,6 +21,13 @@ do_dhclient() { _timeout=$(getarg rd.net.timeout.dhcp=) _DHCPRETRY=$(getargnum 1 1 1000000000 rd.net.dhcp.retry=) + if [ -n "$_timeout" ]; then + if ! (dhclient --help 2>&1 | grep -q -F -- '--timeout' 2> /dev/null); then + warn "rd.net.timeout.dhcp has no effect because dhclient does not implement the --timeout option" + unset _timeout + fi + fi + while [ $_COUNT -lt "$_DHCPRETRY" ]; do info "Starting dhcp for interface $netif" dhclient "$arg" \ diff --git a/modules.d/35network-legacy/ifup.sh b/modules.d/35network-legacy/ifup.sh index 0dc9541c8b..df40596159 100755 --- a/modules.d/35network-legacy/ifup.sh +++ b/modules.d/35network-legacy/ifup.sh @@ -73,6 +73,13 @@ do_dhcp() { return 1 fi + if [ -n "$_timeout" ]; then + if ! (dhclient --help 2>&1 | grep -q -F -- '--timeout' 2> /dev/null); then + warn "rd.net.timeout.dhcp has no effect because dhclient does not implement the --timeout option" + unset _timeout + fi + fi + if [ ! -e /run/NetworkManager/conf.d/10-dracut-dhclient.conf ]; then mkdir -p /run/NetworkManager/conf.d echo '[main]' > /run/NetworkManager/conf.d/10-dracut-dhclient.conf