head	1.16;
access;
symbols
	RELENG_8_4:1.15.0.2
	RELENG_9_1_0_RELEASE:1.11.2.3.2.2
	RELENG_9_1:1.11.2.3.0.2
	RELENG_9_1_BP:1.11.2.3
	RELENG_8_3_0_RELEASE:1.5.10.2.2.1
	RELENG_8_3:1.5.10.2.0.2
	RELENG_8_3_BP:1.5.10.2
	RELENG_9_0_0_RELEASE:1.11.2.1.2.1
	RELENG_9_0:1.11.2.1.0.2
	RELENG_9_0_BP:1.11.2.1
	RELENG_9:1.11.0.2
	RELENG_9_BP:1.11
	RELENG_7_4_0_RELEASE:1.5.14.1
	RELENG_8_2_0_RELEASE:1.5.10.1.6.1
	RELENG_7_4:1.5.0.14
	RELENG_7_4_BP:1.5
	RELENG_8_2:1.5.10.1.0.6
	RELENG_8_2_BP:1.5.10.1
	RELENG_8_1_0_RELEASE:1.5.10.1.4.1
	RELENG_8_1:1.5.10.1.0.4
	RELENG_8_1_BP:1.5.10.1
	RELENG_7_3_0_RELEASE:1.5.12.1
	RELENG_7_3:1.5.0.12
	RELENG_7_3_BP:1.5
	RELENG_8_0_0_RELEASE:1.5.10.1.2.1
	RELENG_8_0:1.5.10.1.0.2
	RELENG_8_0_BP:1.5.10.1
	RELENG_8:1.5.0.10
	RELENG_8_BP:1.5
	RELENG_7_2_0_RELEASE:1.5.8.1
	RELENG_7_2:1.5.0.8
	RELENG_7_2_BP:1.5
	RELENG_7_1_0_RELEASE:1.5.6.1
	RELENG_6_4_0_RELEASE:1.4.2.1.4.1
	RELENG_7_1:1.5.0.6
	RELENG_7_1_BP:1.5
	RELENG_6_4:1.4.2.1.0.4
	RELENG_6_4_BP:1.4.2.1
	RELENG_7_0_0_RELEASE:1.5
	RELENG_6_3_0_RELEASE:1.4.2.1
	RELENG_7_0:1.5.0.4
	RELENG_7_0_BP:1.5
	RELENG_6_3:1.4.2.1.0.2
	RELENG_6_3_BP:1.4.2.1
	RELENG_7:1.5.0.2
	RELENG_7_BP:1.5
	RELENG_6_2_0_RELEASE:1.4
	RELENG_6_2:1.4.0.8
	RELENG_6_2_BP:1.4
	RELENG_5_5_0_RELEASE:1.3.2.1
	RELENG_5_5:1.3.2.1.0.6
	RELENG_5_5_BP:1.3.2.1
	RELENG_6_1_0_RELEASE:1.4
	RELENG_6_1:1.4.0.6
	RELENG_6_1_BP:1.4
	RELENG_6_0_0_RELEASE:1.4
	RELENG_6_0:1.4.0.4
	RELENG_6_0_BP:1.4
	RELENG_6:1.4.0.2
	RELENG_6_BP:1.4
	RELENG_5_4_0_RELEASE:1.3.2.1
	RELENG_5_4:1.3.2.1.0.4
	RELENG_5_4_BP:1.3.2.1
	RELENG_5_3_0_RELEASE:1.3.2.1
	RELENG_5_3:1.3.2.1.0.2
	RELENG_5_3_BP:1.3.2.1
	RELENG_5:1.3.0.2
	RELENG_5_BP:1.3
	RELENG_5_2_1_RELEASE:1.1
	RELENG_5_2_0_RELEASE:1.1
	RELENG_5_2:1.1.0.2
	RELENG_5_2_BP:1.1;
locks; strict;
comment	@# @;


1.16
date	2013.05.05.00.33.41;	author svnexp;	state Exp;
branches;
next	1.15;

1.15
date	2013.02.03.00.41.57;	author svnexp;	state Exp;
branches
	1.15.2.1;
next	1.14;

1.14
date	2012.11.17.01.49.04;	author svnexp;	state Exp;
branches;
next	1.13;

1.13
date	2012.07.19.15.36.36;	author emax;	state Exp;
branches;
next	1.12;

