head	1.44;
access;
symbols
	RELENG_8_4:1.42.0.2
	RELENG_9_1_0_RELEASE:1.38.2.1.4.2
	RELENG_9_1:1.38.2.1.0.4
	RELENG_9_1_BP:1.38.2.1
	RELENG_8_3_0_RELEASE:1.32.2.3.2.1
	RELENG_8_3:1.32.2.3.0.2
	RELENG_8_3_BP:1.32.2.3
	RELENG_9_0_0_RELEASE:1.38.2.1.2.1
	RELENG_9_0:1.38.2.1.0.2
	RELENG_9_0_BP:1.38.2.1
	RELENG_9:1.38.0.2
	RELENG_9_BP:1.38
	RELENG_7_4_0_RELEASE:1.24.2.3.2.1
	RELENG_8_2_0_RELEASE:1.32.2.2.6.1
	RELENG_7_4:1.24.2.3.0.2
	RELENG_7_4_BP:1.24.2.3
	RELENG_8_2:1.32.2.2.0.6
	RELENG_8_2_BP:1.32.2.2
	RELENG_8_1_0_RELEASE:1.32.2.2.4.1
	RELENG_8_1:1.32.2.2.0.4
	RELENG_8_1_BP:1.32.2.2
	RELENG_7_3_0_RELEASE:1.24.2.1.2.1
	RELENG_7_3:1.24.2.1.0.2
	RELENG_7_3_BP:1.24.2.1
	RELENG_8_0_0_RELEASE:1.32.2.2.2.1
	RELENG_8_0:1.32.2.2.0.2
	RELENG_8_0_BP:1.32.2.2
	RELENG_8:1.32.0.2
	RELENG_8_BP:1.32
	RELENG_7_2_0_RELEASE:1.24.8.1
	RELENG_7_2:1.24.0.8
	RELENG_7_2_BP:1.24
	RELENG_7_1_0_RELEASE:1.24.6.1
	RELENG_6_4_0_RELEASE:1.14.2.5.4.1
	RELENG_7_1:1.24.0.6
	RELENG_7_1_BP:1.24
	RELENG_6_4:1.14.2.5.0.4
	RELENG_6_4_BP:1.14.2.5
	RELENG_7_0_0_RELEASE:1.24
	RELENG_6_3_0_RELEASE:1.14.2.5
	RELENG_7_0:1.24.0.4
	RELENG_7_0_BP:1.24
	RELENG_6_3:1.14.2.5.0.2
	RELENG_6_3_BP:1.14.2.5
	RELENG_7:1.24.0.2
	RELENG_7_BP:1.24
	RELENG_6_2_0_RELEASE:1.14.2.3
	RELENG_6_2:1.14.2.3.0.2
	RELENG_6_2_BP:1.14.2.3
	RELENG_5_5_0_RELEASE:1.10.2.2
	RELENG_5_5:1.10.2.2.0.4
	RELENG_5_5_BP:1.10.2.2
	RELENG_6_1_0_RELEASE:1.14.2.2
	RELENG_6_1:1.14.2.2.0.2
	RELENG_6_1_BP:1.14.2.2
	RELENG_6_0_0_RELEASE:1.14.2.1
	RELENG_6_0:1.14.2.1.0.2
	RELENG_6_0_BP:1.14.2.1
	RELENG_6:1.14.0.2
	RELENG_6_BP:1.14
	RELENG_5_4_0_RELEASE:1.10.2.2
	RELENG_5_4:1.10.2.2.0.2
	RELENG_5_4_BP:1.10.2.2
	RELENG_5_3_0_RELEASE:1.10.2.1
	RELENG_5_3:1.10.2.1.0.2
	RELENG_5_3_BP:1.10.2.1
	RELENG_5:1.10.0.2
	RELENG_5_BP:1.10
	RELENG_5_2_1_RELEASE:1.3
	RELENG_5_2_0_RELEASE:1.3
	RELENG_5_2:1.3.0.2
	RELENG_5_2_BP:1.3
	RELENG_5_1_0_RELEASE:1.1
	RELENG_5_1:1.1.0.2
	RELENG_5_1_BP:1.1;
locks; strict;
comment	@# @;


1.44
date	2013.06.10.00.33.47;	author svnexp;	state Exp;
branches;
next	1.43;

1.43
date	2013.05.20.00.28.17;	author svnexp;	state Exp;
branches;
next	1.42;

1.42
date	2012.11.17.01.49.05;	author svnexp;	state Exp;
branches
	1.42.2.1;
next	1.41;

1.41
date	2012.09.11.05.04.59;	author obrien;	state Exp;
branches;
next	1.40;

1.40
date	2012.01.29.08.33.34;	author hrs;	state Exp;
branches;
next	1.39;

1.39
date	2012.01.22.10.57.32;	author hrs;	state Exp;
branches;
next	1.38;

1.38
date	2010.09.13.19.55.40;	author hrs;	state Exp;
branches
	1.38.2.1;
next	1.37;

1.37
date	2010.09.13.19.51.15;	author hrs;	state Exp;
branches;
next	1.36;

1.36
date	2010.04.09.01.35.09;	author dougb;	state Exp;
branches;
next	1.35;

1.35
date	2009.10.10.22.17.03;	author dougb;	state Exp;
branches;
next	1.34;

1.34
date	2009.09.26.18.59.00;	author hrs;	state Exp;
branches;
next	1.33;

1.33
date	2009.09.12.22.13.41;	author hrs;	state Exp;
branches;
next	1.32;

1.32
date	2009.06.26.01.04.50;	author dougb;	state Exp;
branches
	1.32.2.1;
next	1.31;

1.31
date	2009.06.01.05.35.03;	author dougb;	state Exp;
branches;
next	1.30;

1.30
date	2008.10.30.20.24.25;	author pjd;	state Exp;
branches;
next	1.29;

1.29
date	2008.06.23.20.50.11;	author mtm;	state Exp;
branches;
next	1.28;

1.28
date	2008.05.18.02.57.54;	author brooks;	state Exp;
branches;
next	1.27;

1.27
date	2008.05.15.01.06.10;	author brooks;	state Exp;
branches;
next	1.26;

1.26
date	2008.04.20.20.37.20;	author sam;	state Exp;
branches;
next	1.25;

1.25
date	2008.01.26.11.22.12;	author mtm;	state Exp;
branches;
next	1.24;

1.24
date	2007.07.25.18.08.01;	author jhb;	state Exp;
branches
	1.24.2.1
	1.24.6.1
	1.24.8.1;
next	1.23;

1.23
date	2007.04.02.22.53.07;	author des;	state Exp;
branches;
next	1.22;

1.22
date	2007.02.09.12.11.26;	author flz;	state Exp;
branches;
next	1.21;

1.21
date	2006.12.30.22.53.20;	author yar;	state Exp;
branches;
next	1.20;

1.20
date	2006.06.01.11.01.54;	author thompsa;	state Exp;
branches;
next	1.19;

1.19
date	2006.02.13.20.08.31;	author imp;	state Exp;
branches;
next	1.18;

1.18
date	2005.11.14.23.34.50;	author brooks;	state Exp;
branches;
next	1.17;

1.17
date	2005.09.04.21.57.23;	author keramida;	state Exp;
branches;
next	1.16;

1.16
date	2005.09.02.18.30.16;	author brooks;	state Exp;
branches;
next	1.15;

1.15
date	2005.09.02.17.05.07;	author brooks;	state Exp;
branches;
next	1.14;

1.14
date	2005.06.30.04.46.21;	author brooks;	state Exp;
branches
	1.14.2.1;
next	1.13;

1.13
date	2005.06.07.04.49.12;	author brooks;	state Exp;
branches;
next	1.12;

1.12
date	2004.10.30.13.44.05;	author pjd;	state Exp;
branches;
next	1.11;

1.11
date	2004.10.07.13.55.26;	author mtm;	state Exp;
branches;
next	1.10;

1.10
date	2004.07.30.17.19.35;	author mtm;	state Exp;
branches
	1.10.2.1;
next	1.9;

1.9
date	2004.05.20.15.53.49;	author mtm;	state Exp;
branches;
next	1.8;

