netif revision 113674
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#
25# $FreeBSD: head/etc/rc.d/netif 113674 2003-04-18 17:51:54Z mtm $
26#
27
28# PROVIDE: netif
29# REQUIRE: atm1 ipfilter mountcritlocal pccard serial sppp sysctl tty
30# KEYWORD: FreeBSD
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
42network_start()
43{
44	# Create cloned interfaces
45	clone_up
46
47	# Create IPv6<-->IPv4 tunnels
48	gif_up
49
50	# Get a list of network interfaces. Do not include dhcp interfaces.
51	_ifn_list="`list_net_interfaces nodhcp`"
52
53	# Setup the supplied network interfaces including startup
54	# scripts, if they exist.
55	#
56	for ifn in ${_ifn_list}; do
57		ifscript_up ${ifn} && eval showstat_$ifn=1
58
59		ifconfig_up ${ifn} && eval showstat_$ifn=1
60
61		ifalias_up ${ifn} && eval showstat_$ifn=1
62
63		ipx_up ${ifn} && eval showstat_$ifn=1
64	done
65
66	# Display interfaces configured by this script
67	#
68	for ifn in ${_ifn_list}; do
69		eval showstat=\$showstat_${ifn}
70		if [ ! -z ${showstat} ]; then
71			ifconfig ${ifn}
72		fi
73	done
74
75	# Resync ipfilter
76	/etc/rc.d/ipfilter resync
77}
78
79network_stop()
80{
81	echo -n "Stopping network:"
82
83	# flush routes
84	route -n flush
85	echo '.'
86}
87
88load_rc_config $name
89run_rc_command "$1"
90