1.12
date	2012.01.14.02.18.41;	author dougb;	state Exp;
branches;
next	1.11;

1.11
date	2010.09.13.19.55.40;	author hrs;	state Exp;
branches
	1.11.2.1;
next	1.10;

1.10
date	2010.09.13.19.51.15;	author hrs;	state Exp;
branches;
next	1.9;

1.9
date	2010.04.09.01.35.09;	author dougb;	state Exp;
branches;
next	1.8;

1.8
date	2009.10.02.02.24.25;	author hrs;	state Exp;
branches;
next	1.7;

1.7
date	2009.09.26.18.59.00;	author hrs;	state Exp;
branches;
next	1.6;

1.6
date	2009.09.12.22.13.41;	author hrs;	state Exp;
branches;
next	1.5;

1.5
date	2007.04.02.22.53.07;	author des;	state Exp;
branches
	1.5.2.1
	1.5.6.1
	1.5.8.1
	1.5.10.1
	1.5.12.1
	1.5.14.1;
next	1.4;

1.4
date	2004.10.07.13.55.26;	author mtm;	state Exp;
branches
	1.4.2.1;
next	1.3;

1.3
date	2004.06.02.09.39.49;	author ume;	state Exp;
branches
	1.3.2.1;
next	1.2;

1.2
date	2004.03.08.12.25.05;	author pjd;	state Exp;
branches;
next	1.1;

1.1
date	2003.10.30.17.55.52;	author ume;	state Exp;
branches;
next	;

1.15.2.1
date	2013.02.03.00.41.57;	author svnexp;	state dead;
branches;
next	1.15.2.2;

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

1.11.2.1
date	2011.09.23.00.51.37;	author kensmith;	state Exp;
branches
	1.11.2.1.2.1;
next	1.11.2.2;

1.11.2.2
date	2012.02.14.10.16.56;	author dougb;	state Exp;
branches;
next	1.11.2.3;

1.11.2.3
date	2012.08.02.20.49.11;	author emax;	state Exp;
branches
	1.11.2.3.2.1;
next	1.11.2.4;

1.11.2.4
date	2012.11.17.11.36.11;	author svnexp;	state Exp;
branches;
next	1.11.2.5;

1.11.2.5
date	2013.02.09.18.17.57;	author svnexp;	state Exp;
branches;
next	1.11.2.6;

1.11.2.6
date	2013.05.11.20.01.44;	author svnexp;	state Exp;
branches;
next	;

1.11.2.1.2.1
date	2011.11.11.04.20.22;	author kensmith;	state Exp;
branches;
next	1.11.2.1.2.2;

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

1.11.2.3.2.1
date	2012.08.05.23.54.33;	author kensmith;	state Exp;
branches;
next	1.11.2.3.2.2;

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

1.5.2.1
date	2012.02.14.10.17.30;	author dougb;	state Exp;
branches;
next	1.5.2.2;

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

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

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

1.5.10.1
date	2009.08.03.08.13.06;	author kensmith;	state Exp;
branches
	1.5.10.1.2.1
	1.5.10.1.4.1
	1.5.10.1.6.1;
next	1.5.10.2;

1.5.10.2
date	2012.02.14.10.17.14;	author dougb;	state Exp;
branches
	1.5.10.2.2.1;
next	1.5.10.3;

1.5.10.3
date	2012.11.17.10.35.56;	author svnexp;	state Exp;
branches;
next	1.5.10.4;

1.5.10.4
date	2013.02.09.18.22.21;	author svnexp;	state Exp;
branches;
next	;

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

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

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

1.5.10.2.2.1
date	2012.03.03.06.15.13;	author kensmith;	state Exp;
branches;
next	1.5.10.2.2.2;

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

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

1.5.14.1
date	2010.12.21.17.10.29;	author kensmith;	state Exp;
branches;
next	1.5.14.2;

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

1.4.2.1
date	2007.05.24.16.14.37;	author des;	state Exp;
branches
	1.4.2.1.4.1;
next	1.4.2.2;

1.4.2.2
date	2012.11.17.07.39.07;	author svnexp;	state Exp;
branches;
next	;

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

1.3.2.1
date	2004.10.10.09.50.53;	author mtm;	state Exp;
branches;
next	;


desc
@@


1.16
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/250240
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@#!/bin/sh
#
# $FreeBSD: head/etc/rc.d/ip6addrctl 250240 2013-05-04 15:42:55Z hrs $
#

