We should use $int for compat with NetBSD
This commit is contained in:
parent
371506be48
commit
a01f9be6f2
@ -105,16 +105,16 @@ dumpargs()
|
|||||||
|
|
||||||
runip()
|
runip()
|
||||||
{
|
{
|
||||||
local iface="$1" err=
|
local int="$1" err=
|
||||||
|
|
||||||
shift
|
shift
|
||||||
err=$(LC_ALL=C ip address add "$@" dev "$iface" 2>&1)
|
err=$(LC_ALL=C ip address add "$@" dev "$int" 2>&1)
|
||||||
[ -z "$err" ] && return 0
|
[ -z "$err" ] && return 0
|
||||||
if [ "$err" = "RTNETLINK answers: File exists" ]; then
|
if [ "$err" = "RTNETLINK answers: File exists" ]; then
|
||||||
ip address del "$@" dev "${iface}" 2>/dev/null
|
ip address del "$@" dev "${int}" 2>/dev/null
|
||||||
fi
|
fi
|
||||||
# Localise the error
|
# Localise the error
|
||||||
ip address add "$@" dev "$iface"
|
ip address add "$@" dev "$int"
|
||||||
}
|
}
|
||||||
|
|
||||||
routeflush()
|
routeflush()
|
||||||
@ -164,7 +164,7 @@ runargs()
|
|||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
local cr=0 r= iface= cmd= args= upcmd=
|
local cr=0 r= int= cmd= args= upcmd=
|
||||||
einfo "Starting network"
|
einfo "Starting network"
|
||||||
routeflush
|
routeflush
|
||||||
if [ "${RC_UNAME}" = "Linux" ]; then
|
if [ "${RC_UNAME}" = "Linux" ]; then
|
||||||
@ -179,24 +179,24 @@ start()
|
|||||||
127.0.0.1 -reject || cr=1
|
127.0.0.1 -reject || cr=1
|
||||||
fi
|
fi
|
||||||
eindent
|
eindent
|
||||||
for iface in $(interfaces); do
|
for int in $(interfaces); do
|
||||||
local func= cf=
|
local func= cf=
|
||||||
eval upcmd=\$ifup_$iface
|
eval upcmd=\$ifup_$int
|
||||||
for func in ip ifconfig; do
|
for func in ip ifconfig; do
|
||||||
eval cmd=\$${func}_${iface}
|
eval cmd=\$${func}_${int}
|
||||||
if [ -n "$cmd" -o -f /etc/"$func.$iface" ]; then
|
if [ -n "$cmd" -o -f /etc/"$func.$int" ]; then
|
||||||
cf=/etc/"$func.$iface"
|
cf=/etc/"$func.$int"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
[ -n "$cf" -o -n "$upcmd" -o \
|
[ -n "$cf" -o -n "$upcmd" -o \
|
||||||
-f /etc/ifup."$iface" -o -f "$cf" ] || continue
|
-f /etc/ifup."$int" -o -f "$cf" ] || continue
|
||||||
vebegin "$iface"
|
vebegin "$int"
|
||||||
case "$func" in
|
case "$func" in
|
||||||
ip) func=runip;;
|
ip) func=runip;;
|
||||||
esac
|
esac
|
||||||
eindent
|
eindent
|
||||||
runargs /etc/ifup."$iface" "$upcmd"
|
runargs /etc/ifup."$int" "$upcmd"
|
||||||
r=0
|
r=0
|
||||||
dumpargs "$cf" "$cmd" | while read -r args; do
|
dumpargs "$cf" "$cmd" | while read -r args; do
|
||||||
case "$args" in
|
case "$args" in
|
||||||
@ -212,7 +212,7 @@ start()
|
|||||||
set -o noglob
|
set -o noglob
|
||||||
eval set -- "$args"
|
eval set -- "$args"
|
||||||
vebegin "$@"
|
vebegin "$@"
|
||||||
$func "$iface" "$@"
|
$func "$int" "$@"
|
||||||
veend $?
|
veend $?
|
||||||
);;
|
);;
|
||||||
esac
|
esac
|
||||||
@ -238,22 +238,22 @@ start()
|
|||||||
|
|
||||||
stop()
|
stop()
|
||||||
{
|
{
|
||||||
local iface= cmd= downcmd=
|
local int= cmd= downcmd=
|
||||||
einfo "Stopping network"
|
einfo "Stopping network"
|
||||||
routeflush
|
routeflush
|
||||||
eindent
|
eindent
|
||||||
for iface in $(reverse $(interfaces u)); do
|
for int in $(reverse $(interfaces u)); do
|
||||||
eval downcmd=\$ifdown_$iface
|
eval downcmd=\$ifdown_$int
|
||||||
eval cmd=\$ip_$iface
|
eval cmd=\$ip_$int
|
||||||
[ -z "$cmd" ] && eval cmd=\$ifconfig_$iface
|
[ -z "$cmd" ] && eval cmd=\$ifconfig_$int
|
||||||
if [ -n "$cmd" -o -f /etc/ip."$iface" -o \
|
if [ -n "$cmd" -o -f /etc/ip."$int" -o \
|
||||||
-f /etc/ifconfig."$iface" -o \
|
-f /etc/ifconfig."$int" -o \
|
||||||
-n "$downcmd" -o -f /etc/ifdown."$iface" ];
|
-n "$downcmd" -o -f /etc/ifdown."$int" ];
|
||||||
then
|
then
|
||||||
vebegin "$iface"
|
vebegin "$int"
|
||||||
runargs /etc/ifdown."$iface" "$downcmd"
|
runargs /etc/ifdown."$int" "$downcmd"
|
||||||
ifconfig "$iface" down 2>/dev/null
|
ifconfig "$int" down 2>/dev/null
|
||||||
ifconfig "$iface" destroy 2>/dev/null
|
ifconfig "$int" destroy 2>/dev/null
|
||||||
veend $?
|
veend $?
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user