dracut/0104.patch

90 lines
2.6 KiB
Diff
Raw Normal View History

From 3f5bf54fbffdc3516a08c9329b4be80b06761c7a Mon Sep 17 00:00:00 2001
From: Thomas Blume <Thomas.Blume@suse.com>
Date: Wed, 22 Jul 2020 09:34:42 +0200
Subject: [PATCH] 35network-legacy: simplify fallback dhcp setup
suppress redundant calls to network setup
combine code for "no ip option directed at our interface" and
"No ip lines default to dhcp"
correct evaluation of return code for creating did-setup files
fix application of "load_ipv6" call to ipv6 setup only
Reference: bsc#1173402
---
modules.d/35network-legacy/ifup.sh | 41 +++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/modules.d/35network-legacy/ifup.sh b/modules.d/35network-legacy/ifup.sh
index c05ccc1b..b1ae52ea 100755
--- a/modules.d/35network-legacy/ifup.sh
+++ b/modules.d/35network-legacy/ifup.sh
@@ -376,23 +376,6 @@ else
fi
-# No ip lines default to dhcp
-ip=$(getarg ip)
-
-if [ -z "$NO_AUTO_DHCP" ] && [ -z "$ip" ]; then
- if [ "$netroot" = "dhcp6" ]; then
- do_dhcp -6
- else
- do_dhcp -4
- fi
-
- for s in $(getargs nameserver); do
- [ -n "$s" ] || continue
- echo nameserver $s >> /tmp/net.$netif.resolv.conf
- done
-fi
-
-
# Specific configuration, spin through the kernel command line
# looking for ip= lines
for p in $(getargs ip=); do
@@ -473,21 +456,39 @@ done
# no ip option directed at our interface?
if [ -z "$NO_AUTO_DHCP" ] && [ ! -e /tmp/net.${netif}.up ]; then
+ ret=1
if [ -e /tmp/net.bootdev ]; then
BOOTDEV=$(cat /tmp/net.bootdev)
if [ "$netif" = "$BOOTDEV" ] || [ "$BOOTDEV" = "$(cat /sys/class/net/${netif}/address)" ]; then
- load_ipv6
do_dhcp
+ ret=$?
fi
else
- if getargs 'ip=dhcp6'; then
+ # No ip lines, no bootdev -> default to dhcp
+ ip=$(getarg ip)
+
+ if getargs 'ip=dhcp6' || [ -z "$ip" -a "$netroot" = "dhcp6" ]; then
load_ipv6
do_dhcp -6
+ ret=$?
fi
- if getargs 'ip=dhcp'; then
+ if getargs 'ip=dhcp' || [ -z "$ip" -a "$netroot" != "dhcp6" ]; then
do_dhcp -4
+ ret=$?
fi
fi
+
+ for s in $(getargs nameserver); do
+ [ -n "$s" ] || continue
+ echo nameserver $s >> /tmp/net.$netif.resolv.conf
+ done
+
+ if [ "$ret" -eq 0 ] && [ -n "$(ls /tmp/leaseinfo.${netif}*)" ]; then
+ > /tmp/net.${netif}.did-setup
+ if [ -e /sys/class/net/${netif}/address ]; then
+ > /tmp/net.$(cat /sys/class/net/${netif}/address).did-setup
+ fi
+ fi
fi
exit 0