Blame 0135-network-net-lib.sh-fix-wait_for_if_up.patch

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