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 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. 13# 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. 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 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. 13# 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. 24#
|
26# 27 28# PROVIDE: netif 29# REQUIRE: atm1 cleanvar FILESYSTEMS serial sppp sysctl 30# REQUIRE: ipfilter ipfs 31# KEYWORD: nojail 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" 41extra_commands="cloneup clonedown" 42cmdifn= 43 44set_rcvar_obsolete ipv6_enable ipv6_prefer 45 46network_start() 47{ 48 # Set the list of interfaces to work on. 49 # 50 cmdifn=$* 51 52 if [ -z "$cmdifn" ]; then 53 # 54 # We're operating as a general network start routine. 55 # 56 57 # disable SIGINT (Ctrl-c) when running at startup 58 trap : 2 59 60 # Create cloned interfaces 61 clone_up 62 63 # Create Fast EtherChannel interfaces 64 fec_up 65 66 # Create IPv6<-->IPv4 tunnels 67 gif_up 68 69 # Rename interfaces. 70 ifnet_rename 71 fi 72 73 # Configure the interface(s). 74 network_common ifn_start 75 76 if [ -f /etc/rc.d/ipfilter ] ; then 77 # Resync ipfilter 78 /etc/rc.d/ipfilter quietresync 79 fi 80 if [ -f /etc/rc.d/bridge -a -n "$cmdifn" ] ; then 81 /etc/rc.d/bridge start $cmdifn 82 fi 83} 84 85network_stop() 86{ 87 # Set the list of interfaces to work on. 88 # 89 cmdifn=$* 90 91 # Deconfigure the interface(s) 92 network_common ifn_stop 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{ 101 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 110 111 # Set the scope of the command (all interfaces or just one). 112 # 113 _cooked_list= 114 if [ -n "$cmdifn" ]; then 115 # Don't check that the interface(s) exist. We need to run 116 # the down code even when the interface doesn't exist to 117 # kill off wpa_supplicant. 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= 126 _ok= 127 for ifn in ${_cooked_list}; do 128 if ${_func} ${ifn} $2; then 129 _ok="${_ok} ${ifn}" 130 else 131 _fail="${_fail} ${ifn}" 132 fi 133 done 134 135 _str= 136 if [ -n "${_ok}" ]; then 137 case ${_func} in 138 ifn_start) 139 _str='Starting' 140 ;; 141 ifn_stop) 142 _str='Stopping' 143 ;; 144 esac 145 echo "${_str} Network:${_ok}."
| 26# 27 28# PROVIDE: netif 29# REQUIRE: atm1 cleanvar FILESYSTEMS serial sppp sysctl 30# REQUIRE: ipfilter ipfs 31# KEYWORD: nojail 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" 41extra_commands="cloneup clonedown" 42cmdifn= 43 44set_rcvar_obsolete ipv6_enable ipv6_prefer 45 46network_start() 47{ 48 # Set the list of interfaces to work on. 49 # 50 cmdifn=$* 51 52 if [ -z "$cmdifn" ]; then 53 # 54 # We're operating as a general network start routine. 55 # 56 57 # disable SIGINT (Ctrl-c) when running at startup 58 trap : 2 59 60 # Create cloned interfaces 61 clone_up 62 63 # Create Fast EtherChannel interfaces 64 fec_up 65 66 # Create IPv6<-->IPv4 tunnels 67 gif_up 68 69 # Rename interfaces. 70 ifnet_rename 71 fi 72 73 # Configure the interface(s). 74 network_common ifn_start 75 76 if [ -f /etc/rc.d/ipfilter ] ; then 77 # Resync ipfilter 78 /etc/rc.d/ipfilter quietresync 79 fi 80 if [ -f /etc/rc.d/bridge -a -n "$cmdifn" ] ; then 81 /etc/rc.d/bridge start $cmdifn 82 fi 83} 84 85network_stop() 86{ 87 # Set the list of interfaces to work on. 88 # 89 cmdifn=$* 90 91 # Deconfigure the interface(s) 92 network_common ifn_stop 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{ 101 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 110 111 # Set the scope of the command (all interfaces or just one). 112 # 113 _cooked_list= 114 if [ -n "$cmdifn" ]; then 115 # Don't check that the interface(s) exist. We need to run 116 # the down code even when the interface doesn't exist to 117 # kill off wpa_supplicant. 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= 126 _ok= 127 for ifn in ${_cooked_list}; do 128 if ${_func} ${ifn} $2; then 129 _ok="${_ok} ${ifn}" 130 else 131 _fail="${_fail} ${ifn}" 132 fi 133 done 134 135 _str= 136 if [ -n "${_ok}" ]; then 137 case ${_func} in 138 ifn_start) 139 _str='Starting' 140 ;; 141 ifn_stop) 142 _str='Stopping' 143 ;; 144 esac 145 echo "${_str} Network:${_ok}."
|