network: iface_has_carrier(): fixed logic

master
Harald Hoyer 2018-07-05 09:36:32 +02:00
parent c574c3f565
commit efecf0a95e
1 changed files with 4 additions and 0 deletions

View File

@ -726,8 +726,12 @@ iface_has_carrier() {

while [ $cnt -lt $timeout ]; do
if [ -n "$_no_carrier_flag" ]; then
li=$(ip -o link show up dev $1)
# NO-CARRIER flag was cleared
strstr "$li" "NO-CARRIER" || return 0
elif ! [ -e "$interface/carrier" ]; then
# sysfs not available and "NO-CARRIER" not displayed
return 0
fi
# double check the syscfs carrier flag
[ -e "$interface/carrier" ] && [ "$(cat $interface/carrier)" = 1 ] && return 0