Deleted Added
full compact
netif (129497) netif (132892)
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 129497 2004-05-20 15:53:49Z mtm $
25# $FreeBSD: head/etc/rc.d/netif 132892 2004-07-30 17:19:35Z mtm $
26#
27
28# PROVIDE: netif
29# REQUIRE: atm1 ipfilter mountcritlocal pccard serial sppp sysctl
30# KEYWORD: FreeBSD nojail
31
32. /etc/rc.subr
33. /etc/network.subr
34
35name="network"
36start_cmd="network_start"
37stop_cmd="network_stop"
38cloneup_cmd="clone_up"
39clonedown_cmd="clone_down"
40extra_commands="cloneup clonedown"
41_cmdifn=
42
43network_start()
44{
26#
27
28# PROVIDE: netif
29# REQUIRE: atm1 ipfilter mountcritlocal pccard serial sppp sysctl
30# KEYWORD: FreeBSD nojail
31
32. /etc/rc.subr
33. /etc/network.subr
34
35name="network"
36start_cmd="network_start"
37stop_cmd="network_stop"
38cloneup_cmd="clone_up"
39clonedown_cmd="clone_down"
40extra_commands="cloneup clonedown"
41_cmdifn=
42
43network_start()
44{
45 # Set the list of interfaces to work on.
46 #
47 _cmdifn=$*
48
45 if [ -z "$_cmdifn" ]; then
46 #
47 # We're operating as a general network start routine.
48 #
49
50 # Create cloned interfaces
51 clone_up
52

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

60 if [ -f /etc/rc.d/ipfilter ] ; then
61 # Resync ipfilter
62 /etc/rc.d/ipfilter resync
63 fi
64}
65
66network_stop()
67{
49 if [ -z "$_cmdifn" ]; then
50 #
51 # We're operating as a general network start routine.
52 #
53
54 # Create cloned interfaces
55 clone_up
56

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

64 if [ -f /etc/rc.d/ipfilter ] ; then
65 # Resync ipfilter
66 /etc/rc.d/ipfilter resync
67 fi
68}
69
70network_stop()
71{
72 # Set the list of interfaces to work on.
73 #
74 _cmdifn=$*
75
68 echo -n "Stopping network:"
69
70 # Deconfigure the interface(s)
71 network_common ifn_stop
72 echo '.'
73}
74
75# network_common routine verbose

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

91 fi
92 [ -n "$2" ] && _verbose=yes
93
94 # Get a list of network interfaces. Do not include dhcp interfaces.
95 _ifn_list="`list_net_interfaces nodhcp`"
96
97 # Set the scope of the command (all interfaces or just one).
98 #
76 echo -n "Stopping network:"
77
78 # Deconfigure the interface(s)
79 network_common ifn_stop
80 echo '.'
81}
82
83# network_common routine verbose

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

99 fi
100 [ -n "$2" ] && _verbose=yes
101
102 # Get a list of network interfaces. Do not include dhcp interfaces.
103 _ifn_list="`list_net_interfaces nodhcp`"
104
105 # Set the scope of the command (all interfaces or just one).
106 #
99 _cooked_list="$_ifn_list"
107 _cooked_list=
100 if [ -n "$_cmdifn" ]; then
108 if [ -n "$_cmdifn" ]; then
101 eval _cooked_list=\"`expr "$_ifn_list" : ".*\($_cmdifn\).*"`\"
102 if [ -z "$_cooked_list" ]; then
103 err 1 "No such network interface: $_cmdifn"
104 fi
109 for i in $_cmdifn ; do
110 eval _if=\"`expr "$_ifn_list" : ".*\(${i}\).*"`\"
111 if [ -z "$_if" ]; then
112 err 1 "No such network interface: $i"
113 fi
114 _cooked_list="$_cooked_list $_if"
115 done
116 else
117 _cooked_list="$_ifn_list"
105 fi
106
107 for ifn in ${_cooked_list}; do
108 if ${_func} ${ifn} ; then
109 eval showstat_$ifn=1
110 else
111 _fail="$_fail $ifn"
112 fi

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

154 ipx_down ${ifn} && cfg=0
155 ifalias_down ${ifn} && cfg=0
156 ifconfig_down ${ifn} && cfg=0
157 ifscript_down ${ifn} && cfg=0
158
159 return $cfg
160}
161
118 fi
119
120 for ifn in ${_cooked_list}; do
121 if ${_func} ${ifn} ; then
122 eval showstat_$ifn=1
123 else
124 _fail="$_fail $ifn"
125 fi

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

167 ipx_down ${ifn} && cfg=0
168 ifalias_down ${ifn} && cfg=0
169 ifconfig_down ${ifn} && cfg=0
170 ifscript_down ${ifn} && cfg=0
171
172 return $cfg
173}
174
162if [ -n "$2" ]; then
163 _cmdifn="$2"
164fi
165
166load_rc_config $name
175load_rc_config $name
167run_rc_command "$1"
176run_rc_command $*