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