diff options
author | mtm <mtm@FreeBSD.org> | 2008-06-23 20:50:11 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2008-06-23 20:50:11 +0000 |
commit | ebef621a5c0d1fa0503febee26676d0844ab24a3 (patch) | |
tree | 35e85abf7532288a30c2f648031caa7df68cfbbf | |
parent | 24cfc8496479cf1dd0d9705cc8c7caa9002ba3db (diff) | |
download | FreeBSD-src-ebef621a5c0d1fa0503febee26676d0844ab24a3.zip FreeBSD-src-ebef621a5c0d1fa0503febee26676d0844ab24a3.tar.gz |
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.
-rw-r--r-- | etc/network.subr | 8 | ||||
-rwxr-xr-x | etc/pccard_ether | 4 | ||||
-rw-r--r-- | etc/rc.d/netif | 26 |
3 files changed, 23 insertions, 15 deletions
diff --git a/etc/network.subr b/etc/network.subr index 5976c4f..edeea0e 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -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 } diff --git a/etc/pccard_ether b/etc/pccard_ether index b284f24..841c1a0 100755 --- a/etc/pccard_ether +++ b/etc/pccard_ether @@ -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 diff --git a/etc/rc.d/netif b/etc/rc.d/netif index 8298da4..666bec8 100644 --- a/etc/rc.d/netif +++ b/etc/rc.d/netif @@ -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" } |