]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
network:wait_for_ifup() handle "NO-CARRIER" output
authorHarald Hoyer <harald@redhat.com>
Fri, 25 Sep 2015 14:14:33 +0000 (10:14 -0400)
committerHarald Hoyer <harald@redhat.com>
Fri, 25 Sep 2015 16:42:15 +0000 (12:42 -0400)
if "NO-CARRIER" is one of the flags, we surely have no link yet.

modules.d/40network/net-lib.sh

index 60d3579ad1dbb9d16a4e6c0f829f7febb969da75..995d32f6140444c85dc87092a44f5dc1cc5c9ab8 100755 (executable)
@@ -531,20 +531,22 @@ wait_for_if_up() {
 
     while [ $cnt -lt $timeout ]; do
         li=$(ip -o link show up dev $1)
-        if [ -n "$li" ]; then
-            case "$li" in
-                *\<UP*)
-                    return 0;;
-                *\<*,UP\>*)
-                    return 0;;
-                *\<*,UP,*\>*)
-                    return 0;;
-            esac
-        fi
-        if strstr "$li" "LOWER_UP" \
-                && strstr "$li" "state UNKNOWN" \
-                && ! strstr "$li" "DORMANT"; then
-            return 0
+        if ! strstr "$li" "NO-CARRIER"; then
+            if [ -n "$li" ]; then
+                case "$li" in
+                    *\<UP*)
+                        return 0;;
+                    *\<*,UP\>*)
+                        return 0;;
+                    *\<*,UP,*\>*)
+                        return 0;;
+                esac
+            fi
+            if strstr "$li" "LOWER_UP" \
+                    && strstr "$li" "state UNKNOWN" \
+                    && ! strstr "$li" "DORMANT"; then
+                return 0
+            fi
         fi
         sleep 0.1
         cnt=$(($cnt+1))