@@ -760,31 +760,32 @@ type hostname > /dev/null 2>&1 \
760
760
761
761
iface_has_carrier () {
762
762
local cnt=0
763
- local interface =" $1 " flags=" "
763
+ local iface =" $1 " flags=" "
764
764
local timeout
765
- [ -n " $interface " ] || return 2
766
- interface=" /sys/class/net/$interface "
767
- [ -d " $interface " ] || return 2
765
+ local iface_sys_path
766
+ [ -n " $iface " ] || return 2
767
+ iface_sys_path=" /sys/class/net/$iface "
768
+ [ -d " $iface_sys_path " ] || return 2
768
769
timeout=$( getargs rd.net.timeout.carrier=)
769
770
timeout=${timeout:- 10}
770
771
timeout=$(( timeout * 10 ))
771
772
772
773
linkup " $1 "
773
774
774
- li=$( ip link show up dev " $interface " )
775
+ li=$( ip link show up dev " $iface " )
775
776
strstr " $li " " NO-CARRIER" && _no_carrier_flag=1
776
777
777
778
while [ $cnt -lt $timeout ]; do
778
779
if [ -n " $_no_carrier_flag " ]; then
779
- li=$( ip link show up dev " $interface " )
780
+ li=$( ip link show up dev " $iface " )
780
781
# NO-CARRIER flag was cleared
781
782
strstr " $li " " NO-CARRIER" || return 0
782
- elif ! [ -e " $interface /carrier" ]; then
783
+ elif ! [ -e " $iface_sys_path /carrier" ]; then
783
784
# sysfs not available and "NO-CARRIER" not displayed
784
785
return 0
785
786
fi
786
787
# double check the syscfs carrier flag
787
- [ -e " $interface /carrier" ] && [ " $( cat " $interface " /carrier) " = 1 ] && return 0
788
+ [ -e " $iface_sys_path /carrier" ] && [ " $( cat " $iface_sys_path " /carrier) " = 1 ] && return 0
788
789
sleep 0.1
789
790
cnt=$(( cnt + 1 ))
790
791
done
0 commit comments