Deleted Added
full compact
netif (256039) netif (256255)
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 256039 2013-10-04 02:44:04Z hrs $
25# $FreeBSD: head/etc/rc.d/netif 256255 2013-10-10 07:41:11Z hrs $
26#
27
28# PROVIDE: netif
29# REQUIRE: atm1 FILESYSTEMS serial sppp sysctl
30# REQUIRE: ipfilter ipfs
31# KEYWORD: nojailvnet
32
33. /etc/rc.subr
34. /etc/network.subr
35
36name="network"
37start_cmd="network_start"
38stop_cmd="network_stop"
39cloneup_cmd="clone_up"
40clonedown_cmd="clone_down"
41clear_cmd="doclear"
26#
27
28# PROVIDE: netif
29# REQUIRE: atm1 FILESYSTEMS serial sppp sysctl
30# REQUIRE: ipfilter ipfs
31# KEYWORD: nojailvnet
32
33. /etc/rc.subr
34. /etc/network.subr
35
36name="network"
37start_cmd="network_start"
38stop_cmd="network_stop"
39cloneup_cmd="clone_up"
40clonedown_cmd="clone_down"
41clear_cmd="doclear"
42extra_commands="cloneup clonedown clear"
42vnetup_cmd="vnet_up"
43vnetdown_cmd="vnet_down"
44extra_commands="cloneup clonedown clear vnetup vnetdown"
43cmdifn=
44
45set_rcvar_obsolete ipv6_enable ipv6_activate_all_interfaces
46set_rcvar_obsolete ipv6_prefer
47
48network_start()
49{
50 local _if

--- 67 unchanged lines hidden (view full) ---

118
119 if [ -f /etc/rc.d/routing -a -n "$cmdifn" ] ; then
120 for _if in $cmdifn; do
121 /etc/rc.d/routing stop any $_if
122 done
123 fi
124}
125
45cmdifn=
46
47set_rcvar_obsolete ipv6_enable ipv6_activate_all_interfaces
48set_rcvar_obsolete ipv6_prefer
49
50network_start()
51{
52 local _if

--- 67 unchanged lines hidden (view full) ---

120
121 if [ -f /etc/rc.d/routing -a -n "$cmdifn" ] ; then
122 for _if in $cmdifn; do
123 /etc/rc.d/routing stop any $_if
124 done
125 fi
126}
127
128vnet_up()
129{
130 cmdifn=$*
131
132 network_common ifn_vnetup $cmdifn
133}
134
135vnet_down()
136{
137 cmdifn=$*
138
139 network_common ifn_vnetdown $cmdifn
140}
141
126# network_common routine
127# Common configuration subroutine for network interfaces. This
128# routine takes all the preparatory steps needed for configuriing
129# an interface and then calls $routine.
130network_common()
131{
132 local _cooked_list _tmp_list _fail _func _ok _str _cmdifn
133

--- 59 unchanged lines hidden (view full) ---

193 fi
194 else
195 _fail="${_fail} ${ifn}"
196 fi
197 done
198
199 # inet6 address configuration needs sleep for DAD.
200 case ${_func}:${_dadwait} in
142# network_common routine
143# Common configuration subroutine for network interfaces. This
144# routine takes all the preparatory steps needed for configuriing
145# an interface and then calls $routine.
146network_common()
147{
148 local _cooked_list _tmp_list _fail _func _ok _str _cmdifn
149

--- 59 unchanged lines hidden (view full) ---

209 fi
210 else
211 _fail="${_fail} ${ifn}"
212 fi
213 done
214
215 # inet6 address configuration needs sleep for DAD.
216 case ${_func}:${_dadwait} in
201 ifn_start:1)
217 ifn_start:1|ifn_vnetup:1|ifn_vnetdown:1)
202 sleep `${SYSCTL_N} net.inet6.ip6.dad_count`
203 sleep 1
204 ;;
205 esac
206
207 _str=
208 if [ -n "${_ok}" ]; then
209 case ${_func} in
210 ifn_start)
211 _str='Starting'
218 sleep `${SYSCTL_N} net.inet6.ip6.dad_count`
219 sleep 1
220 ;;
221 esac
222
223 _str=
224 if [ -n "${_ok}" ]; then
225 case ${_func} in
226 ifn_start)
227 _str='Starting'
212 ;;
228 ;;
213 ifn_stop)
214 _str='Stopping'
229 ifn_stop)
230 _str='Stopping'
215 ;;
231 ;;
232 ifn_vnetup)
233 _str='Moving'
234 ;;
235 ifn_vnetdown)
236 _str='Reclaiming'
237 ;;
216 esac
217 echo "${_str} Network:${_ok}."
238 esac
239 echo "${_str} Network:${_ok}."
240 case ${_func} in
241 ifn_vnetup)
242 # Clear _ok not to do "ifconfig $ifn"
243 # because $ifn is no longer in the current vnet.
244 _ok=
245 ;;
246 esac
218 if check_startmsgs; then
219 for ifn in ${_ok}; do
220 /sbin/ifconfig ${ifn}
221 done
222 fi
223 fi
224
225 debug "The following interfaces were not configured: $_fail"
226}
227
228load_rc_config $name
229run_rc_command $*
247 if check_startmsgs; then
248 for ifn in ${_ok}; do
249 /sbin/ifconfig ${ifn}
250 done
251 fi
252 fi
253
254 debug "The following interfaces were not configured: $_fail"
255}
256
257load_rc_config $name
258run_rc_command $*