Blame SOURCES/0330-network-net-lib.sh-fix-wait_for_if_up.patch

64b87c
From d8572e0bf4d49a8d2ec71726d0fd38d1c73ca3f7 Mon Sep 17 00:00:00 2001
64b87c
From: Harald Hoyer <harald@redhat.com>
64b87c
Date: Tue, 1 Sep 2015 17:22:56 +0200
64b87c
Subject: [PATCH] network/net-lib.sh: fix wait_for_if_up()
64b87c
64b87c
wait for <*UP*> and not "state UP"
64b87c
64b87c
state can be UNKNOWN
64b87c
---
64b87c
 modules.d/40network/net-lib.sh | 16 +++++++++++++++-
64b87c
 1 file changed, 15 insertions(+), 1 deletion(-)
64b87c
64b87c
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
1755ca
index c8203567..6034a091 100755
64b87c
--- a/modules.d/40network/net-lib.sh
64b87c
+++ b/modules.d/40network/net-lib.sh
64b87c
@@ -523,7 +523,21 @@ wait_for_if_up() {
64b87c
 
64b87c
     while [ $cnt -lt $timeout ]; do
64b87c
         li=$(ip -o link show up dev $1)
64b87c
-        [ -n "$li" ] && [ -z "${li##*state UP*}" ] && return 0
64b87c
+        if [ -n "$li" ]; then
64b87c
+            case "$li" in
64b87c
+                *\
64b87c
+                    return 0;;
64b87c
+                *\<*,UP\>*)
64b87c
+                    return 0;;
64b87c
+                *\<*,UP,*\>*)
64b87c
+                    return 0;;
64b87c
+            esac
64b87c
+        fi
64b87c
+        if strstr "$li" "LOWER_UP" \
64b87c
+                && strstr "$li" "state UNKNOWN" \
64b87c
+                && ! strstr "$li" "DORMANT"; then
64b87c
+            return 0
64b87c
+        fi
64b87c
         sleep 0.1
64b87c
         cnt=$(($cnt+1))
64b87c
     done