1.8
date	2004.05.20.14.16.05;	author mtm;	state Exp;
branches;
next	1.7;

1.7
date	2004.04.28.13.20.15;	author phk;	state Exp;
branches;
next	1.6;

1.6
date	2004.03.08.12.25.05;	author pjd;	state Exp;
branches;
next	1.5;

1.5
date	2004.02.29.01.42.48;	author green;	state Exp;
branches;
next	1.4;

1.4
date	2004.02.27.22.08.19;	author green;	state Exp;
branches;
next	1.3;

1.3
date	2003.07.30.18.53.59;	author mtm;	state Exp;
branches;
next	1.2;

1.2
date	2003.06.29.05.34.41;	author mtm;	state Exp;
branches;
next	1.1;

1.1
date	2003.04.18.17.51.54;	author mtm;	state Exp;
branches;
next	;

1.42.2.1
date	2012.11.17.01.49.05;	author svnexp;	state dead;
branches;
next	1.42.2.2;

1.42.2.2
date	2013.03.28.13.02.43;	author svnexp;	state Exp;
branches;
next	;

1.38.2.1
date	2011.09.23.00.51.37;	author kensmith;	state Exp;
branches
	1.38.2.1.2.1
	1.38.2.1.4.1;
next	1.38.2.2;

1.38.2.2
date	2012.10.26.18.06.49;	author obrien;	state Exp;
branches;
next	1.38.2.3;

1.38.2.3
date	2012.11.17.11.36.11;	author svnexp;	state Exp;
branches;
next	1.38.2.4;

1.38.2.4
date	2013.05.22.19.01.43;	author svnexp;	state Exp;
branches;
next	1.38.2.5;

1.38.2.5
date	2013.07.12.01.02.27;	author svnexp;	state Exp;
branches;
next	1.38.2.6;

1.38.2.6
date	2013.07.12.02.08.23;	author svnexp;	state Exp;
branches;
next	;

1.38.2.1.2.1
date	2011.11.11.04.20.22;	author kensmith;	state Exp;
branches;
next	1.38.2.1.2.2;

1.38.2.1.2.2
date	2012.11.17.08.36.11;	author svnexp;	state Exp;
branches;
next	;

1.38.2.1.4.1
date	2012.08.05.23.54.33;	author kensmith;	state Exp;
branches;
next	1.38.2.1.4.2;

1.38.2.1.4.2
date	2012.11.17.08.47.01;	author svnexp;	state Exp;
branches;
next	;

1.32.2.1
date	2009.08.03.08.13.06;	author kensmith;	state Exp;
branches;
next	1.32.2.2;

1.32.2.2
date	2009.10.16.00.17.09;	author dougb;	state Exp;
branches
	1.32.2.2.2.1
	1.32.2.2.4.1
	1.32.2.2.6.1;
next	1.32.2.3;

1.32.2.3
date	2012.02.10.10.18.30;	author dougb;	state Exp;
branches
	1.32.2.3.2.1;
next	1.32.2.4;

1.32.2.4
date	2012.11.17.10.35.57;	author svnexp;	state Exp;
branches;
next	;

1.32.2.2.2.1
date	2009.10.25.01.10.29;	author kensmith;	state Exp;
branches;
next	;

1.32.2.2.4.1
date	2010.06.14.02.09.06;	author kensmith;	state Exp;
branches;
next	;

1.32.2.2.6.1
date	2010.12.21.17.09.25;	author kensmith;	state Exp;
branches;
next	;

1.32.2.3.2.1
date	2012.03.03.06.15.13;	author kensmith;	state Exp;
branches;
next	1.32.2.3.2.2;

1.32.2.3.2.2
date	2012.11.17.08.24.38;	author svnexp;	state Exp;
branches;
next	;

1.24.2.1
date	2010.01.12.20.06.04;	author jhb;	state Exp;
branches
	1.24.2.1.2.1;
next	1.24.2.2;

1.24.2.2
date	2010.05.09.08.22.33;	author dougb;	state Exp;
branches;
next	1.24.2.3;

1.24.2.3
date	2010.07.08.13.34.01;	author jhb;	state Exp;
branches
	1.24.2.3.2.1;
next	1.24.2.4;

1.24.2.4
date	2012.11.17.08.01.21;	author svnexp;	state Exp;
branches;
next	;

1.24.2.1.2.1
date	2010.02.10.00.26.20;	author kensmith;	state Exp;
branches;
next	;

1.24.2.3.2.1
date	2010.12.21.17.10.29;	author kensmith;	state Exp;
branches;
next	1.24.2.3.2.2;

1.24.2.3.2.2
date	2012.11.17.08.16.37;	author svnexp;	state Exp;
branches;
next	;

1.24.6.1
date	2008.11.25.02.59.29;	author kensmith;	state Exp;
branches;
next	;

1.24.8.1
date	2009.04.15.03.14.26;	author kensmith;	state Exp;
branches;
next	;

1.14.2.1
date	2005.09.10.17.05.04;	author brooks;	state Exp;
branches;
next	1.14.2.2;

1.14.2.2
date	2005.12.10.02.20.14;	author brooks;	state Exp;
branches;
next	1.14.2.3;

1.14.2.3
date	2006.07.24.20.46.14;	author thompsa;	state Exp;
branches;
next	1.14.2.4;

1.14.2.4
date	2007.08.14.19.38.02;	author jhb;	state Exp;
branches;
next	1.14.2.5;

1.14.2.5
date	2007.10.25.14.36.11;	author mtm;	state Exp;
branches
	1.14.2.5.4.1;
next	1.14.2.6;

1.14.2.6
date	2012.11.17.07.39.08;	author svnexp;	state Exp;
branches;
next	;

1.14.2.5.4.1
date	2008.10.02.02.57.24;	author kensmith;	state Exp;
branches;
next	;

1.10.2.1
date	2004.10.10.09.50.53;	author mtm;	state Exp;
branches;
next	1.10.2.2;

1.10.2.2
date	2004.12.06.19.09.03;	author rse;	state Exp;
branches;
next	;


desc
@@


1.44
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/251584
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@#!/bin/sh
#
# Copyright (c) 2003 The FreeBSD Project. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE PROJECT ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE PROJECT BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# $FreeBSD: head/etc/rc.d/netif 251584 2013-06-09 18:11:36Z hrs $
#

# PROVIDE: netif
# REQUIRE: atm1 FILESYSTEMS serial sppp sysctl
# REQUIRE: ipfilter ipfs
# KEYWORD: nojailvnet

. /etc/rc.subr
. /etc/network.subr

name="network"
start_cmd="network_start"
stop_cmd="network_stop"
cloneup_cmd="clone_up"
clonedown_cmd="clone_down"
extra_commands="cloneup clonedown"
cmdifn=

set_rcvar_obsolete ipv6_enable ipv6_activate_all_interfaces
set_rcvar_obsolete ipv6_prefer

network_start()
{
	local _if

	# Set the list of interfaces to work on.
	#
	cmdifn=$*

	if [ -z "$cmdifn" ]; then
		#
		# We're operating as a general network start routine.
		#

		# disable SIGINT (Ctrl-c) when running at startup
		trap : 2

		# Create cloned interfaces
		clone_up

		# Create Fast EtherChannel interfaces
		fec_up

		# Create IPv6<-->IPv4 tunnels
		gif_up

		# Rename interfaces.
		ifnet_rename
	fi

	# Configure the interface(s).
	network_common ifn_start

	if [ -f /etc/rc.d/ipfilter ] ; then
		# Resync ipfilter
		/etc/rc.d/ipfilter quietresync
	fi
	if [ -f /etc/rc.d/bridge -a -n "$cmdifn" ] ; then
		/etc/rc.d/bridge start $cmdifn
	fi
	if [ -f /etc/rc.d/routing -a -n "$cmdifn" ] ; then
		for _if in $cmdifn; do
			/etc/rc.d/routing start any $_if
		done
	fi
}

