e83cdd
From d6d50a239eebf9da13a0d7892df00a0e725ef9d6 Mon Sep 17 00:00:00 2001
e83cdd
From: Jonathan Lebon <jonathan@jlebon.com>
e83cdd
Date: Wed, 19 Feb 2020 10:44:24 -0500
e83cdd
Subject: [PATCH] network-legacy/ifup: fix ip=dhcp,dhcp6 setup_net logic
e83cdd
e83cdd
Previously, we were doing `setup_net` from `ifup` for any setup that
e83cdd
wasn't DHCP, since those are already taken care of by `dhclient-script`.
e83cdd
e83cdd
The issue is that the case-statement we use to detect this doesn't catch
e83cdd
options like `ip=dhcp,dhcp6`.
e83cdd
e83cdd
Fix this by reworking the logic here to just check if a
e83cdd
`setup_net_$netif.sh` hook exists. If so, then we know that `setup_net`
e83cdd
will be called for this interface later.
e83cdd
e83cdd
This was causing issues in RHCOS which now ships with `ip=dhcp,dhcp6` to
e83cdd
support IPv6 environments[1]. The code here would make us do `setup_net`
e83cdd
pre-emptively which IIUC would then cause the initqueue to finish
e83cdd
earlier even if we had more udev netif events to process.
e83cdd
e83cdd
[1] https://github.com/coreos/coreos-assembler/pull/1067
e83cdd
e83cdd
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1803926
e83cdd
(cherry picked from commit 4985aa8c6e89451996e659a39fec7646e9e25f76)
e83cdd
e83cdd
Cherry-picked from: 4985aa8c6e89451996e659a39fec7646e9e25f76
e83cdd
Resolves: #1807395
e83cdd
---
e83cdd
 modules.d/35network-legacy/ifup.sh | 11 +++++------
e83cdd
 1 file changed, 5 insertions(+), 6 deletions(-)
e83cdd
e83cdd
diff --git a/modules.d/35network-legacy/ifup.sh b/modules.d/35network-legacy/ifup.sh
e83cdd
index eb7d2eb4..61838741 100755
e83cdd
--- a/modules.d/35network-legacy/ifup.sh
e83cdd
+++ b/modules.d/35network-legacy/ifup.sh
e83cdd
@@ -453,17 +453,16 @@ for p in $(getargs ip=); do
e83cdd
             > /tmp/net.$(cat /sys/class/net/${netif}/address).up
e83cdd
         fi
e83cdd
 
e83cdd
-        case $autoconf in
e83cdd
-            dhcp|on|any|dhcp6)
e83cdd
-            ;;
e83cdd
-            *)
e83cdd
+        # and finally, finish interface set up if there isn't already a script
e83cdd
+        # to do so (which is the case in the dhcp path)
e83cdd
+        if [ ! -e $hookdir/initqueue/setup_net_$netif.sh ]; then
e83cdd
                 setup_net $netif
e83cdd
                 source_hook initqueue/online $netif
e83cdd
                 if [ -z "$manualup" ]; then
e83cdd
                     /sbin/netroot $netif
e83cdd
                 fi
e83cdd
-                ;;
e83cdd
-        esac
e83cdd
+        fi
e83cdd
+
e83cdd
         exit $ret
e83cdd
     fi
e83cdd
 done