From f059985b14f80a41f3b8103b67cb8fae0d3fc2fc Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 25 Sep 2015 10:14:33 -0400 Subject: [PATCH] network:wait_for_ifup() handle "NO-CARRIER" output if "NO-CARRIER" is one of the flags, we surely have no link yet. --- modules.d/40network/net-lib.sh | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh index 60d3579a..995d32f6 100755 --- a/modules.d/40network/net-lib.sh +++ b/modules.d/40network/net-lib.sh @@ -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 - *\*) - 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 + *\*) + 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))