Blob Blame History Raw
From 7aa989a4fd5c29da18e9e57fb94dec253516b0c4 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 2 Dec 2013 10:38:21 +0100
Subject: [PATCH] network/ifup.sh: before doing dhcp, check, if the link has a
 carrier

---
 modules.d/40network/ifup.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
index 9f6f449..2edcfe6 100755
--- a/modules.d/40network/ifup.sh
+++ b/modules.d/40network/ifup.sh
@@ -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"