]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
network/ifup.sh: before doing dhcp, check, if the link has a carrier
authorHarald Hoyer <harald@redhat.com>
Mon, 2 Dec 2013 09:38:21 +0000 (10:38 +0100)
committerHarald Hoyer <harald@redhat.com>
Tue, 3 Dec 2013 15:21:04 +0000 (16:21 +0100)
modules.d/40network/ifup.sh

index 9f6f44949b5b69bffc13fc62f52e26822ab17b99..2edcfe695dca55124549107356f5b51879db1cb0 100755 (executable)
@@ -87,6 +87,10 @@ do_dhcp() {
     # dhclient-script will mark the netif up and generate the online
     # event for nfsroot
     # XXX add -V vendor class and option parsing per kernel
+    if ! iface_has_link $netif; then
+        echo "No carrier detected"
+        return 1
+    fi
     echo "Starting dhcp for interface $netif"
     dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif \
         || echo "dhcp failed"