network_stop()
{
	local _if

	# Set the list of interfaces to work on.
	#
	cmdifn=$*

	# Deconfigure the interface(s)
	network_common ifn_stop

	if [ -f /etc/rc.d/routing -a -n "$cmdifn" ] ; then
		for _if in $cmdifn; do
			/etc/rc.d/routing stop any $_if
		done
	fi
}

# network_common routine
#	Common configuration subroutine for network interfaces. This
#	routine takes all the preparatory steps needed for configuriing
#	an interface and then calls $routine.
network_common()
{
	local _cooked_list _fail _func _ok _str

	_func=

	if [ -z "$1" ]; then
		err 1 "network_common(): No function name specified."
	else
		_func="$1"
	fi

	# Set the scope of the command (all interfaces or just one).
	#
	_cooked_list=
	if [ -n "$cmdifn" ]; then
		# Don't check that the interface(s) exist.  We need to run
		# the down code even when the interface doesn't exist to
		# kill off wpa_supplicant.
		# XXXBED: is this really true or does wpa_supplicant die?
		# if so, we should get rid of the devd entry
		_cooked_list="$cmdifn"
	else
		_cooked_list="`list_net_interfaces`"
	fi

	_dadwait=
	_fail=
	_ok=
	for ifn in ${_cooked_list}; do
		if ${_func} ${ifn} $2; then
			_ok="${_ok} ${ifn}"
			if ipv6if ${ifn}; then
				_dadwait=1
			fi
		else
			_fail="${_fail} ${ifn}"
		fi
	done

	# inet6 address configuration needs sleep for DAD.
	case ${_func}:${_dadwait} in
	ifn_start:1)
		sleep `${SYSCTL_N} net.inet6.ip6.dad_count`
		sleep 1
	;;
	esac

	_str=
	if [ -n "${_ok}" ]; then
		case ${_func} in
		ifn_start)
			_str='Starting'
			;;
		ifn_stop)
			_str='Stopping'
			;;
		esac
		echo "${_str} Network:${_ok}."
		if check_startmsgs; then
			for ifn in ${_ok}; do
				/sbin/ifconfig ${ifn}
			done
		fi
	fi

	debug "The following interfaces were not configured: $_fail"
}

load_rc_config $name
run_rc_command $*
@


1.43
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/250804
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d25 1
a25 1
# $FreeBSD: head/etc/rc.d/netif 250804 2013-05-19 04:10:34Z jamie $
d49 2
d86 5
d95 2
d103 6
@


1.42
log
@Switching exporter and resync
@
text
@d25 1
a25 1
# $FreeBSD: head/etc/rc.d/netif 240336 2012-09-11 05:04:59Z obrien $
d31 1
a31 1
# KEYWORD: nojail
@


1.42.2.1
log
@file netif was added on branch RELENG_8_4 on 2013-03-28 13:02:43 +0000
@
text
@d1 170
@


1.42.2.2
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/248810
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@a0 155
#!/bin/sh
#
# Copyright (c) 2003 The FreeBSD Project. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE PROJECT ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE PROJECT BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# $FreeBSD: releng/8.4/etc/rc.d/netif 231372 2012-02-10 10:18:30Z dougb $
#

# PROVIDE: netif
# REQUIRE: atm1 cleanvar FILESYSTEMS serial sppp sysctl
# REQUIRE: ipfilter ipfs auto_linklocal
# KEYWORD: nojail

. /etc/rc.subr
. /etc/network.subr

name="network"
start_cmd="network_start"
stop_cmd="network_stop"
cloneup_cmd="clone_up"
clonedown_cmd="clone_down"
extra_commands="cloneup clonedown"
cmdifn=

network_start()
{
	# Set the list of interfaces to work on.
	#
	cmdifn=$*

	if [ -z "$cmdifn" ]; then
		#
		# We're operating as a general network start routine.
		#

		# disable SIGINT (Ctrl-c) when running at startup
		trap : 2

		# Create cloned interfaces
		clone_up

		# Create Fast EtherChannel interfaces
		fec_up

		# Create IPv6<-->IPv4 tunnels
		gif_up

		# Rename interfaces.
		ifnet_rename
	fi

	# Configure the interface(s).
	network_common ifn_start

	if [ -f /etc/rc.d/ipfilter ] ; then
		# Resync ipfilter
		/etc/rc.d/ipfilter quietresync
	fi
	if [ -f /etc/rc.d/bridge -a -n "$cmdifn" ] ; then
		/etc/rc.d/bridge start $cmdifn
	fi
}

network_stop()
{
	# Set the list of interfaces to work on.
	#
	cmdifn=$*

	# Deconfigure the interface(s)
	network_common ifn_stop
}

# network_common routine
#	Common configuration subroutine for network interfaces. This
#	routine takes all the preparatory steps needed for configuriing
#	an interface and then calls $routine.
network_common()
{
	local _cooked_list _fail _func _ok _str

	_func=

	if [ -z "$1" ]; then
		err 1 "network_common(): No function name specified."
	else
		_func="$1"
	fi

	# Set the scope of the command (all interfaces or just one).
	#
	_cooked_list=
	if [ -n "$cmdifn" ]; then
		# Don't check that the interface(s) exist.  We need to run
		# the down code even when the interface doesn't exist to
		# kill off wpa_supplicant.
		# XXXBED: is this really true or does wpa_supplicant die?
		# if so, we should get rid of the devd entry
		_cooked_list="$cmdifn"
	else
		_cooked_list="`list_net_interfaces`"
	fi

	_fail=
	_ok=
	for ifn in ${_cooked_list}; do
		if ${_func} ${ifn} $2; then
			_ok="${_ok} ${ifn}"
		else
			_fail="${_fail} ${ifn}"
		fi
	done

	_str=
	if [ -n "${_ok}" ]; then
		case ${_func} in
		ifn_start)
			_str='Starting'
			;;
		ifn_stop)
			_str='Stopping'
			;;
		esac
		echo "${_str} Network:${_ok}."
		if check_startmsgs; then
			for ifn in ${_ok}; do
				/sbin/ifconfig ${ifn}
			done
		fi
	fi

	debug "The following interfaces were not configured: $_fail"
}

load_rc_config $name
run_rc_command $*
@


1.41
log
@SVN rev 240336 on 2012-09-11 05:04:59Z by obrien

Simply things so that "#REQUIRE: FILESYSTEMS" means the file
systems are fully "ready to go".

'FILESYSTEMS' states: "This is a dummy dependency, for services which
require file systems to be mounted before starting."  However, we have
'var' which is was run after 'FILESYSTEMS' and can mount /var if it
already isn't mounted.  Furthermore, several scripts cannot use /var
until 'cleanvar' has done its thing.  Thus "FILESYSTEMS" hasn't really
meant all critical file systems are fully usable.
@
text
@d25 1
a25 1
# $FreeBSD$
@


1.40
log
@SVN rev 230726 on 2012-01-29 08:33:34Z by hrs

Perform IPv6 DAD only in ifn_start.
@
text
@d29 1
a29 1
# REQUIRE: atm1 cleanvar FILESYSTEMS serial sppp sysctl
@


1.39
log
@SVN rev 230453 on 2012-01-22 10:57:32Z by hrs

Fix several glitches in IPv6-related knobs:

- ipv6_enable + ipv6_gateway_enable should unset ACCEPT_RTADV by default for
  backward compatibility.

- Configurations in ipv6_prefix_IF should be recognized even if there is no
  ifconfig_IF_ipv6.

- DAD wait should be performed at once, not on a per-interface basis, if
  possible.  This fixes an issue that a system with a lot of IPv6-capable
  interfaces takes too long for booting.

MFC after:	1 week
@
text
@d141 2
a142 1
	if [ -n "${_dadwait}" ]; then
d145 2
a146 1
	fi
@


1.38
log
@SVN rev 212579 on 2010-09-13 19:55:40Z by hrs

Split $ipv6_prefer into $ip6addrctl_policy and $ipv6_activate_all_interfaces.

The $ip6addrctl_policy is a variable to choose a pre-defined address
selection policy set by ip6addrctl(8).
The keyword "ipv4_prefer" sets IPv4-preferred one described in Section 10.3,
the keyword "ipv6_prefer" sets IPv6-preferred one in Section 2.1 in RFC 3484,
respectively.  When "AUTO" is specified, it attempts to read
/etc/ip6addrctl.conf first.  If it is found, it reads and installs it as
a policy table.  If not, either of the two pre-defined policy tables is
chosen automatically according to $ipv6_activate_all_interfaces.

