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