]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
network-legacy/ifup: fix ip=dhcp,dhcp6 setup_net logic
authorJonathan Lebon <jonathan@jlebon.com>
Wed, 19 Feb 2020 15:44:24 +0000 (10:44 -0500)
committerLukáš Nykrýn <lnykryn@redhat.com>
Tue, 25 Feb 2020 13:34:58 +0000 (14:34 +0100)
Previously, we were doing `setup_net` from `ifup` for any setup that
wasn't DHCP, since those are already taken care of by `dhclient-script`.

The issue is that the case-statement we use to detect this doesn't catch
options like `ip=dhcp,dhcp6`.

Fix this by reworking the logic here to just check if a
`setup_net_$netif.sh` hook exists. If so, then we know that `setup_net`
will be called for this interface later.

This was causing issues in RHCOS which now ships with `ip=dhcp,dhcp6` to
support IPv6 environments[1]. The code here would make us do `setup_net`
pre-emptively which IIUC would then cause the initqueue to finish
earlier even if we had more udev netif events to process.

[1] https://github.com/coreos/coreos-assembler/pull/1067

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1803926

modules.d/35network-legacy/ifup.sh

index a3756c5dceb98af175f2a1948fbbf6ec545019f0..c05ccc1bcd4f2dd8113ef1ae2c470819d34696eb 100755 (executable)
@@ -453,17 +453,15 @@ for p in $(getargs ip=); do
             > /tmp/net.$(cat /sys/class/net/${netif}/address).up
         fi
 
-        case $autoconf in
-            dhcp|on|any|dhcp6)
-            ;;
-            *)
-                setup_net $netif
-                source_hook initqueue/online $netif
-                if [ -z "$manualup" ]; then
-                    /sbin/netroot $netif
-                fi
-                ;;
-        esac
+        # and finally, finish interface set up if there isn't already a script
+        # to do so (which is the case in the dhcp path)
+        if [ ! -e $hookdir/initqueue/setup_net_$netif.sh ]; then
+            setup_net $netif
+            source_hook initqueue/online $netif
+            if [ -z "$manualup" ]; then
+                /sbin/netroot $netif
+            fi
+        fi
 
         if command -v wicked >/dev/null && [ -z "$manualup" ]; then
             /sbin/netroot $netif