Implement a "quiet" mode for rc.d/netif, which only outputs
the interface name of interfaces that were configured. This change has the added benefit that ifn_start() and ifn_stop() in network.subr no longer write to standard output. Whether to output and what to output is now handled entirely in rc.d/netif.
This commit is contained in:
parent
a2c7567159
commit
b064049801
@ -48,10 +48,6 @@ ifn_start()
|
||||
ipx_up ${ifn} && cfg=0
|
||||
childif_create ${ifn}
|
||||
|
||||
if [ "$cfg" -eq 0 ]; then
|
||||
ifconfig ${ifn}
|
||||
fi
|
||||
|
||||
return $cfg
|
||||
}
|
||||
|
||||
@ -73,10 +69,6 @@ ifn_stop()
|
||||
ifscript_down ${ifn} && cfg=0
|
||||
childif_destroy ${ifn}
|
||||
|
||||
if [ "$cfg" -eq 0 ]; then
|
||||
echo -n " ${ifn}"
|
||||
fi
|
||||
|
||||
return $cfg
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ pccard_ether_start()
|
||||
done
|
||||
fi
|
||||
|
||||
/etc/rc.d/netif start $ifn
|
||||
/etc/rc.d/netif quietstart $ifn
|
||||
|
||||
# Do route configuration if needed.
|
||||
# XXX: should probably do this by calling rc.d/routing.
|
||||
@ -99,7 +99,7 @@ pccard_ether_stop()
|
||||
fi
|
||||
fi
|
||||
|
||||
/etc/rc.d/netif stop $ifn
|
||||
/etc/rc.d/netif quietstop $ifn
|
||||
|
||||
# clean ARP table
|
||||
ifexists $ifn && arp -d -i $ifn -a
|
||||
|
@ -85,11 +85,8 @@ network_stop()
|
||||
#
|
||||
cmdifn=$*
|
||||
|
||||
echo -n "Stopping network:"
|
||||
|
||||
# Deconfigure the interface(s)
|
||||
network_common ifn_stop
|
||||
echo '.'
|
||||
}
|
||||
|
||||
# network_common routine
|
||||
@ -98,7 +95,7 @@ network_stop()
|
||||
# an interface and then calls $routine.
|
||||
network_common()
|
||||
{
|
||||
local _cooked_list _fail _func
|
||||
local _cooked_list _fail _func _ok _str
|
||||
|
||||
_func=
|
||||
|
||||
@ -123,12 +120,31 @@ network_common()
|
||||
fi
|
||||
|
||||
_fail=
|
||||
_ok=
|
||||
for ifn in ${_cooked_list}; do
|
||||
if ! ${_func} ${ifn} $2; then
|
||||
if ${_func} ${ifn} $2; then
|
||||
_ok="${_ok} ${ifn}"
|
||||
else
|
||||
_fail="${_fail} ${ifn}"
|
||||
fi
|
||||
done
|
||||
|
||||
_str=
|
||||
if [ -n "${_ok}" ]; then
|
||||
case ${_func} in
|
||||
ifn_start)
|
||||
_str='Starting'
|
||||
;;
|
||||
ifn_stop)
|
||||
_str='Stopping'
|
||||
;;
|
||||
esac
|
||||
echo "${_str} Network:${_ok}."
|
||||
if [ -z "${rc_quiet}" ]; then
|
||||
/sbin/ifconfig ${_ok}
|
||||
fi
|
||||
fi
|
||||
|
||||
debug "The following interfaces were not configured: $_fail"
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user