commit:     5773ba3aa4b5c5b9d96ab144292c0fc39b456038
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  2 13:30:00 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Wed Oct  2 14:43:05 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=5773ba3a

initrd.scripts: start_network(): Don't try to configure network when "ip" 
argument contains comma or colon

We are sharing "ip" kernel command-line argument with kernel's IP PNP feature.
Because we don't support the same syntax/features it's safe to assume that user
wants to use kernel's IP PNP feature when argument contains a comma or colon.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/initrd.scripts | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 2969f44..071ba32 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -2019,6 +2019,23 @@ start_network() {
                        bad_msg "Failed to start udhcpc for interface 
${GK_NET_IFACE}!"
                        return 1
                fi
+       elif echo "${IP}" | grep -qE ':|,'
+       then
+               if is_interface_up
+               then
+                       # CONFIG_IP_PNP probably caused kernel to bring up
+                       # network for us. Due to presence of ":" or ","
+                       # we can assume an advanced network configuration
+                       # which we cannot reproduce...
+                       warn_msg "Interface ${GK_NET_IFACE} is already up."
+                       warn_msg "Skipping network setup; Will use existing 
network configuration ..."
+                       run touch "${GK_NET_LOCKFILE}"
+                       return 0
+               fi
+
+               warn_msg "Found advanced network configuration (check ip= 
kernel command-line argument)!"
+               warn_msg "Assuming user want to use kernel's IP PNP; Will not 
try to start network ..."
+               return 1
        else
                if is_interface_up
                then

Reply via email to