64b87c
From f059985b14f80a41f3b8103b67cb8fae0d3fc2fc Mon Sep 17 00:00:00 2001
64b87c
From: Harald Hoyer <harald@redhat.com>
64b87c
Date: Fri, 25 Sep 2015 10:14:33 -0400
64b87c
Subject: [PATCH] network:wait_for_ifup() handle "NO-CARRIER" output
64b87c
64b87c
if "NO-CARRIER" is one of the flags, we surely have no link yet.
64b87c
---
64b87c
 modules.d/40network/net-lib.sh | 30 ++++++++++++++++--------------
64b87c
 1 file changed, 16 insertions(+), 14 deletions(-)
64b87c
64b87c
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
1755ca
index 60d3579a..995d32f6 100755
64b87c
--- a/modules.d/40network/net-lib.sh
64b87c
+++ b/modules.d/40network/net-lib.sh
64b87c
@@ -531,20 +531,22 @@ wait_for_if_up() {
64b87c
 
64b87c
     while [ $cnt -lt $timeout ]; do
64b87c
         li=$(ip -o link show up dev $1)
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
+        if ! strstr "$li" "NO-CARRIER"; then
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
         fi
64b87c
         sleep 0.1
64b87c
         cnt=$(($cnt+1))