Blame 0150-network-wait_for_ifup-handle-NO-CARRIER-output.patch

Harald Hoyer bb31e7
From a49c1f049b1256ef17e94ef94c236f163001fee6 Mon Sep 17 00:00:00 2001
Harald Hoyer bb31e7
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer bb31e7
Date: Fri, 25 Sep 2015 10:14:33 -0400
Harald Hoyer bb31e7
Subject: [PATCH] network:wait_for_ifup() handle "NO-CARRIER" output
Harald Hoyer bb31e7
Harald Hoyer bb31e7
if "NO-CARRIER" is one of the flags, we surely have no link yet.
Harald Hoyer bb31e7
Harald Hoyer bb31e7
(cherry picked from commit f059985b14f80a41f3b8103b67cb8fae0d3fc2fc)
Harald Hoyer bb31e7
---
Harald Hoyer bb31e7
 modules.d/40network/net-lib.sh | 30 ++++++++++++++++--------------
Harald Hoyer bb31e7
 1 file changed, 16 insertions(+), 14 deletions(-)
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 706a9a5..135c378 100755
Harald Hoyer bb31e7
--- a/modules.d/40network/net-lib.sh
Harald Hoyer bb31e7
+++ b/modules.d/40network/net-lib.sh
Harald Hoyer bb31e7
@@ -537,20 +537,22 @@ 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
-        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
+        if ! strstr "$li" "NO-CARRIER"; then
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
         fi
Harald Hoyer bb31e7
         sleep 0.1
Harald Hoyer bb31e7
         cnt=$(($cnt+1))