When $ipv6_activate_all_interfaces=NO, interfaces which have no corresponding
$ifconfig_IF_ipv6 is marked as IFDISABLED for security reason.

The default values are ip6addrctl_policy=AUTO and
ipv6_activate_all_interfaces=NO.

Discussed with:	ume and bz
@
text
@d126 1
d132 3
d140 6
@


1.38.2.1
log
@SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.38.2.2
log
@SVN rev 242153 on 2012-10-26 18:06:49Z by obrien

MFC: r240336:
  Simply things so that "#REQUIRE: FILESYSTEMS" means the file
  systems are fully "ready to go".

  'FILESYSTEMS' states: "This is a dummy dependency, for services which
  require file systems to be mounted before starting."  However, we have
  'var' which is was run after 'FILESYSTEMS' and can mount /var if it
  already isn't mounted.  Furthermore, several scripts cannot use /var
  until 'cleanvar' has done its thing.  Thus "FILESYSTEMS" hasn't really
  meant all critical file systems are fully usable.
@
text
@d29 1
a29 1
# REQUIRE: atm1 FILESYSTEMS serial sppp sysctl
@


1.38.2.3
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242902
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242902 | dteske | 2012-11-11 23:29:45 +0000 (Sun, 11 Nov 2012) | 10 lines
## SVN ##
## SVN ## Fix a regression introduced by SVN r211417 that saw the breakage of a feature
## SVN ## documented in usr.sbin/sysinstall/help/shortcuts.hlp (reproduced below):
## SVN ##
## SVN ## If /usr/sbin/sysinstall is linked to another filename, say
## SVN ## `/usr/local/bin/configPackages', then the basename will be used
## SVN ## as an implicit command name.
## SVN ##
## SVN ## Reviewed by:	adrian (co-mentor)
## SVN ## Approved by:	adrian (co-mentor)
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d25 1
a25 1
# $FreeBSD: stable/9/etc/rc.d/netif 242153 2012-10-26 18:06:49Z obrien $
@


1.38.2.4
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/250915
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d25 1
a25 1
# $FreeBSD: stable/9/etc/rc.d/netif 250915 2013-05-22 18:26:12Z jamie $
d31 1
a31 1
# KEYWORD: nojailvnet
@


1.38.2.5
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/253227
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d25 1
a25 1
# $FreeBSD: stable/9/etc/rc.d/netif 253227 2013-07-12 00:40:49Z hrs $
a125 1
	_dadwait=
a130 3
			if ipv6if ${ifn}; then
				_dadwait=1
			fi
a135 8
	# inet6 address configuration needs sleep for DAD.
	case ${_func}:${_dadwait} in
	ifn_start:1)
		sleep `${SYSCTL_N} net.inet6.ip6.dad_count`
		sleep 1
	;;
	esac

@


1.38.2.6
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/253238
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d25 1
a25 1
# $FreeBSD: stable/9/etc/rc.d/netif 253238 2013-07-12 01:34:24Z hrs $
a48 2
	local _if

a83 5
	if [ -f /etc/rc.d/routing -a -n "$cmdifn" ] ; then
		for _if in $cmdifn; do
			/etc/rc.d/routing start any $_if
		done
	fi
a87 2
	local _if

a93 6

	if [ -f /etc/rc.d/routing -a -n "$cmdifn" ] ; then
		for _if in $cmdifn; do
			/etc/rc.d/routing stop any $_if
		done
	fi
@


1.38.2.1.4.1
log
@SVN rev 239080 on 2012-08-05 23:54:33Z by kensmith

Copy stable/9 to releng/9.1 as part of the 9.1-RELEASE release process.

Approved by:	re (implicit)
@
text
@@


1.38.2.1.4.2
log
@Switch importer
@
text
@d25 1
a25 1
# $FreeBSD: releng/9.1/etc/rc.d/netif 212579 2010-09-13 19:55:40Z hrs $
@


1.38.2.1.2.1
log
@SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)
@
text
@@


1.38.2.1.2.2
log
@Switch importer
@
text
@d25 1
a25 1
# $FreeBSD: releng/9.0/etc/rc.d/netif 212579 2010-09-13 19:55:40Z hrs $
@


1.37
log
@SVN rev 212574 on 2010-09-13 19:51:15Z by hrs

Revert changes in r206408.

Discussed with:	dougb, core.5, and core.6
@
text
@d44 2
a45 1
set_rcvar_obsolete ipv6_enable ipv6_prefer
@


1.36
log
@SVN rev 206408 on 2010-04-09 01:35:09Z by dougb

Improve the handling of IPv6 configuration in rc.d. The ipv6_enable
and ipv6_ifconfig_<interface> options have already been deprecated,
these changes do not alter that.

With these changes any value set for ipv6_enable will emit a
warning. In order to avoid a POLA violation for the deprecation
of the option ipv6_enable=NO will still disable configuration
for all interfaces other than lo0. ipv6_enable=YES will not have
any effect, but will emit an additional warning. Support and
warnings for this option will be removed in FreeBSD 10.x.

Consistent with the current code, in order for IPv6 to be configured
on an interface (other than lo0) an ifconfig_<interface>_ipv6
option will have to be added to /etc/rc.conf[.local].

1. Clean up and minor optimizations for the following functions:
ifconfig_up (the ipv6 elements)
ipv6if
ipv6_autoconfif
get_if_var
_ifconfig_getargs
The cleanups generally were to move the "easy" tests earlier in the
functions, and consolidate duplicate code.

2. Stop overloading ipv6_prefer with the ability to disable IPv6
configuration.

3. Remove noafif() which was only ever called from ipv6_autoconfif.
Instead, simplify and integrate the tests into that function, and
convert the test to use is_wired_interface() instead of listing
wireless interfaces explicitly.

4. Integrate backwards compatibility for ipv6_ifconfig_<interface>
into _ifconfig_getargs. This dramatically simplifies the code in
all of the callers, and avoids a lot of other code duplication.

5. In rc.d/netoptions, add code for an ipv6_privacy option to use
RFC 4193 style pseudo-random addresses (this is what windows does
by default, FYI).

6. Add support for the [NO]RTADV options in ifconfig_getargs() and
ipv6_autoconfif(). In the latter, include support for the explicit
addition of [-]accept_rtadv in ifconfig_<interface>_ipv6 as is done
in the current code.

7. In rc.d/netif add a warning if $ipv6_enable is set, and remove
the set_rcvar_obsolete for it. Also remove the latter from
rc.d/ip6addrctl.

8. In /etc/defaults/rc.conf:

Add an example for RTADV configuration.

Set ipv6_network_interfaces to AUTO.

Switch ipv6_prefer to YES. If ipv6_enable is not set this will have
no effect.

Add a default for ipv6_privacy (NO).

9. Document all of this in rc.conf.5.
@
text
@a36 1
start_precmd="network_prestart"
d44 1
a44 7
network_prestart()
{
	if [ -n "$ipv6_enable" ]; then
		warn 'The ipv6_enable option is deprecated.'
		warn 'See rc.conf(5) for information on disabling IPv6.'
	fi
}
@


1.35
log
@SVN rev 197947 on 2009-10-10 22:17:03Z by dougb

In regards to the "Starting foo:" type messages at boot time, create and
employ a more generic solution, and use it in the individual rc.d scripts
that also have an $rc_quiet test:

1. Add check_startmsgs() to rc.subr.
2. In the rc.d scripts that use rc_quiet (and rc.subr) substitute
variations of [ -z "$rc_quiet" ] with check_startmsgs
3. In savecore add a trailing '.' to the end of the message to make it
more consistent with other scripts.
4. In newsyslog remove a : before the terminal '.' since we do not expect
there to be anything printed out in between to make it more consistent.
5. In the following scripts change "quotes" to 'quotes' where no variables
exist in the message: savecore pf newsyslog
6. In the following scripts substitute if/then/fi for the simpler (and
more consistent) check_startmsgs &&: faith stf
7. In the following scripts separate the "Starting foo:" from the terminal
'.' to make them more consistent: moused hostname pf
8. In nfsclient move the message to its own line to avoid a style bug
9. In pf rc_quiet does not apply to the _stop method, so remove the
test there.
10. In motd add 'quotes' around the terminal '.' for consistency
@
text
@d37 1
d45 7
a51 1
set_rcvar_obsolete ipv6_enable ipv6_prefer
@


