Deleted Added
full compact
netif (251584) netif (253924)
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 251584 2013-06-09 18:11:36Z hrs $
25# $FreeBSD: head/etc/rc.d/netif 253924 2013-08-04 06:36:17Z 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"
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"
41extra_commands="cloneup clonedown"
41clear_cmd="doclear"
42extra_commands="cloneup clonedown clear"
42cmdifn=
43
44set_rcvar_obsolete ipv6_enable ipv6_activate_all_interfaces
45set_rcvar_obsolete ipv6_prefer
46
47network_start()
48{
49 local _if

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

55 if [ -z "$cmdifn" ]; then
56 #
57 # We're operating as a general network start routine.
58 #
59
60 # disable SIGINT (Ctrl-c) when running at startup
61 trap : 2
62
43cmdifn=
44
45set_rcvar_obsolete ipv6_enable ipv6_activate_all_interfaces
46set_rcvar_obsolete ipv6_prefer
47
48network_start()
49{
50 local _if

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

56 if [ -z "$cmdifn" ]; then
57 #
58 # We're operating as a general network start routine.
59 #
60
61 # disable SIGINT (Ctrl-c) when running at startup
62 trap : 2
63
63 # Create cloned interfaces
64 clone_up
65
66 # Create Fast EtherChannel interfaces
67 fec_up
64 # Create Fast EtherChannel interfaces
65 fec_up
66 fi
68
67
69 # Create IPv6<-->IPv4 tunnels
70 gif_up
68 # Create cloned interfaces
69 clone_up $cmdifn
71
70
72 # Rename interfaces.
73 ifnet_rename
74 fi
71 # Rename interfaces.
72 ifnet_rename $cmdifn
75
76 # Configure the interface(s).
77 network_common ifn_start
78
79 if [ -f /etc/rc.d/ipfilter ] ; then
80 # Resync ipfilter
81 /etc/rc.d/ipfilter quietresync
82 fi

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

87 for _if in $cmdifn; do
88 /etc/rc.d/routing start any $_if
89 done
90 fi
91}
92
93network_stop()
94{
73
74 # Configure the interface(s).
75 network_common ifn_start
76
77 if [ -f /etc/rc.d/ipfilter ] ; then
78 # Resync ipfilter
79 /etc/rc.d/ipfilter quietresync
80 fi

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

85 for _if in $cmdifn; do
86 /etc/rc.d/routing start any $_if
87 done
88 fi
89}
90
91network_stop()
92{
93 _clone_down=1
94 network_stop0 $*
95}
96
97doclear()
98{
99 _clone_down=
100 network_stop0 $*
101}
102
103network_stop0()
104{
95 local _if
96
97 # Set the list of interfaces to work on.
98 #
99 cmdifn=$*
100
101 # Deconfigure the interface(s)
102 network_common ifn_stop
103
105 local _if
106
107 # Set the list of interfaces to work on.
108 #
109 cmdifn=$*
110
111 # Deconfigure the interface(s)
112 network_common ifn_stop
113
114 # Destroy cloned interfaces
115 if [ -n "$_clone_down" ]; then
116 clone_down $cmdifn
117 fi
118
104 if [ -f /etc/rc.d/routing -a -n "$cmdifn" ] ; then
105 for _if in $cmdifn; do
106 /etc/rc.d/routing stop any $_if
107 done
108 fi
109}
110
111# network_common routine

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

137 else
138 _cooked_list="`list_net_interfaces`"
139 fi
140
141 _dadwait=
142 _fail=
143 _ok=
144 for ifn in ${_cooked_list}; do
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
126# network_common routine

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

152 else
153 _cooked_list="`list_net_interfaces`"
154 fi
155
156 _dadwait=
157 _fail=
158 _ok=
159 for ifn in ${_cooked_list}; do
160 # Skip if ifn does not exist.
161 case $_func in
162 ifn_stop)
163 if ! ${IFCONFIG_CMD} $ifn > /dev/null 2>&1; then
164 warn "$ifn does not exist. Skipped."
165 _fail="${_fail} ${ifn}"
166 continue
167 fi
168 ;;
169 esac
145 if ${_func} ${ifn} $2; then
146 _ok="${_ok} ${ifn}"
147 if ipv6if ${ifn}; then
148 _dadwait=1
149 fi
150 else
151 _fail="${_fail} ${ifn}"
152 fi

--- 33 unchanged lines hidden ---
170 if ${_func} ${ifn} $2; then
171 _ok="${_ok} ${ifn}"
172 if ipv6if ${ifn}; then
173 _dadwait=1
174 fi
175 else
176 _fail="${_fail} ${ifn}"
177 fi

--- 33 unchanged lines hidden ---