# PROVIDE: ip6addrctl
# REQUIRE: FILESYSTEMS
# BEFORE: netif
# KEYWORD: nojail

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

name="ip6addrctl"
rcvar="ip6addrctl_enable"
start_cmd="ip6addrctl_start"
stop_cmd="ip6addrctl_stop"
extra_commands="status prefer_ipv6 prefer_ipv4"
status_cmd="ip6addrctl"
prefer_ipv6_cmd="ip6addrctl_prefer_ipv6"
prefer_ipv4_cmd="ip6addrctl_prefer_ipv4"
config_file="/etc/ip6addrctl.conf"

set_rcvar_obsolete ipv6_enable ipv6_activate_all_interfaces
set_rcvar_obsolete ipv6_prefer ip6addrctl_policy

IP6ADDRCTL_CMD="/usr/sbin/ip6addrctl"

ip6addrctl_prefer_ipv6()
{
	afexists inet6 || return 0

	${IP6ADDRCTL_CMD} flush >/dev/null 2>&1
	cat <<EOT | ${IP6ADDRCTL_CMD} install /dev/stdin
	::1/128		 50	 0
	::/0		 40	 1
	::ffff:0:0/96	 35	 4
	2002::/16	 30	 2
	2001::/32	  5	 5
	fc00::/7	  3	13
	::/96		  1	 3
	fec0::/10	  1	11
	3ffe::/16	  1	12
EOT
}

ip6addrctl_prefer_ipv4()
{
	afexists inet6 || return 0

	${IP6ADDRCTL_CMD} flush >/dev/null 2>&1
	cat <<EOT | ${IP6ADDRCTL_CMD} install /dev/stdin
	::1/128		 50	 0
	::/0		 40	 1
	::ffff:0:0/96	100	 4
	2002::/16	 30	 2
	2001::/32	  5	 5
	fc00::/7	  3	13
	::/96		  1	 3
	fec0::/10	  1	11
	3ffe::/16	  1	12
EOT
}

ip6addrctl_start()
{
	afexists inet6 || return 0

	# install the policy of the address selection algorithm.
	case "${ip6addrctl_policy}" in
	[Aa][Uu][Tt][Oo])
		if [ -r "${config_file}" -a -s "${config_file}" ]; then
			${IP6ADDRCTL_CMD} flush >/dev/null 2>&1
			${IP6ADDRCTL_CMD} install "${config_file}"
		else
			if checkyesno ipv6_activate_all_interfaces; then
				ip6addrctl_prefer_ipv6
			else
				ip6addrctl_prefer_ipv4
			fi
		fi
	;;
	ipv4_prefer)
		ip6addrctl_prefer_ipv4
	;;
	ipv6_prefer)
		ip6addrctl_prefer_ipv6
	;;
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
		# Backward compatibility when ipv6_prefer=YES
		ip6addrctl_prefer_ipv6
	;;
	[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
		# Backward compatibility when ipv6_prefer=NO
		ip6addrctl_prefer_ipv4
	;;
	[Nn][Oo][Nn][Ee])
		${IP6ADDRCTL_CMD} flush >/dev/null 2>&1
	;;
	*)
		warn "\$ip6addrctl_policy is invalid: ${ip6addrctl_policy}. " \
		    " \"ipv4_prefer\" is used instead."
		ip6addrctl_prefer_ipv4
	;;
	esac

	if checkyesno ip6addrctl_verbose; then
		echo 'Address selection policy table for IPv4 and IPv6:'
		${IP6ADDRCTL_CMD}
	fi
}

ip6addrctl_stop()
{
	afexists inet6 || return 0

	ip6addrctl flush >/dev/null 2>&1
}

load_rc_config $name
run_rc_command "$1"
@


1.15
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/246255
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d3 1
a3 1
# $FreeBSD: head/etc/rc.d/ip6addrctl 246255 2013-02-02 18:08:09Z ume $
d27 2
d33 12
a44 11
	ip6addrctl flush >/dev/null 2>&1
	ip6addrctl add ::1/128		 50	 0
	ip6addrctl add ::/0		 40	 1
	ip6addrctl add ::ffff:0:0/96	 35	 4
	ip6addrctl add 2002::/16	 30	 2
	ip6addrctl add 2001::/32	  5	 5
	ip6addrctl add fc00::/7		  3	13
	ip6addrctl add ::/96		  1	 3
	ip6addrctl add fec0::/10	  1	11
	ip6addrctl add 3ffe::/16	  1	12
	checkyesno ip6addrctl_verbose && ip6addrctl
