network: iface_has_carrier(): fixed logic
parent
c574c3f565
commit
efecf0a95e
|
|
@ -726,8 +726,12 @@ iface_has_carrier() {
|
||||||
|
|
||||||
while [ $cnt -lt $timeout ]; do
|
while [ $cnt -lt $timeout ]; do
|
||||||
if [ -n "$_no_carrier_flag" ]; then
|
if [ -n "$_no_carrier_flag" ]; then
|
||||||
|
li=$(ip -o link show up dev $1)
|
||||||
# NO-CARRIER flag was cleared
|
# NO-CARRIER flag was cleared
|
||||||
strstr "$li" "NO-CARRIER" || return 0
|
strstr "$li" "NO-CARRIER" || return 0
|
||||||
|
elif ! [ -e "$interface/carrier" ]; then
|
||||||
|
# sysfs not available and "NO-CARRIER" not displayed
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
# double check the syscfs carrier flag
|
# double check the syscfs carrier flag
|
||||||
[ -e "$interface/carrier" ] && [ "$(cat $interface/carrier)" = 1 ] && return 0
|
[ -e "$interface/carrier" ] && [ "$(cat $interface/carrier)" = 1 ] && return 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue