18971c
From 7316d68353cfd6e08f007d10ea3e32fa4d083487 Mon Sep 17 00:00:00 2001
18971c
From: Harald Hoyer <harald@redhat.com>
18971c
Date: Tue, 1 Sep 2015 19:05:37 +0200
18971c
Subject: [PATCH] network/ifup: do DHCP for BOOTDEV
18971c
18971c
---
18971c
 modules.d/40network/ifup.sh | 19 ++++++++++++++-----
18971c
 1 file changed, 14 insertions(+), 5 deletions(-)
18971c
18971c
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
18971c
index db9fb085..0471c425 100755
18971c
--- a/modules.d/40network/ifup.sh
18971c
+++ b/modules.d/40network/ifup.sh
18971c
@@ -430,11 +430,20 @@ fi
18971c
 
18971c
 # no ip option directed at our interface?
18971c
 if [ ! -e /tmp/net.${netif}.up ]; then
18971c
-    if getargs 'ip=dhcp6'; then
18971c
-        load_ipv6
18971c
-        do_dhcp -6
18971c
-    elif getargs 'ip=dhcp'; then
18971c
-        do_dhcp -4
18971c
+    if [ -e /tmp/net.bootdev ]; then
18971c
+        BOOTDEV=$(cat /tmp/net.bootdev)
18971c
+        if [ "$netif" = "$BOOTDEV" ] || [ "$BOOTDEV" = "$(cat /sys/class/net/${netif}/address)" ]; then
18971c
+            load_ipv6
18971c
+            do_dhcp
18971c
+        fi
18971c
+    else
18971c
+        if getargs 'ip=dhcp6'; then
18971c
+            load_ipv6
18971c
+            do_dhcp -6
18971c
+        fi
18971c
+        if getargs 'ip=dhcp'; then
18971c
+            do_dhcp -4
18971c
+        fi
18971c
     fi
18971c
 fi
18971c