d51 12
a62 11
	ip6addrctl flush >/dev/null 2>&1
	ip6addrctl add ::1/128		 50	 0
	ip6addrctl add ::/0		 40	 1
	ip6addrctl add ::ffff:0:0/96	100	 4
	ip6addrctl add 2002::/16	 30	 2
	ip6addrctl add 2001::/32	  5	 5
	ip6addrctl add fc00::/7		  3	13
	ip6addrctl add ::/96		  1	 3
	ip6addrctl add fec0::/10	  1	11
	ip6addrctl add 3ffe::/16	  1	12
	checkyesno ip6addrctl_verbose && ip6addrctl
d73 2
a74 3
			ip6addrctl flush >/dev/null 2>&1
			ip6addrctl install "${config_file}"
			checkyesno ip6addrctl_verbose && ip6addrctl
d98 1
a98 1
		ip6addrctl flush >/dev/null 2>&1
d106 5
@


1.15.2.1
log
@file ip6addrctl was added on branch RELENG_8_4 on 2013-03-28 13:02:43 +0000
@
text
@d1 113
@


1.15.2.2
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/248810
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@a0 81
#!/bin/sh
#
# $FreeBSD: releng/8.4/etc/rc.d/ip6addrctl 246599 2013-02-09 18:00:29Z ume $
#

# PROVIDE: ip6addrctl
# REQUIRE: FILESYSTEMS netif
# BEFORE: network_ipv6
# KEYWORD: nojail

. /etc/rc.subr

name="ip6addrctl"
rcvar="ip6addrctl_enable"
start_cmd="ip6addrctl_start"
stop_cmd="ip6addrctl_stop"
extra_commands="status prefer_ipv6 prefer_ipv4"
status_cmd="ip6addrctl"
prefer_ipv6_cmd="ip6addrctl_prefer_ipv6"
prefer_ipv4_cmd="ip6addrctl_prefer_ipv4"

ip6addrctl_prefer_ipv6()
{
	ip6addrctl flush >/dev/null 2>&1
	ip6addrctl add ::1/128		 50	 0
	ip6addrctl add ::/0		 40	 1
	ip6addrctl add ::ffff:0:0/96	 35	 4
	ip6addrctl add 2002::/16	 30	 2
	ip6addrctl add 2001::/32	  5	 5
	ip6addrctl add fc00::/7		  3	13
	ip6addrctl add ::/96		  1	 3
	ip6addrctl add fec0::/10	  1	11
	ip6addrctl add 3ffe::/16	  1	12
	checkyesno ip6addrctl_verbose && ip6addrctl
}

ip6addrctl_prefer_ipv4()
{
	ip6addrctl flush >/dev/null 2>&1
	ip6addrctl add ::1/128		 50	 0
	ip6addrctl add ::/0		 40	 1
	ip6addrctl add ::ffff:0:0/96	100	 4
	ip6addrctl add 2002::/16	 30	 2
	ip6addrctl add 2001::/32	  5	 5
	ip6addrctl add fc00::/7		  3	13
	ip6addrctl add ::/96		  1	 3
	ip6addrctl add fec0::/10	  1	11
	ip6addrctl add 3ffe::/16	  1	12
	checkyesno ip6addrctl_verbose && ip6addrctl
}

ip6addrctl_start()
{
	if ifconfig lo0 inet6 >/dev/null 2>&1; then
		# We have IPv6 support in kernel.

		# install the policy of the address selection algorithm.
		if [ -f /etc/ip6addrctl.conf ]; then
			ip6addrctl flush >/dev/null 2>&1
			ip6addrctl install /etc/ip6addrctl.conf
			checkyesno ip6addrctl_verbose && ip6addrctl
		else
			if checkyesno ipv6_enable; then
				ip6addrctl_prefer_ipv6
			else
				ip6addrctl_prefer_ipv4
			fi
		fi
	fi
}

ip6addrctl_stop()
{
	if ifconfig lo0 inet6 >/dev/null 2>&1; then
		# We have IPv6 support in kernel.
		ip6addrctl flush >/dev/null 2>&1
	fi
}

load_rc_config $name
run_rc_command "$1"
@