1.34
log
@SVN rev 197526 on 2009-09-26 18:59:00Z by hrs

Fix several logic bugs in the previous IPv6 variable change and
re-add $ipv6_enable support for backward compatibility.  From
UPDATING:

 1. To use IPv6, simply define $ifconfig_IF_ipv6 like $ifconfig_IF
    for IPv4.  For aliases, $ifconfig_IF_aliasN should be used.
    Note that both variables need the "inet6" keyword at the head.

    Do not set $ipv6_network_interfaces manually if you do not
    understand what you are doing.  It is not needed in most cases.

    $ipv6_ifconfig_IF and $ipv6_ifconfig_IF_aliasN still work, but
    they are obsolete.

 2. $ipv6_enable is obsolete.  Use $ipv6_prefer and/or
    "inet6 accept_rtadv" keyword in ifconfig(8) instead.

    If you define $ipv6_enable=YES, it means $ipv6_prefer=YES and
    all configured interfaces have "inet6 accept_rtadv" in the
    $ifconfig_IF_ipv6.  These are for backward compatibility.

 3. A new variable $ipv6_prefer has been added.  If NO, IPv6
    functionality of interfaces with no corresponding
    $ifconfig_IF_ipv6 is disabled by using "inet6 ifdisabled" flag,
    and the default address selection policy of ip6addrctl(8)
    is the IPv4-preferred one (see rc.d/ip6addrctl for more details).
    Note that if you want to configure IPv6 functionality on the
    disabled interfaces after boot, first you need to clear the flag by
    using ifconfig(8) like:

         ifconfig em0 inet6 -ifdisabled

    If YES, the default address selection policy is set as
    IPv6-preferred.

    The default value of $ipv6_prefer is NO.

 4. If your system need to receive Router Advertisement messages,
    define "inet6 accept_rtadv" in $ifconfig_IF_ipv6.  The rc(8)
    scripts automatically invoke rtsol(8) when the interface becomes
    UP.  The Router Advertisement messages are used for SLAAC
    (State-Less Address AutoConfiguration).
@
text
@d146 1
a146 1
		if [ -z "${rc_quiet}" ]; then
@


1.33
log
@SVN rev 197139 on 2009-09-12 22:13:41Z by hrs

Integrate rc.d/network_ipv6 into rc.d/netif:

- Add rc.d/stf and rc.d/faith for stf(4) and faith(4).
- Remove rc.d/auto_linklocal and rc.d/network_ipv6.
- Move rc.d/sysctl to just before FILESYSTEMS because rc.d/netif
  depends on some sysctl variables.

Reviewed by:	brooks
MFC after:	3 days
@
text
@d44 1
a44 1
set_rcvar_obsolete ipv6_enable
@


1.32
log
@SVN rev 195026 on 2009-06-26 01:04:50Z by dougb

Reverse the effect of r193198 for pf and ipfw which will once again
allow them to start after netif. There were too many problems reported
with this change in the short period of time that it lived in HEAD, and
we are too late in the release cycle to properly shake it out.

IMO the issue of having the firewalls up before the network is still a
valid concern, particularly for pf whose default state is wide open.
However properly solving this issue is going to take some investment
on the part of the people who actually use those tools.

This is not a strict reversion of all the changes for r193198 since it
also included some simplification of the BEFORE/REQUIRE logic which is
still valid for ipfilter and ip6fw.
@
text
@d44 2
@


1.32.2.1
log
@SVN rev 196045 on 2009-08-03 08:13:06Z by kensmith

Copy head to stable/8 as part of 8.0 Release cycle.

Approved by:	re (Implicit)
@
text
@@


1.32.2.2
log
@SVN rev 198164 on 2009-10-16 00:17:09Z by dougb

MFC r197947:

In regards to the "Starting foo:" type messages at boot time, create
and employ a more generic solution, and use it in the individual rc.d
scripts that also have an $rc_quiet test:

1. Add check_startmsgs() to rc.subr.
2. In the rc.d scripts that use rc_quiet (and rc.subr) substitute
variations of [ -z "$rc_quiet" ] with check_startmsgs
3. In savecore add a trailing '.' to the end of the message to make it
more consistent with other scripts.
4. In newsyslog remove a : before the terminal '.' since we do not
expect there to be anything printed out in between to make it more
consistent.
5. In the following scripts change "quotes" to 'quotes' where no
variables exist in the message: savecore pf newsyslog
6. [Does not apply in RELENG_8]
7. In the following scripts separate the "Starting foo:" from the
terminal '.' to make them more consistent: moused hostname pf
8. In nfsclient move the message to its own line to avoid a style bug
9. In pf rc_quiet does not apply to the _stop method, so remove the
test there.
10. In motd add 'quotes' around the terminal '.' for consistency

Approved by:	re (kib)
@
text
@d144 1
a144 1
		if check_startmsgs; then
@


1.32.2.3
log
@SVN rev 231372 on 2012-02-10 10:18:30Z by dougb

MFC r208307:

This change does the following for the scripts that run up through
FILESYSTEMS (the default early_late_divider):
1. Move sysctl to run first
2. Move as many BEFOREs to REQUIREs as possible.
3. Minor effect, move hostid_save from right before mdconfig to right
   after.

A lot of the early scripts make use of sysctl one way or another so
running this first makes a lot of sense given that system-critical
values are often placed in sysctl.conf. (More details in original log.)

In addition to the changes from this revision, tweak a few other rcorder
elements in order to minimize the differences between the order before
and after this change, mostly related to scripts still in this branch
that are no longer in HEAD.
@
text
@d30 1
a30 1
# REQUIRE: ipfilter ipfs auto_linklocal
@


1.32.2.4
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242909
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242909 | dim | 2012-11-12 07:47:19 +0000 (Mon, 12 Nov 2012) | 20 lines
## SVN ##
## SVN ## MFC r242625:
## SVN ##
## SVN ## Remove duplicate const specifiers in many drivers (I hope I got all of
## SVN ## them, please let me know if not).  Most of these are of the form:
## SVN ##
## SVN ## static const struct bzzt_type {
## SVN ##       [...list of members...]
## SVN ## } const bzzt_devs[] = {
## SVN ##       [...list of initializers...]
## SVN ## };
## SVN ##
## SVN ## The second const is unnecessary, as arrays cannot be modified anyway,
## SVN ## and if the elements are const, the whole thing is const automatically
## SVN ## (e.g. it is placed in .rodata).
## SVN ##
## SVN ## I have verified this does not change the binary output of a full kernel
## SVN ## build (except for build timestamps embedded in the object files).
## SVN ##
## SVN ## Reviewed by:	yongari, marius
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d25 1
a25 1
# $FreeBSD: stable/8/etc/rc.d/netif 231372 2012-02-10 10:18:30Z dougb $
@


1.32.2.3.2.1
log
@SVN rev 232438 on 2012-03-03 06:15:13Z by kensmith

Copy stable/8 to releng/8.3 as part of 8.3-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.32.2.3.2.2
log
@Switch importer
@
text
@d25 1
a25 1
# $FreeBSD: releng/8.3/etc/rc.d/netif 231372 2012-02-10 10:18:30Z dougb $
@


1.32.2.2.6.1
log
@SVN rev 216617 on 2010-12-21 17:09:25Z by kensmith

Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.

Approved by:	re (implicit)
@
text
@@


1.32.2.2.4.1
log
@SVN rev 209145 on 2010-06-14 02:09:06Z by kensmith

Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.

Approved by:	re (implicit)
@
text
@@


1.32.2.2.2.1
log
@SVN rev 198460 on 2009-10-25 01:10:29Z by kensmith

Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure.

