netif (179079) | netif (179961) |
---|---|
1#!/bin/sh 2# 3# Copyright (c) 2003 The FreeBSD Project. All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright --- 8 unchanged lines hidden (view full) --- 17# IN NO EVENT SHALL THE PROJECT BE LIABLE FOR ANY DIRECT, INDIRECT, 18# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24# | 1#!/bin/sh 2# 3# Copyright (c) 2003 The FreeBSD Project. All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright --- 8 unchanged lines hidden (view full) --- 17# IN NO EVENT SHALL THE PROJECT BE LIABLE FOR ANY DIRECT, INDIRECT, 18# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24# |
25# $FreeBSD: head/etc/rc.d/netif 179079 2008-05-18 02:57:54Z brooks $ | 25# $FreeBSD: head/etc/rc.d/netif 179961 2008-06-23 20:50:11Z mtm $ |
26# 27 28# PROVIDE: netif 29# REQUIRE: atm1 cleanvar ipfilter FILESYSTEMS serial sppp sysctl 30# KEYWORD: nojail 31 32. /etc/rc.subr 33. /etc/network.subr --- 46 unchanged lines hidden (view full) --- 80} 81 82network_stop() 83{ 84 # Set the list of interfaces to work on. 85 # 86 cmdifn=$* 87 | 26# 27 28# PROVIDE: netif 29# REQUIRE: atm1 cleanvar ipfilter FILESYSTEMS serial sppp sysctl 30# KEYWORD: nojail 31 32. /etc/rc.subr 33. /etc/network.subr --- 46 unchanged lines hidden (view full) --- 80} 81 82network_stop() 83{ 84 # Set the list of interfaces to work on. 85 # 86 cmdifn=$* 87 |
88 echo -n "Stopping network:" 89 | |
90 # Deconfigure the interface(s) 91 network_common ifn_stop | 88 # Deconfigure the interface(s) 89 network_common ifn_stop |
92 echo '.' | |
93} 94 95# network_common routine 96# Common configuration subroutine for network interfaces. This 97# routine takes all the preparatory steps needed for configuriing 98# an interface and then calls $routine. 99network_common() 100{ | 90} 91 92# network_common routine 93# Common configuration subroutine for network interfaces. This 94# routine takes all the preparatory steps needed for configuriing 95# an interface and then calls $routine. 96network_common() 97{ |
101 local _cooked_list _fail _func | 98 local _cooked_list _fail _func _ok _str |
102 103 _func= 104 105 if [ -z "$1" ]; then 106 err 1 "network_common(): No function name specified." 107 else 108 _func="$1" 109 fi --- 8 unchanged lines hidden (view full) --- 118 # XXXBED: is this really true or does wpa_supplicant die? 119 # if so, we should get rid of the devd entry 120 _cooked_list="$cmdifn" 121 else 122 _cooked_list="`list_net_interfaces`" 123 fi 124 125 _fail= | 99 100 _func= 101 102 if [ -z "$1" ]; then 103 err 1 "network_common(): No function name specified." 104 else 105 _func="$1" 106 fi --- 8 unchanged lines hidden (view full) --- 115 # XXXBED: is this really true or does wpa_supplicant die? 116 # if so, we should get rid of the devd entry 117 _cooked_list="$cmdifn" 118 else 119 _cooked_list="`list_net_interfaces`" 120 fi 121 122 _fail= |
123 _ok= |
|
126 for ifn in ${_cooked_list}; do | 124 for ifn in ${_cooked_list}; do |
127 if ! ${_func} ${ifn} $2; then | 125 if ${_func} ${ifn} $2; then 126 _ok="${_ok} ${ifn}" 127 else |
128 _fail="${_fail} ${ifn}" 129 fi 130 done 131 | 128 _fail="${_fail} ${ifn}" 129 fi 130 done 131 |
132 _str= 133 if [ -n "${_ok}" ]; then 134 case ${_func} in 135 ifn_start) 136 _str='Starting' 137 ;; 138 ifn_stop) 139 _str='Stopping' 140 ;; 141 esac 142 echo "${_str} Network:${_ok}." 143 if [ -z "${rc_quiet}" ]; then 144 /sbin/ifconfig ${_ok} 145 fi 146 fi 147 |
|
132 debug "The following interfaces were not configured: $_fail" 133} 134 135load_rc_config $name 136run_rc_command $* | 148 debug "The following interfaces were not configured: $_fail" 149} 150 151load_rc_config $name 152run_rc_command $* |