1.14
log
@Switching exporter and resync
@
text
@d3 1
a3 1
# $FreeBSD: head/etc/rc.d/ip6addrctl 238622 2012-07-19 15:36:36Z emax $
d32 9
a40 5
	ip6addrctl add ::1/128		50	0
	ip6addrctl add ::/0		40	1
	ip6addrctl add 2002::/16	30	2
	ip6addrctl add ::/96		20	3
	ip6addrctl add ::ffff:0:0/96	10	4
d49 9
a57 5
	ip6addrctl add ::ffff:0:0/96	50	0
	ip6addrctl add ::1/128		40	1
	ip6addrctl add ::/0		30	2
	ip6addrctl add 2002::/16	20	3
	ip6addrctl add ::/96		10	4
@


1.13
log
@SVN rev 238622 on 2012-07-19 15:36:36Z by emax

Allow to specify no source-address-selection policy

MFC after:	1 week
@
text
@d3 1
a3 1
# $FreeBSD$
@


1.12
log
@SVN rev 230099 on 2012-01-14 02:18:41Z by dougb

Prepare for the removal of set_rcvar() by changing the rcvar=
assignments to the literal values it would have returned.

The concept of set_rcvar() was nice in theory, but the forks
it creates are a drag on the startup process, which is especially
noticeable on slower systems, such as embedded ones.

During the discussion on freebsd-rc@@ a preference was expressed for
using ${name}_enable instead of the literal values. However the
code portability concept doesn't really apply since there are so
many other places where the literal name has to be searched for
and replaced. Also, using the literal value is also a tiny bit
faster than dereferencing the variables, and every little bit helps.
@
text
@d86 3
@


1.11
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
@d15 1
a15 1
rcvar=`set_rcvar`
@


1.11.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.11.2.2
log
@SVN rev 231653 on 2012-02-14 10:16:56Z by dougb

MFC r230099:

Change rcvar= assignments to the literal values set_rcvar
would have returned. This will slightly reduce boot time,
and help in diff reduction to HEAD.
@
text
@d15 1
a15 1
rcvar="ip6addrctl_enable"
@


1.11.2.3
log
@SVN rev 238995 on 2012-08-02 20:49:11Z by emax

MFC r238622

Allow to specify no source-address-selection policy

Approved by:	re (kib)
@
text
@a85 3
	[Nn][Oo][Nn][Ee])
		ip6addrctl flush >/dev/null 2>&1
	;;
@


1.11.2.4
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
@d3 1
a3 1
# $FreeBSD: stable/9/etc/rc.d/ip6addrctl 238995 2012-08-02 20:49:11Z emax $
@


1.11.2.5
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/246598
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d3 1
a3 1
# $FreeBSD: stable/9/etc/rc.d/ip6addrctl 246598 2013-02-09 17:56:57Z ume $
d32 5
a36 9
	ip6addrctl add ::1/128		 50	 0
	ip6addrctl add ::/0		 40	 1
	ip6addrctl add ::ffff:0:0/96	 35	 4
	ip6addrctl add 2002::/16	 30	 2
	ip6addrctl add 2001::/32	  5	 5
	ip6addrctl add fc00::/7		  3	13
	ip6addrctl add ::/96		  1	 3
	ip6addrctl add fec0::/10	  1	11
	ip6addrctl add 3ffe::/16	  1	12
d45 5
a49 9
	ip6addrctl add ::1/128		 50	 0
	ip6addrctl add ::/0		 40	 1
	ip6addrctl add ::ffff:0:0/96	100	 4
	ip6addrctl add 2002::/16	 30	 2
	ip6addrctl add 2001::/32	  5	 5
	ip6addrctl add fc00::/7		  3	13
	ip6addrctl add ::/96		  1	 3
	ip6addrctl add fec0::/10	  1	11
	ip6addrctl add 3ffe::/16	  1	12
@


1.11.2.6
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/250524
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d3 1
a3 1
# $FreeBSD: stable/9/etc/rc.d/ip6addrctl 250524 2013-05-11 19:11:20Z hrs $
a26 2
IP6ADDRCTL_CMD="/usr/sbin/ip6addrctl"

d31 11
a41 12
	${IP6ADDRCTL_CMD} flush >/dev/null 2>&1
	cat <<EOT | ${IP6ADDRCTL_CMD} install /dev/stdin
	::1/128		 50	 0
	::/0		 40	 1
	::ffff:0:0/96	 35	 4
	2002::/16	 30	 2
	2001::/32	  5	 5
	fc00::/7	  3	13
	::/96		  1	 3
	fec0::/10	  1	11
	3ffe::/16	  1	12
