Blame SOURCES/0049-network-ifup.sh-before-doing-dhcp-check-if-the-link-.patch

966cef
From 2ec86382fb7e60ae808a591b7160e26e240a4c15 Mon Sep 17 00:00:00 2001
966cef
From: Harald Hoyer <harald@redhat.com>
966cef
Date: Mon, 2 Dec 2013 10:38:21 +0100
966cef
Subject: [PATCH] network/ifup.sh: before doing dhcp, check, if the link has a
966cef
 carrier
966cef
966cef
---
966cef
 modules.d/40network/ifup.sh | 4 ++++
966cef
 1 file changed, 4 insertions(+)
966cef
966cef
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
966cef
index 9f6f449..2edcfe6 100755
966cef
--- a/modules.d/40network/ifup.sh
966cef
+++ b/modules.d/40network/ifup.sh
966cef
@@ -87,6 +87,10 @@ do_dhcp() {
966cef
     # dhclient-script will mark the netif up and generate the online
966cef
     # event for nfsroot
966cef
     # XXX add -V vendor class and option parsing per kernel
966cef
+    if ! iface_has_link $netif; then
966cef
+        echo "No carrier detected"
966cef
+        return 1
966cef
+    fi
966cef
     echo "Starting dhcp for interface $netif"
966cef
     dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif \
966cef
         || echo "dhcp failed"