Approved by:	re (implicit)
@
text
@@


1.31
log
@SVN rev 193198 on 2009-06-01 05:35:03Z by dougb

Make the pf and ipfw firewalls start before netif, just like ipfilter
already does. This eliminates a logical inconsistency, and a small
window where the system is open after the network comes up.
@
text
@d30 1
a30 1
# REQUIRE: ipfilter ipfs pf ipfw
@


1.30
log
@SVN rev 184485 on 2008-10-30 20:24:25Z by pjd

ifconfig(8) can take only one interface at a time.
@
text
@d29 2
a30 1
# REQUIRE: atm1 cleanvar ipfilter FILESYSTEMS serial sppp sysctl
@


1.29
log
@SVN rev 179961 on 2008-06-23 20:50:11Z by mtm

Implement a "quiet" mode for rc.d/netif, which only outputs
the interface name of interfaces that were configured.

This change has the added benefit that ifn_start() and
ifn_stop() in network.subr no longer write to standard output.
Whether to output and what to output is now handled entirely
in rc.d/netif.
@
text
@d144 3
a146 1
			/sbin/ifconfig ${_ok}
@


1.28
log
@Move the wait for a default route to rc.d/routing.  Once we test for
non-dhcp interfaces to negotiate/associate this will make more sense.

This also correctly gets run after both devd and netif are run so it has
a chance of working.
@
text
@a87 2
	echo -n "Stopping network:"

a89 1
	echo '.'
d98 1
a98 1
	local _cooked_list _fail _func
d123 1
d125 3
a127 1
		if ! ${_func} ${ifn} $2; then
d132 16
@


1.27
log
@Change the default value of synchronous_dhclient to NO.

To preserve the existing behavior of etc/rc.d/netif, add code to wait
up to if_up_delay seconds (30 seconds by default) for a default route to
be configured if there are any dhcp interfaces.  This should be extended
to test that the interface is actually up.

X-MFC after:
@
text
@a72 23
	if [ -z "$cmdifn" ]; then
		dhcp_interfaces=`list_net_interfaces dhcp`
		if [ -n "${dhcp_interfaces}" ]; then
			delay=${if_up_delay}
			while [ ${delay} -gt 0 ]; do
				defif=`get_default_if -inet`
				if [ -n "${defif}" ]; then
					if [ ${delay} -ne ${if_up_delay} ]; then
						echo "($defif)"
					fi
					break
				fi
				if [ ${delay} -eq ${if_up_delay} ]; then
					echo -n "Waiting for an interface to come up: "
				else
					echo -n .
				fi
				sleep 1
				delay=`expr $delay - 1`
			done
		fi
	fi

@


1.26
log
@rc support for vaps
@
text
@d73 23
@


1.25
log
@Re-implement: do not silently fail when a command is not carried
out because the rc.conf(5) variable was not enabled. Display a
message that the command wasn't run and offer suggestions on
what the user can do.

Implement a quiet prefix, which will disable some diagnostics. The
fast prefix also implies quiet. During boot we use either fast or
quiet. For shutdown we already use 'faststop'. So, this informational
message should only appear during interactive use.

An additional benefit of having a quiet prefix is that we can start
putting some of our diagnostic messages behind this knob and start
"de-cluttering" the console during boot and shutdown.
@
text
@d71 1
a71 1
	network_common ifn_start verbose
d95 1
a95 1
# network_common routine verbose
d98 1
a98 4
#	an interface and then calls $routine. If $verbose is specified,
#	it will call ifconfig(8) to show, in long format, the configured
#	interfaces. If $verbose is not given, it will simply output the
#	configured interface(s).
d101 1
a101 1
	local _cooked_list _fail _func _verbose
a103 1
	_verbose=
a109 1
	[ -n "$2" ] && _verbose=yes
d115 1
a115 1
		# Don't check that the interfaces exist.  We need to run
d118 2
d127 2
a128 4
		if ${_func} ${ifn} ; then
			eval showstat_$ifn=1
		else
			_fail="$_fail $ifn"
a131 12
	# Display interfaces configured by this script
	#
	for ifn in ${_cooked_list}; do
		eval showstat=\$showstat_${ifn}
		if [ ! -z ${showstat} ]; then
			if [ -n "$_verbose" ]; then
				ifconfig ${ifn}
			else
				echo -n " ${ifn}"
			fi
		fi
	done
a134 32
ifn_start()
{
	local ifn cfg
	ifn="$1"
	cfg=1

	[ -z "$ifn" ] && return 1

	ifscript_up ${ifn} && cfg=0
	ifconfig_up ${ifn} && cfg=0
	ipv4_up ${ifn} && cfg=0
	ipx_up ${ifn} && cfg=0

	return $cfg
}

ifn_stop()
{
	local ifn cfg
	ifn="$1"
	cfg=1

	[ -z "$ifn" ] && return 1

	ipx_down ${ifn} && cfg=0
	ipv4_down ${ifn} && cfg=0
	ifconfig_down ${ifn} && cfg=0
	ifscript_down ${ifn} && cfg=0

	return $cfg
}

@


1.24
log
@Require 'cleanvar' so that files and sockets created in /var/run by
wpa_supplicant and other programs started by 'netif' don't get erased
by a subsequent 'cleanvar'.

Approved by:	re (bmah)
Reviewed by:	dougb
MFC after:	1 week
@
text
@d75 1
a75 1
		/etc/rc.d/ipfilter resync
@


1.24.2.1
log
@SVN rev 202169 on 2010-01-12 20:06:04Z by jhb

MFC 201215:
Add support for configuring vlan(4) interfaces as child devices similar to
wlan(4) interfaces.  vlan(4) interfaces are listed via a new 'vlans_<IF>'
variable.  If a vlan interface is a number, then that number is treated as
the vlan tag for the interface and the interface will be named '<IF>.<tag>'.
Otherwise, the vlan tag must be provided via a vlan parameter in a
'create_args_<vlan>' variable.

While I'm here, fix a few nits in rc.conf(5) and mention create_args_<IF> in
the description of cloned_interfaces.

The changes for 7.x are a bit larger as they introduce childif_create() and
childif_destroy() and move ifn_start() and ifn_stop() from rc.d/netif to
network.subr.
@
text
@d152 32
@


1.24.2.2
log
@SVN rev 207811 on 2010-05-09 08:22:33Z by dougb

rc_quiet does not exist in RELENG_7, so hand-merge the part of r179870
that I did not think was applicable here (namely bailing out of
run_rc_command before printing the warning) but use rc_fast as the
trigger instead of rc_quiet. The former exists in all supported branches,
and is set at boot time so it does the job.

The only remaining element that isn't already covered by 'faststart' is
an instance of '/etc/rc.d/ipfilter resync' in rc.d/netif, so make that
fastresync to also silence the warning there. This is similar to what
was done in r175676, although that used quietresync (as described above).

Pointed out by:	jhell <jhell@@dataix.net>
@
text
@d75 1
a75 1
		/etc/rc.d/ipfilter fastresync
@


1.24.2.3
log
@SVN rev 209798 on 2010-07-08 13:34:01Z by jhb

MFC 175676:
Implement a quiet prefix, which will disable some diagnostics. The
fast prefix also implies quiet. During boot we use either fast or
quiet. For shutdown we already use 'faststop'. So, this informational
message should only appear during interactive use.

Reviewed by:	silence on freebsd-rc@@
@
text
@d75 1
a75 1
		/etc/rc.d/ipfilter quietresync
@


1.24.2.4
log
@Switch importer
@
text
@d25 1
a25 1
# $FreeBSD: stable/7/etc/rc.d/netif 220110 2011-03-28 19:29:30Z dougb $
@


1.24.2.3.2.1
log
@SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release.

Approved by:	re (implicit)
@
text
@@


1.24.2.3.2.2
log
@Switch importer
@
text
@d25 1
a25 1
# $FreeBSD: releng/7.4/etc/rc.d/netif 209798 2010-07-08 13:34:01Z jhb $
@


1.24.2.1.2.1
log
@SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith

Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process.

Approved by:	re (implicit)
@
text
@@


1.24.8.1
log
@SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith

Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.