EOT
d48 11
a58 12
	${IP6ADDRCTL_CMD} flush >/dev/null 2>&1
	cat <<EOT | ${IP6ADDRCTL_CMD} install /dev/stdin
	::1/128		 50	 0
	::/0		 40	 1
	::ffff:0:0/96	100	 4
	2002::/16	 30	 2
	2001::/32	  5	 5
	fc00::/7	  3	13
	::/96		  1	 3
	fec0::/10	  1	11
	3ffe::/16	  1	12
EOT
d69 3
a71 2
			${IP6ADDRCTL_CMD} flush >/dev/null 2>&1
			${IP6ADDRCTL_CMD} install "${config_file}"
d95 1
a95 1
		${IP6ADDRCTL_CMD} flush >/dev/null 2>&1
a102 5

	if checkyesno ip6addrctl_verbose; then
		echo 'Address selection policy table for IPv4 and IPv6:'
		${IP6ADDRCTL_CMD}
	fi
@


1.11.2.3.2.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.11.2.3.2.2
log
@Switch importer
@
text
@d3 1
a3 1
# $FreeBSD: releng/9.1/etc/rc.d/ip6addrctl 238995 2012-08-02 20:49:11Z emax $
@


1.11.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.11.2.1.2.2
log
@Switch importer
@
text
@d3 1
a3 1
# $FreeBSD: releng/9.0/etc/rc.d/ip6addrctl 212579 2010-09-13 19:55:40Z hrs $
@


1.10
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
@d22 1
d24 2
a25 1
set_rcvar_obsolete ipv6_enable ipv6_prefer
d58 6
a63 7
	if [ -f /etc/ip6addrctl.conf ]; then
		ip6addrctl flush >/dev/null 2>&1
		ip6addrctl install /etc/ip6addrctl.conf
		checkyesno ip6addrctl_verbose && ip6addrctl
	else
		if checkyesno ipv6_prefer; then
			ip6addrctl_prefer_ipv6
d65 5
a69 1
			ip6addrctl_prefer_ipv4
d71 21
a91 1
	fi
@


1.9
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
@d23 2
@


1.8
log
@SVN rev 197697 on 2009-10-02 02:24:25Z by hrs

- Add AF_IPX and AF_NATM to afexists().

- Add afexists() check to address family specific rc.d scripts.  A
  script for an AF will be silently ignored if the kernel has no
  support for the AF.
@
text
@a22 2
set_rcvar_obsolete ipv6_enable ipv6_prefer

@


1.7
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
@d12 1
d27 2
d40 2
d53 1
a53 2
	if ifconfig lo0 inet6 >/dev/null 2>&1; then
		# We have IPv6 support in kernel.
d55 8
a62 5
		# install the policy of the address selection algorithm.
		if [ -f /etc/ip6addrctl.conf ]; then
			ip6addrctl flush >/dev/null 2>&1
			ip6addrctl install /etc/ip6addrctl.conf
			checkyesno ip6addrctl_verbose && ip6addrctl
d64 1
a64 5
			if checkyesno ipv6_prefer; then
				ip6addrctl_prefer_ipv6
			else
				ip6addrctl_prefer_ipv4
			fi
d71 3
a73 4
	if ifconfig lo0 inet6 >/dev/null 2>&1; then
		# We have IPv6 support in kernel.
		ip6addrctl flush >/dev/null 2>&1
	fi
@


1.6
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
@d22 2
@


1.5
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
@d7 2
a8 2
# REQUIRE: FILESYSTEMS netif
# BEFORE: network_ipv6
d55 1
a55 1
			if checkyesno ipv6_enable; then
@


1.5.2.1
log
@SVN rev 231656 on 2012-02-14 10:17:30Z by dougb

MFC r230099:

Change rcvar= assignments to the literal values set_rcvar
would have returned. This will slightly reduce boot time,
and help in diff reduction to HEAD.
@
text
@d14 1
a14 1
rcvar="ip6addrctl_enable"
@


1.5.2.2
log
@Switch importer
@
text
@d3 1
a3 1
# $FreeBSD: stable/7/etc/rc.d/ip6addrctl 231656 2012-02-14 10:17:30Z dougb $
@


