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

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