Approved by:	re (implicit)
@
text
@@


1.24.6.1
log
@SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith

Create releng/7.1 in preparation for moving into RC phase of 7.1 release
cycle.

Approved by:	re (implicit)
@
text
@@


1.23
log
@Add a dummy script, FILESYSTEMS, which depends on root and mountcritlocal
and takes over mountcritlocal's role as the early / late divider.  This
makes it far easier to add rc scripts which need to run early, such as a
startup script for zfs, which is right around the corner.

This change should be a no-op; I have verified that the only change in
rcorder's output is the insertion of FILESYSTEMS immediately after
mountcritlocal.

MFC after:	3 weeks
@
text
@d29 1
a29 1
# REQUIRE: atm1 ipfilter FILESYSTEMS serial sppp sysctl
@


1.22
log
@Add support for EtherChannel configuration to rc startup scripts.

Note: This also deprecates "NO" as a way to specify an empty list of
interfaces for gif_interfaces.

PR:		conf/104884
Submitted by:	nork
Harassed by:	brd
Discussed with:	brooks, dougb
@
text
@d29 1
a29 1
# REQUIRE: atm1 ipfilter mountcritlocal serial sppp sysctl
@


1.21
log
@Eliminate global symbols starting with an underscore from rc.d
scripts, except for mdconfig* and jail.  Such symbols are reserved
for the rc.subr internals.  Most scripts can be fixed by just
declaring _foo symbols as local: few scripts actually need them to
be global.

Discussed with:	dougb in freebsd-rc
@
text
@d60 3
@


1.20
log
@Add rc.d/bridge which is invoked when a new interface arrives and can
automaticly add it to an Ethernet bridge. This is intended for applications
such as qemu, vmware, openvpn, ... which open tap interfaces and need them
bridged with the hosts network adapter, the user can set up a glob for
interfaces to be automatically added (eg tap*).
@
text
@d41 1
a41 1
_cmdifn=
d47 1
a47 1
	_cmdifn=$*
d49 1
a49 1
	if [ -z "$_cmdifn" ]; then
d74 2
a75 2
	if [ -f /etc/rc.d/bridge -a -n "$_cmdifn" ] ; then
		/etc/rc.d/bridge start $_cmdifn
d83 1
a83 1
	_cmdifn=$*
d101 2
d116 1
a116 1
	if [ -n "$_cmdifn" ]; then
d120 1
a120 1
		_cooked_list="$_cmdifn"
d125 1
@


1.19
log
@Since OLDCARD is gone from the kernel, catchup here and remove support
from here as well.
@
text
@d74 3
@


1.18
log
@Add a new configuration variable, ipv4_addrs_<ifn>, which adds one or
more IPv4 address from a ranged list in CIRD notation:

ipv4_addrs_ed0="192.168.0.1/24 192.168.1.1-5/28"

In the process move alias processing into new ipv4_up/down functions to
more toward a less IPv4 centric world.

Submitted by:	Philipp Wuensche <cryx dash freebsd at h3q dot com>
@
text
@d29 1
a29 1
# REQUIRE: atm1 ipfilter mountcritlocal pccard serial sppp sysctl
@


1.17
log
@Remove duplicate "at" from comment.
@
text
@d153 1
a153 1
	ifalias_up ${ifn} && cfg=0
d168 1
a168 1
	ifalias_down ${ifn} && cfg=0
@


1.16
log
@Actually block Ctrl-C (SIGINT=2).

Reported by:	sam
Pointy hat to:	brooks
@
text
@d54 1
a54 1
		# disable SIGINT (Ctrl-c) when running at at startup
@


1.15
log
@Block SIGQUIT (Ctrl-C) while running in startup mode.  This should allow
dhclient's to be killed without stopping all boot progress.

Minor cleanup of the interface list generation code.
@
text
@d54 2
a55 2
		# disable SIGQUIT (Ctrl-c) when running at at startup
		trap : 3
@


1.14
log
@When interfaces are given on the command line, don't attempt to filter
them.  Just try to run the given command on them.  We need to be able to
run stop functions on interfaces that have been deleted to stop
wpa_supplicant.

Approved by:	re (interface startup blanket)
@
text
@d54 3
a107 3
	# Get a list of network interfaces.
	_ifn_list="`list_net_interfaces`"

d117 1
a117 1
		_cooked_list="$_ifn_list"
@


1.14.2.1
log
@Sync network interface startup code with HEAD.

etc/network.subr: 1.165-1.167
 - kill removable_interfaces
 - add NOAUTO keyword
 - fix quoted entries in ifconfig_<ifn> variables
 - always up the interface
 - if ifconfig_<ifn> is defined, but empty, don't set it to
   ifconfig_DEFAULT
 - always configure lo0 first if it exists
etc/pccard_ether: 1.46
 - kill removable_interfaces
 - add NOAUTO keyword
etc/rc.d/netif: 1.15-1.17
 - block Ctrl-C in dhclient
 - minor cleanup of the interface list generation code

Approved by:	re (scottl)
Requested by:	many (death to removable_interfaces!)
@
text
@a53 3
		# disable SIGINT (Ctrl-c) when running at startup
		trap : 2

d105 3
d117 1
a117 1
		_cooked_list="`list_net_interfaces`"
@


1.14.2.2
log
@MFC the addition of the ipv4_addrs_<ifn> which allows the addition of
multiple aliases using ranges and CIDR notation.

Submitted by:	Philipp Wuensche <cryx dash freebsd at h3q dot com>
@
text
@d153 1
a153 1
	ipv4_up ${ifn} && cfg=0
d168 1
a168 1
	ipv4_down ${ifn} && cfg=0
@


1.14.2.3
log
@MFC
  Add rc.d/bridge which is invoked when a new interface arrives and can
  automaticly add it to an Ethernet bridge.

  r1.287     src/etc/defaults/rc.conf
  r1.73      src/etc/rc.d/Makefile
  r1.1       src/etc/rc.d/bridge
  r1.20      src/etc/rc.d/netif
  r1.299     src/share/man/man5/rc.conf.5
@
text
@a73 3
	if [ -f /etc/rc.d/bridge -a -n "$_cmdifn" ] ; then
		/etc/rc.d/bridge start $_cmdifn
	fi
@


1.14.2.4
log
@MFC 1.24: Require 'cleanvar'.
@
text
@d29 1
a29 1
# REQUIRE: atm1 cleanvar ipfilter mountcritlocal pccard serial sppp sysctl
@


1.14.2.5
log
@MFC:
  Eliminate global symbols starting with an underscore from rc.d
  scripts, except for mdconfig* and jail.  Such symbols are reserved
  for the rc.subr internals.  Most scripts can be fixed by just
  declaring _foo symbols as local: few scripts actually need them to
  be global.
@
text
@d41 1
a41 1
cmdifn=
d47 1
a47 1
	cmdifn=$*
d49 1
a49 1
	if [ -z "$cmdifn" ]; then
d74 2
a75 2
	if [ -f /etc/rc.d/bridge -a -n "$cmdifn" ] ; then
		/etc/rc.d/bridge start $cmdifn
d83 1
a83 1
	cmdifn=$*
a100 2
	local _cooked_list _fail _func _verbose

d114 1
a114 1
	if [ -n "$cmdifn" ]; then
d118 1
a118 1
		_cooked_list="$cmdifn"
a122 1
	_fail=
@


1.14.2.6
log
@Switch importer
@
text
@d25 1
a25 1
# $FreeBSD: stable/6/etc/rc.d/netif 172969 2007-10-25 14:36:12Z mtm $
@


1.14.2.5.4.1
log
@SVN rev 183531 on 2008-10-02 02:57:24Z by kensmith

Create releng/6.4 from stable/6 in preparation for 6.4-RC1.

Approved by:	re (implicit)
@
text
@@


