3 # Copyright (c) 2003 The FreeBSD Project. All rights reserved.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
8 # 1. Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # 2. Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
14 # THIS SOFTWARE IS PROVIDED BY THE PROJECT ``AS IS'' AND ANY EXPRESS OR
15 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
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.
29 # REQUIRE: atm1 cleanvar FILESYSTEMS serial sppp sysctl
30 # REQUIRE: ipfilter ipfs
37 start_cmd="network_start"
38 stop_cmd="network_stop"
39 cloneup_cmd="clone_up"
40 clonedown_cmd="clone_down"
41 extra_commands="cloneup clonedown"
44 set_rcvar_obsolete ipv6_enable ipv6_activate_all_interfaces
45 set_rcvar_obsolete ipv6_prefer
49 # Set the list of interfaces to work on.
53 if [ -z "$cmdifn" ]; then
55 # We're operating as a general network start routine.
58 # disable SIGINT (Ctrl-c) when running at startup
61 # Create cloned interfaces
64 # Create Fast EtherChannel interfaces
67 # Create IPv6<-->IPv4 tunnels
74 # Configure the interface(s).
75 network_common ifn_start
77 if [ -f /etc/rc.d/ipfilter ] ; then
79 /etc/rc.d/ipfilter quietresync
81 if [ -f /etc/rc.d/bridge -a -n "$cmdifn" ] ; then
82 /etc/rc.d/bridge start $cmdifn
88 # Set the list of interfaces to work on.
92 # Deconfigure the interface(s)
93 network_common ifn_stop
96 # network_common routine
97 # Common configuration subroutine for network interfaces. This
98 # routine takes all the preparatory steps needed for configuriing
99 # an interface and then calls $routine.
102 local _cooked_list _fail _func _ok _str
107 err 1 "network_common(): No function name specified."
112 # Set the scope of the command (all interfaces or just one).
115 if [ -n "$cmdifn" ]; then
116 # Don't check that the interface(s) exist. We need to run
117 # the down code even when the interface doesn't exist to
118 # kill off wpa_supplicant.
119 # XXXBED: is this really true or does wpa_supplicant die?
120 # if so, we should get rid of the devd entry
121 _cooked_list="$cmdifn"
123 _cooked_list="`list_net_interfaces`"
128 for ifn in ${_cooked_list}; do
129 if ${_func} ${ifn} $2; then
132 _fail="${_fail} ${ifn}"
137 if [ -n "${_ok}" ]; then
146 echo "${_str} Network:${_ok}."
147 if check_startmsgs; then
148 for ifn in ${_ok}; do
149 /sbin/ifconfig ${ifn}
154 debug "The following interfaces were not configured: $_fail"