1.5.14.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.5.14.2
log
@Switch importer
@
text
@d3 1
a3 1
# $FreeBSD: releng/7.4/etc/rc.d/ip6addrctl 168283 2007-04-02 22:53:07Z des $
@


1.5.12.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.5.10.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.5.10.2
log
@SVN rev 231655 on 2012-02-14 10:17:14Z by dougb

MFC r230099:

Change rcvar= assignments to the literal values set_rcvar
would have returned. This will slightly reduce boot time,
and help in diff reduction to HEAD.
@
text
@d14 1
a14 1
rcvar="ip6addrctl_enable"
@


1.5.10.3
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
@d3 1
a3 1
# $FreeBSD: stable/8/etc/rc.d/ip6addrctl 231655 2012-02-14 10:17:14Z dougb $
@


1.5.10.4
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/246599
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d3 1
a3 1
# $FreeBSD: stable/8/etc/rc.d/ip6addrctl 246599 2013-02-09 18:00:29Z ume $
d25 5
a29 9
	ip6addrctl add ::1/128		 50	 0
	ip6addrctl add ::/0		 40	 1
	ip6addrctl add ::ffff:0:0/96	 35	 4
	ip6addrctl add 2002::/16	 30	 2
	ip6addrctl add 2001::/32	  5	 5
	ip6addrctl add fc00::/7		  3	13
	ip6addrctl add ::/96		  1	 3
	ip6addrctl add fec0::/10	  1	11
	ip6addrctl add 3ffe::/16	  1	12
d36 5
a40 9
	ip6addrctl add ::1/128		 50	 0
	ip6addrctl add ::/0		 40	 1
	ip6addrctl add ::ffff:0:0/96	100	 4
	ip6addrctl add 2002::/16	 30	 2
	ip6addrctl add 2001::/32	  5	 5
	ip6addrctl add fc00::/7		  3	13
	ip6addrctl add ::/96		  1	 3
	ip6addrctl add fec0::/10	  1	11
	ip6addrctl add 3ffe::/16	  1	12
@


1.5.10.2.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.5.10.2.2.2
log
@Switch importer
@
text
@d3 1
a3 1
# $FreeBSD: releng/8.3/etc/rc.d/ip6addrctl 231655 2012-02-14 10:17:14Z dougb $
@


1.5.10.1.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.5.10.1.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.5.10.1.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.5.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.5.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.4
log
@Remove the requirement for the FreeBSD keyword as it no longer
makes any sense.

Discussed with: dougb, brooks
MFC after: 3 days
@
text
@d7 1
a7 1
# REQUIRE: mountcritlocal netif
@


1.4.2.1
log
@MFC: add FILESYSTEMS
@
text
@d7 1
a7 1
# REQUIRE: FILESYSTEMS netif
@


1.4.2.2
log
@Switch importer
@
text
@d3 1
a3 1
# $FreeBSD: stable/6/etc/rc.d/ip6addrctl 169945 2007-05-24 16:14:37Z des $
@


1.4.2.1.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.3
log
@Add ip6addrctl_enable and ip6_addrctl_verbose option.  If
ip6addrctl_enable is set to YES, address selection policy is installed
into kernel.
If there is /etc/ip6addrctl.conf, it is used for address selection
policy.  Even if there is no /etc/ip6addrctl.conf, we install default
policy.  In this case, if ipv6_enable is set to YES, we use address
selection policy described in RFC 3484 as default.  Otherwise, we
install priority policy for IPv4 address.
The default of ip6addrctl_enable is NO for now.  However, it may
better to enable it by default.
@
text
@d9 1
a9 1
# KEYWORD: FreeBSD nojail
@


1.3.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
@d9 1
a9 1
# KEYWORD: nojail
@


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

Some suggestions from:	rwatson, Ruben de Groot <mail25@@bzerk.org>
@
text
@a11 1
. /etc/network.subr
d14 1
d16 27
a42 1
stop_cmd=':'
d53 7
a59 1
			ip6addrctl
d61 8
@


1.1
log
@install address selection policy into kernel when there is
/etc/ip6addrctl.conf.
following sample of ip6addrctl.conf is a good default:

#Prefix       Precedence Label
::1/128               50     0
::/0                  40     1
2002::/16             30     2
::/96                 20     3
::ffff:0:0/96         10     4
@
text
@d9 1
a9 1
# KEYWORD: FreeBSD
@