1.13
log
@Support code for the OpenBSD dhclient.  This significantly changes the
way interfaces are configured.  Some key points:

  - At startup, all interfaces are configured through /etc/rc.d/netif.
  - ifconfig_<if> variables my now mix real ifconfig commands the with
    DHCP and WPA directives.  For example, this allows media
    configuration prior to running dhclient.
  - /etc/rc.d/dhclient is not run at startup except by netif to start
    dhclient on specific interfaces.
  - /etc/pccard_ether calls "/etc/rc.d/netif start <if>" to do most of
    it's work.
  - /etc/pccard_ether no longer takes additional arguments to pass to
    ifconfig.  Instead, ifconfig_<if> variables are now honored in favor
    of pccard_ifconfig when available.
  - /etc/pccard_ether will only run on interfaces specified in
    removable_interfaces, even if pccard_ifconfig is set.
@
text
@d112 4
a115 7
		for i in $_cmdifn ; do
			eval _if=\"`expr "$_ifn_list" : ".*\(${i}\).*"`\"
			if [ -z "$_if" ]; then
				err 1 "No such network interface: $i"
			fi
			_cooked_list="$_cooked_list $_if"
		done
@


1.12
log
@Allow to change interfaces name on boot time.
Now, one should be able to put something like this into /etc/rc.conf:

	ifconfig_fxp0_name="net0"
	ifconfig_net0="inet 10.0.0.1/16"

Reviewed by:	green
@
text
@d105 2
a106 2
	# Get a list of network interfaces. Do not include dhcp interfaces.
	_ifn_list="`list_net_interfaces nodhcp`"
@


1.11
log
@Remove the requirement for the FreeBSD keyword as it no longer
makes any sense.

Discussed with: dougb, brooks
MFC after: 3 days
@
text
@d59 3
@


1.10
log
@Finish cleanup of rc.d/netif. It's now possible to start/stop more
than one interface from the command line:
	# /etc/rc.d/netif start bfe0 xl0
It's also possible to restart an interface(s):
	# /etc/rc.d/netif restart bfe0

This required some changes to rc.subr(8) so that if the start/stop commands
are overidden the rest of the command line (after the start/stop/etc... cmd)
is passed through to the subroutines.
@
text
@d30 1
a30 1
# KEYWORD: FreeBSD nojail
@


1.10.2.1
log
@RCS file: /home/ncvs/src/etc/rc,v
----------------------------
revision 1.335
date: 2004/10/08 14:23:49;  author: mtm;  state: Exp;  lines: +0 -1
Remove an unused variable.

Submitted by: Pawel Worach <pawel.worach@@telia.com>
----------------------------
revision 1.334
date: 2004/10/07 13:55:25;  author: mtm;  state: Exp;  lines: +1 -1
Remove the requirement for the FreeBSD keyword as it no longer
makes any sense.

Discussed with: dougb, brooks
MFC after: 3 days
=============================================================================
RCS file: /home/ncvs/src/etc/rc.d/nsswitch,v
----------------------------
revision 1.4
date: 2004/09/16 17:03:12;  author: keramida;  state: Exp;  lines: +1 -1
Fix requirement of `network' to `NETWORK' because the former isn't
provided by any rc.d script.

Approved by:	mtm
=============================================================================
RCS file: /home/ncvs/src/etc/rc.d/pflog,v
----------------------------
revision 1.3
date: 2004/09/16 17:04:20;  author: keramida;  state: Exp;  lines: +1 -1
We don't have any providers of `beforenetlkm' in FreeBSD.  Remove the
dependency to it from our rc.d scripts.

Approved by:	mtm
=============================================================================

Approved by: re/scottl
@
text
@d30 1
a30 1
# KEYWORD: nojail
@


1.10.2.2
log
@MFC: Allow to change network interface names during
boot time with "ifconfig_<old>_name=<new>" in rc.conf

Merged revisions:
  network.subr:     1.157-1.160
  defaults/rc.conf: 1.227
  rc.d/netif:       1.12
@
text
@a58 3

		# Rename interfaces.
		ifnet_rename
@


1.9
log
@Really remove the return statement this time. Thanks to
ru for noticing.
@
text
@d45 4
d72 4
d107 1
a107 1
	_cooked_list="$_ifn_list"
d109 9
a117 4
		eval _cooked_list=\"`expr "$_ifn_list" : ".*\($_cmdifn\).*"`\"
		if [ -z "$_cooked_list" ]; then
			err 1 "No such network interface: $_cmdifn"
		fi
a174 4
if [ -n "$2" ]; then
	_cmdifn="$2"
fi

d176 1
a176 1
run_rc_command "$1"
@


1.8
log
@The err routine requires two arguments: an exit value and a string.
Additionaly, it will exit the script so an return statements after
calling it are superflous.
@
text
@a103 1
			return 1
@


1.7
log
@Protect som cross-script invocations by checks to see that the target
script exists.  This allows pruning of rc.d scripts without getting
too many ugly boottime error message
@
text
@d88 1
a88 1
		err "network_common(): No function name specified."
d103 1
a103 1
			err "No such network interface: $_cmdifn"
@


1.6
log
@Mark scripts as not usable inside a jail by adding keyword 'nojail'.

Some suggestions from:	rwatson, Ruben de Groot <mail25@@bzerk.org>
@
text
@d60 4
a63 2
	# Resync ipfilter
	/etc/rc.d/ipfilter resync
@


1.5
log
@Further shuffle runcom ordering so that netif does not start before
ipfw, but ipfw and ipfilter do start before dhclient.
@
text
@d30 1
a30 1
# KEYWORD: FreeBSD
@


1.4
log
@What depends on ipfilter should probably also start ipfw at the same time.
@
text
@d29 1
a29 1
# REQUIRE: atm1 ipfilter ipfw mountcritlocal pccard serial sppp sysctl
@


1.3
log
@tty whacking should occur early, but not so early that the
required commands are not on a mounted file system.

Noticed by: bde
@
text
@d29 1
a29 1
# REQUIRE: atm1 ipfilter mountcritlocal pccard serial sppp sysctl
@


1.2
log
@Implement individual operations on static and dhcp interfaces. Previously
network interfaces could only be turned on and off as a group (all
static interfaces or all dhcp interfaces).

When used to start the interface a 'long form' ifconfig output is
used to show the status of the interface, but when stopping an interface
the script will simply output the name of the interface. This is simply my
personal preference. Hopefully as this functionality matures we can
stabilize on a prefered form of output for these scripts.

A stop command to the dhclient script now explicitly releases the dhcp lease.
Behaviour at system shutdown; however, is unchanged since dhclient is not,
by default, run at that time. The client will not release its lease
at shutdown.
@
text
@d29 1
a29 1
# REQUIRE: atm1 ipfilter mountcritlocal pccard serial sppp sysctl tty
@


1.1
log
@Break out and rewrite the network setup scripts.
	o /etc/network.subr contains common subroutines used for seting
	  up network interfaces
	o rc.d/hostname sets the hostname if not already set
	o rc.d/nisdomain sets the nis domain *after* rpcbind but
	  before the yp* daemons. This fixes issues with temporary
	  hangs when looking up informaion in nis before it's ready.
	o rc.d/netif brings network interfaces (minus dhcp)  up.
	o rc.d/network1 has been disabled and will be retired before
	  RELENG_5. It will be replaced by rc.d/netif

Approved by:	markm (mentor)
@
text
@d41 1
d45 11
a55 2
	# Create cloned interfaces
	clone_up
d57 34
a90 2
	# Create IPv6<-->IPv4 tunnels
	gif_up
d95 1
a95 2
	# Setup the supplied network interfaces including startup
	# scripts, if they exist.
d97 8
a104 2
	for ifn in ${_ifn_list}; do
		ifscript_up ${ifn} && eval showstat_$ifn=1
d106 6
a111 5
		ifconfig_up ${ifn} && eval showstat_$ifn=1

		ifalias_up ${ifn} && eval showstat_$ifn=1

		ipx_up ${ifn} && eval showstat_$ifn=1
d116 1
a116 1
	for ifn in ${_ifn_list}; do
d119 5
a123 1
			ifconfig ${ifn}
d126 15
d142 1
a142 2
	# Resync ipfilter
	/etc/rc.d/ipfilter resync
d145 1
a145 1
network_stop()
d147 10
a156 1
	echo -n "Stopping network:"
d158 1
a158 3
	# flush routes
	route -n flush
	echo '.'
d160 4
@

