Un-obsolete'ing ipv6_enable

David Horn dhorn2000 at gmail.com
Fri Mar 12 04:59:47 UTC 2010


<snip> for brevity sake
>> dh> Question 2) Assuming that people do desire consistency with allowing
>> dh> for both a global, and a per-interface setting, do you agree with
>> dh> having a global default for DHCPv4 (dhcpv4_default_enable), and for
>> dh> IPv6 slaac/accept_rtadv  (ipv6-slaac_default_enable), and the
>> dh> per-interface DHCPv4 (ifconfig_IF0="dhcp") aka a meta configuration
>> dh> variable, and a per-interface IPv6 slaac (ifconfig_IF0="slaac") aka a
>> dh> meta configuration variable.
>>
>>  I think the global configuration can be realized by setting something
>>  like ifconfig_DEFAULT_<proto>="AUTO" instead of adding a new global
>>  knobs.
>
> Yes, that is certainly one method that can work.
>
> I will put together two review versions of a diff.  One with backward
> compatible logic included (at least for the ipv6_enable YES/NO cases,
> and the ipv6_ifconfig_IF syntax ), and one with the backwards compat
> code removed to further this discussion.
>
<snip>

OK, now I am certain I have looked at this far too long at the moment,
but here is a stab at a working diff (actually as promised, two diffs
against -current, one without backwards compatibility logic).

Background:

Historically (8.0-RELEASE and prior), there was a global rc.conf knob
for ipv6 (ipv6_enable, default="NO") that performed several functions:

a)  Enabled (or disabled) ipv6 link-local address for every interface
(auto_linklocal AND -ifdisabled)
b)  Enabled (or disabled) ipv6 SLAAC by default for every interface by
setting the global net.inet6.ip6.accept_rtadv=1 sysctl
c)  inherently specified utilization of a ipv6 address (AAAA) over an
ipv4 address (A) when both were available from a dns query when using
getaddrinfo()
d)  Others I can not think of at the moment ?

As well, there has always been a per-interface variable for IPv4 dhcp
(The pseudo-variable of "dhcp" on an ifconfig_IF rc.conf line), but no
global knob.

Now, I propose two new global variables:  ipv6_slaac_default_enable,
ipv4_dhcp_default_enable
and several new/updated per-interface pseudo variables: auto, noauto,
accept_rtadv, -accept_rtadv, slaac, noslaac, dhcp, nodhcp

Changelist:
1) New or updated global knob for interface configuration:
	ipv6_enable {global} = UNDEFINED/YES/NO, Default=UNDEFINED
		Old, depreciated knob for several ipv6 functions listed above (only
in backwards compatible version) Takes precedence over per-interface
setting (if it exists)
	ipv4_dhcp_default_enable {global} = YES/NO, Default=NO
		New, global knob for enabling any interface for dhcp by default that
does not have a per-interface configuration over-ride.
	ipv6_slaac_default_enable {global} =  YES/NO, Default=NO
		New, global knob for enabling any interface for ipv6 slaac by
default that does not have a per-interface configuration over-ride.
	ipv6_prefer {global} = YES/NO, Default=NO
		Removed overloading of ipv6_prefer to no longer mean default to
enable interface for ipv6 (-ifdisabled).  This global variable now
just effects rc.d/ip6addrctl behavior.  Under seperate cover, I am
proposing changing ipv6_prefer behavior to a more useful
autoconfigured default (if it can be done reliably) to eliminate the
need for the user to need to specify ipv6_prefer at all in most cases.
(Check for global ipv6 address assigned to an up interface) TBD.  Stay
tuned...

2) New or updated interface specific pseudo-variables for ifconfig_IF
and/or ifconfig_IF_ipv6:
	auto {interface-specific} = enable both IPv4 DHCP and IPv6 SLAAC
	noauto {interface-specific} =  no automatic boot-time configuration -
only slightly extended, as this already existed
	accept_rtadv {interface-specific} = enable SLACC via ipv6 router
advertisement Note: Also an ifconfig IF inet6 parameter
	-accept_rtadv {interface-specific} = disable SLAAC/ACCEPT_RTADV for
that interface Note: Also an ifconfig IF inet6 parameter
	slaac {interface-specific} = ALIAS for accept_rtadv, enable SLAAC via
ipv6 router advertisement
	noslaac {interface-specific} = ALIAS for -accept_rtadv, disable
SLAAC/ACCEPT_RTADV for that interface Note: Only really needed if
global ipv6_slaac_default_enable knob is on
	dhcp {interface-specific} = enable IPv4 DHCP - No change, just listed
for completeness sake
	nodhcp {interface-specific} = disable IPv4 DHCP Note: Only really
needed if global ipv4_dhcp_default_enable knob is on

3) On Backwards compatible version:
	ipv6_enable is UNDEFINED by default.
	If the user has ipv6_enable="NO" defined, this will now DISABLE ipv6
everywhere (just like it used to)
	If the user has ipv6_enable="YES" define, this will now ENABLE ipv6
everywhere (just like it used to)

4) Misc changes/fixes:
	Changed ifconfig_up() to use ipv6_autoconfif() rather than
re-checking some values for itself, and now allow
ifconfig_em0_ipv6="inet6 2001:db8::1" to work with AND without
user-specified "inet6", as it used to be implied, and most recently
was required, and is now optional.
	Changed ifalias_ipv6_[up|down]() to allow with and without user
specified "inet6", and to use the ifconfig_IF_ipv6_aliasX not
ifconfig_IF_aliasX,   I can revert this change, but then the "inet6"
component would be required.  After thinking about this, it is a toss
up.
	Change ipv6_network_interfaces to default to "AUTO" just like
network_interfaces (consistency is the theme)

I am perfectly happy with renaming any of these variable/pseudo
variable names to any consensus approved names, or adding/removing
aliases, etc.  No bikesheds allowed. ;)
If anyone requires, I guess I could remove the backwards compatible
logic, but add a new global variable for people that want all
interfaces disabled for ipv6 completely.

As well, I am open to looking at the ifconfig_DEFAULT /
ifconfig_DEFAULT_ipv6 syntax rather than adding
ipv6_slaac_default_enable and ipv4_dhcp_default_enable global knobs if
consensus concurs, but I think the FOO_enable syntax is probably more
desirable.  The only thing I am really shooting for is a consistant
set of knobs and behaviors (as much as is sensible), and to allow a
less complicated configuration set for ipv6 rc.conf moving forward.

Once there is consensus, I will take a stab at updating the man page
for rc.conf as well.

Examples:

Example 1:  enable IPv4 dhcp, and IPv6 slaac on the em0 interface
(which happens to be the only interface):

In 8.0-RELEASE this would be:

ifconfig_em0="dhcp"
ipv6_enable="YES"

Would now be any of the following (all four are functionally identical):

ifconfig_em0="auto"

or

ifconfig_em0="dhcp slaac"

or

ifconfig_em0="dhcp"
ifconfig_em0_ipv6="slaac"

or

ifconfig_em0="dhcp accept_rtadv"

As well, in the backwards compatible version:

ifconfig_em0="dhcp"
ipv6_enable="YES"

will still work.

Example 2:
           (wlan0)- enable IPv4 dhcp, and IPv6 link-local without slaac
           (bfe0)- disable IPv4 dhcp, and enable IPv6 slaac
	   (bfe1)- disable IPv4 dhcp, and enable IPv6 static eui64
	   (bfe2)- enable IPv4 static with no IPv6 link-local

In 8.0-RELEASE this would be not possible to disable ipv6 slaac on a
per-interface basis, so would require a custom startup script using
ndp to disable.  The rest of the configuration would be:

wlans_iwn0="wlan0"
ifconfig_wlan0="wpa dhcp"
ifconfig_bfe0="up"
ipv6_ifconfig_bfe1="2001:db8:1:: eui64"
ifconfig_bfe2="inet 192.168.1.50 netmask 255.255.255.0"
ipv6_enable="YES"

ndp script would be something like:
ndp -i wlan0 nud -accept_rtadv
ndp -i bfe2 disabled

Would now be:

wlans_iwn0="wlan0"
ifconfig_wlan0="wpa dhcp"
ifconfig_bfe0="slaac"
ifconfig_bfe1_ipv6="2001:db8:1:: eui64"
ifconfig_bfe2="inet 192.168.1.50 netmask 255.255.255.0"
ifconfig_bfe2_ipv6="ifdisabled"

I am still trying to track down one bug I have found in my testing
(related to ifconfig and eui64 when no link-local address has yet been
assigned to a down interface), and am still attempting to grok the
$_cfg usage in ifconfig_up(), and I still have several more test cases
to complete, but give it a spin (or read if you prefer), and let me
know if I have gone horribly off track.

As such, this is a work in progress.  Comments welcome.

--Thanks!

--Dave Horn
-------------- next part --------------
Index: etc/network.subr
===================================================================
--- etc/network.subr	(revision 205019)
+++ etc/network.subr	(working copy)
@@ -96,45 +96,47 @@
 	# inet6 specific
 	if afexists inet6; then
 		if ipv6if $1; then
-			if checkyesno ipv6_gateway_enable; then
+			if ipv6_autoconfif $1; then
+				_ipv6_opts="accept_rtadv"
+			else
 				_ipv6_opts="-accept_rtadv"
 			fi
-		else
-			if checkyesno ipv6_prefer; then
-				_ipv6_opts="-ifdisabled"
-			else
-				_ipv6_opts="ifdisabled"
+
+			# ifconfig_IF_ipv6
+			ifconfig_args=`ifconfig_getargs $1 ipv6`
+			if [ -n "${ifconfig_args}" ]; then
+				ifconfig $1 inet6 -ifdisabled
+				# Be nice to users (optional inet6)
+				case ${ifconfig_args} in
+					inet6\ *)
+						ifconfig $1 ${ifconfig_args}
+						;;
+					*)
+						ifconfig $1 inet6 \
+						 ${ifconfig_args}
+						;;
+				esac
+				_cfg=0
 			fi
 
-			# backward compatibility: $ipv6_enable
-			case $ipv6_enable in
-			[Yy][Ee][Ss])
-				_ipv6_opts="${_ipv6_opts} accept_rtadv"
-				;;
-			esac
+			# backward compatiblity: $ipv6_ifconfig_IF
+			ifconfig_args=`get_if_var $1 ipv6_ifconfig_IF`
+			if [ -n "${ifconfig_args}" ]; then
+				warn "\$ipv6_ifconfig_$1 is obsolete." \
+				    "  Use ifconfig_$1_ipv6 instead."
+				ifconfig $1 inet6 -ifdisabled
+				ifconfig $1 inet6 ${ifconfig_args}
+				_cfg=0
+			fi
+
+		else
+			_ipv6_opts="ifdisabled"
 		fi
 
 		if [ -n "${_ipv6_opts}" ]; then
 			ifconfig $1 inet6 ${_ipv6_opts}
 		fi
-
-		# ifconfig_IF_ipv6
-		ifconfig_args=`ifconfig_getargs $1 ipv6`
-		if [ -n "${ifconfig_args}" ]; then
-			ifconfig $1 inet6 -ifdisabled
-			ifconfig $1 ${ifconfig_args}
-			_cfg=0
-		fi
-
-		# backward compatiblity: $ipv6_ifconfig_IF
-		ifconfig_args=`get_if_var $1 ipv6_ifconfig_IF`
-		if [ -n "${ifconfig_args}" ]; then
-			warn "\$ipv6_ifconfig_$1 is obsolete." \
-			    "  Use ifconfig_$1_ipv6 instead."
-			ifconfig $1 inet6 -ifdisabled
-			ifconfig $1 inet6 ${ifconfig_args}
-			_cfg=0
-		fi
+		
 	fi
 
 	if [ ${_cfg} -eq 0 ]; then
@@ -244,11 +246,17 @@
 
 	for _arg in $_tmpargs; do
 		case $_arg in
+		[Aa][Uu][Tt][Oo]) ;;
+		[Aa][Cc][Cc][Ee][Pp][Tt]_[Rr][Tt][Aa][Dd][Vv]) ;;
 		[Dd][Hh][Cc][Pp]) ;;
 		[Nn][Oo][Aa][Uu][Tt][Oo]) ;;
+		[Nn][Oo][Dd][Hh][Cc][Pp]) ;;
+		[Nn][Oo][Ss][Ll][Aa][Aa][Cc]) ;;
 		[Nn][Oo][Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) ;;
 		[Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) ;;
+		[Ss][Ll][Aa][Aa][Cc]) ;;
 		[Ww][Pp][Aa]) ;;
+		-[Aa][Cc][Cc][Ee][Pp][Tt]_[Rr][Tt][Aa][Dd][Vv]) ;;
 		*)
 			_args="$_args $_arg"
 			;;
@@ -286,6 +294,12 @@
 
 	for _arg in $_tmpargs; do
 		case $_arg in
+		[Nn][Oo][Aa][Uu][Tt][Oo]|[Nn][Oo][Dd][Hh][Cc][Pp])
+			return 1
+			;;
+		[Aa][Uu][Tt][Oo])
+			return 0
+			;;
 		[Dd][Hh][Cc][Pp])
 			return 0
 			;;
@@ -298,6 +312,10 @@
 		esac
 	done
 
+	if checkyesno ipv4_dhcp_default_enable; then
+		return 0
+	fi
+
 	return 1
 }
 
@@ -410,6 +428,16 @@
 		return 1
 	fi
 
+	# backward compatibility: $ipv6_enable
+	case $ipv6_enable in
+	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+		return 0
+		;;
+	[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
+		return 1
+		;;
+	esac
+
 	# lo0 is always IPv6-enabled
 	case $_if in
 	lo0)
@@ -450,6 +478,7 @@
 # ipv6_autoconfif if
 #	Returns 0 if the interface should be configured for IPv6 with
 #	Stateless Address Configuration, 1 otherwise.
+#	Checks per-interface setting first, then global default
 ipv6_autoconfif()
 {
 	local _if _tmpargs _arg
@@ -483,30 +512,73 @@
 
 	# backward compatibility: $ipv6_enable
 	case $ipv6_enable in
-	[Yy][Ee][Ss])
+	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
 		return 0
 		;;
+	[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
+		return 1
+		;;
 	esac
 
 	_tmpargs=`_ifconfig_getargs $_if ipv6`
 	for _arg in $_tmpargs; do
 		case $_arg in
-		accept_rtadv)
+		[Nn][Oo][Aa][Uu][Tt][Oo]|[Nn][Oo][Ss][Ll][Aa][Aa][Cc])
+			return 1
+			;;
+		-[Aa][Cc][Cc][Ee][Pp][Tt]_[Rr][Tt][Aa][Dd][Vv])
+			return 1
+			;;
+		[Aa][Uu][Tt][Oo]|[Ss][Ll][Aa][Aa][Cc])
+ 			return 0
+ 			;;
+		[Aa][Cc][Cc][Ee][Pp][Tt]_[Rr][Tt][Aa][Dd][Vv])
 			return 0
 			;;
 		esac
 	done
+ 
+	_tmpargs=`_ifconfig_getargs $_if`
+        for _arg in $_tmpargs; do
+                case $_arg in
+		[Nn][Oo][Aa][Uu][Tt][Oo]|[Nn][Oo][Ss][Ll][Aa][Aa][Cc])
+			return 1
+			;;
+		-[Aa][Cc][Cc][Ee][Pp][Tt]_[Rr][Tt][Aa][Dd][Vv])
+			return 1
+			;;
+		[Aa][Uu][Tt][Oo]|[Ss][Ll][Aa][Aa][Cc])
+ 			return 0
+ 			;;
+		[Aa][Cc][Cc][Ee][Pp][Tt]_[Rr][Tt][Aa][Dd][Vv])
+			return 0
+			;;
+		esac
+        done
 
-	# backward compatibility: $ipv6_ifconfig_IF
-	_tmpargs=`get_if_var $_if ipv6_ifconfig_IF`
-	for _arg in $_tmpargs; do
-		case $_arg in
-		accept_rtadv)
+ 	# backward compatibility: $ipv6_ifconfig_IF
+ 	_tmpargs=`get_if_var $_if ipv6_ifconfig_IF`
+ 	for _arg in $_tmpargs; do
+ 		case $_arg in
+		[Nn][Oo][Aa][Uu][Tt][Oo]|[Nn][Oo][Ss][Ll][Aa][Aa][Cc])
+			return 1
+			;;
+		-[Aa][Cc][Cc][Ee][Pp][Tt]_[Rr][Tt][Aa][Dd][Vv])
+			return 1
+			;;
+		[Aa][Uu][Tt][Oo]|[Ss][Ll][Aa][Aa][Cc])
+ 			return 0
+ 			;;
+		[Aa][Cc][Cc][Ee][Pp][Tt]_[Rr][Tt][Aa][Dd][Vv])
 			return 0
 			;;
 		esac
 	done
 
+	if checkyesno ipv6_slaac_default_enable; then
+		return 0
+	fi
+	
 	return 1
 }
 
@@ -543,7 +615,6 @@
 	if ! ipv6if $_if; then
 		return 0
 	fi
-
 	ifalias_up ${_if} inet6 && _ret=0
 	ipv6_prefix_hostid_addr_up ${_if} && _ret=0
 	ipv6_accept_rtadv_up ${_if} && _ret=0
@@ -725,12 +796,16 @@
 	# ifconfig_IF_aliasN which starts with "inet6"
 	alias=0
 	while : ; do
-		ifconfig_args=`get_if_var $1 ifconfig_IF_alias${alias}`
+		ifconfig_args=`get_if_var $1 ifconfig_IF_ipv6_alias${alias}`
 		case "${ifconfig_args}" in
+		"")
+			break
+			;;
 		inet6\ *)
 			ifconfig $1 ${ifconfig_args} alias && _ret=0
 			;;
-		"")
+		*)
+			ifconfig $1 inet6 ${ifconfig_args} alias && _ret=0
 			break
 			;;
 		esac
@@ -816,13 +891,16 @@
 	# ifconfig_IF_aliasN which starts with "inet6"
 	alias=0
 	while : ; do
-		ifconfig_args=`get_if_var $1 ifconfig_IF_alias${alias}`
+		ifconfig_args=`get_if_var $1 ifconfig_IF_ipv6_alias${alias}`
 		case "${ifconfig_args}" in
+		"")
+			break
+			;;
 		inet6\ *)
 			ifconfig $1 ${ifconfig_args} -alias && _ret=0
 			;;
-		"")
-			break
+		*)
+			ifconfig $1 inet6 ${ifconfig_args} -alias && _ret=0
 			;;
 		esac
 		alias=$((${alias} + 1))
Index: etc/defaults/rc.conf
===================================================================
--- etc/defaults/rc.conf	(revision 205019)
+++ etc/defaults/rc.conf	(working copy)
@@ -158,6 +158,8 @@
 dummynet_enable="NO"		# Load the dummynet(4) module
 ip_portrange_first="NO"		# Set first dynamically allocated port
 ip_portrange_last="NO"		# Set last dynamically allocated port
+ipv4_dhcp_default_enable="NO"	# Set to YES to default all interfaces
+				# to automatically use DHCP for IPv4
 ike_enable="NO"			# Enable IKE daemon (usually racoon or isakmpd)
 ike_program="/usr/local/sbin/isakmpd"	# Path to IKE daemon
 ike_flags=""			# Additional flags for IKE daemon
@@ -439,8 +441,10 @@
 icmp_bmcastecho="NO"	# respond to broadcast ping packets
 
 ### IPv6 options: ###
-ipv6_network_interfaces="none"	# List of IPv6 network interfaces
+ipv6_network_interfaces="auto"	# List of IPv6 network interfaces
 				# (or "auto" or "none").
+ipv6_slaac_default_enable="NO"  # Set to YES to enable IPv6 SLAAC/accept_rtadv
+				# on all interfaces by default
 ipv6_defaultrouter="NO"		# Set to IPv6 default gateway (or NO).
 #ipv6_defaultrouter="2002:c058:6301::"	# Use this for 6to4 (RFC 3068)
 ipv6_static_routes=""		# Set to static route list (or leave empty).
-------------- next part --------------
Index: etc/network.subr
===================================================================
--- etc/network.subr	(revision 205019)
+++ etc/network.subr	(working copy)
@@ -96,45 +96,37 @@
 	# inet6 specific
 	if afexists inet6; then
 		if ipv6if $1; then
-			if checkyesno ipv6_gateway_enable; then
+			if ipv6_autoconfif $1; then
+				_ipv6_opts="accept_rtadv"
+			else
 				_ipv6_opts="-accept_rtadv"
 			fi
-		else
-			if checkyesno ipv6_prefer; then
-				_ipv6_opts="-ifdisabled"
-			else
-				_ipv6_opts="ifdisabled"
+
+			# ifconfig_IF_ipv6
+			ifconfig_args=`ifconfig_getargs $1 ipv6`
+			if [ -n "${ifconfig_args}" ]; then
+				ifconfig $1 inet6 -ifdisabled
+				# Be nice to users (optional inet6)
+				case ${ifconfig_args} in
+					inet6\ *)
+						ifconfig $1 ${ifconfig_args}
+						;;
+					*)
+						ifconfig $1 inet6 \
+						 ${ifconfig_args}
+						;;
+				esac
+				_cfg=0
 			fi
 
-			# backward compatibility: $ipv6_enable
-			case $ipv6_enable in
-			[Yy][Ee][Ss])
-				_ipv6_opts="${_ipv6_opts} accept_rtadv"
-				;;
-			esac
+		else
+			_ipv6_opts="ifdisabled"
 		fi
 
 		if [ -n "${_ipv6_opts}" ]; then
 			ifconfig $1 inet6 ${_ipv6_opts}
 		fi
-
-		# ifconfig_IF_ipv6
-		ifconfig_args=`ifconfig_getargs $1 ipv6`
-		if [ -n "${ifconfig_args}" ]; then
-			ifconfig $1 inet6 -ifdisabled
-			ifconfig $1 ${ifconfig_args}
-			_cfg=0
-		fi
-
-		# backward compatiblity: $ipv6_ifconfig_IF
-		ifconfig_args=`get_if_var $1 ipv6_ifconfig_IF`
-		if [ -n "${ifconfig_args}" ]; then
-			warn "\$ipv6_ifconfig_$1 is obsolete." \
-			    "  Use ifconfig_$1_ipv6 instead."
-			ifconfig $1 inet6 -ifdisabled
-			ifconfig $1 inet6 ${ifconfig_args}
-			_cfg=0
-		fi
+		
 	fi
 
 	if [ ${_cfg} -eq 0 ]; then
@@ -244,11 +236,17 @@
 
 	for _arg in $_tmpargs; do
 		case $_arg in
+		[Aa][Uu][Tt][Oo]) ;;
+		[Aa][Cc][Cc][Ee][Pp][Tt]_[Rr][Tt][Aa][Dd][Vv]) ;;
 		[Dd][Hh][Cc][Pp]) ;;
 		[Nn][Oo][Aa][Uu][Tt][Oo]) ;;
+		[Nn][Oo][Dd][Hh][Cc][Pp]) ;;
+		[Nn][Oo][Ss][Ll][Aa][Aa][Cc]) ;;
 		[Nn][Oo][Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) ;;
 		[Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) ;;
+		[Ss][Ll][Aa][Aa][Cc]) ;;
 		[Ww][Pp][Aa]) ;;
+		-[Aa][Cc][Cc][Ee][Pp][Tt]_[Rr][Tt][Aa][Dd][Vv]) ;;
 		*)
 			_args="$_args $_arg"
 			;;
@@ -286,6 +284,12 @@
 
 	for _arg in $_tmpargs; do
 		case $_arg in
+		[Nn][Oo][Aa][Uu][Tt][Oo]|[Nn][Oo][Dd][Hh][Cc][Pp])
+			return 1
+			;;
+		[Aa][Uu][Tt][Oo])
+			return 0
+			;;
 		[Dd][Hh][Cc][Pp])
 			return 0
 			;;
@@ -298,6 +302,10 @@
 		esac
 	done
 
+	if checkyesno ipv4_dhcp_default_enable; then
+		return 0
+	fi
+
 	return 1
 }
 
@@ -423,12 +431,6 @@
 		return 0
 	fi
 
-	# backward compatibility: True if $ipv6_ifconfig_IF is defined.
-	_tmpargs=`get_if_var $_if ipv6_ifconfig_IF`
-	if [ -n "${_tmpargs}" ]; then
-		return 0
-	fi
-
 	case "${ipv6_network_interfaces}" in
 	[Aa][Uu][Tt][Oo])
 		return 0
@@ -450,6 +452,7 @@
 # ipv6_autoconfif if
 #	Returns 0 if the interface should be configured for IPv6 with
 #	Stateless Address Configuration, 1 otherwise.
+#	Checks per-interface setting first, then global default
 ipv6_autoconfif()
 {
 	local _if _tmpargs _arg
@@ -481,32 +484,46 @@
 		;;
 	esac
 
-	# backward compatibility: $ipv6_enable
-	case $ipv6_enable in
-	[Yy][Ee][Ss])
-		return 0
-		;;
-	esac
-
 	_tmpargs=`_ifconfig_getargs $_if ipv6`
 	for _arg in $_tmpargs; do
 		case $_arg in
-		accept_rtadv)
+		[Nn][Oo][Aa][Uu][Tt][Oo]|[Nn][Oo][Ss][Ll][Aa][Aa][Cc])
+			return 1
+			;;
+		-[Aa][Cc][Cc][Ee][Pp][Tt]_[Rr][Tt][Aa][Dd][Vv])
+			return 1
+			;;
+		[Aa][Uu][Tt][Oo]|[Ss][Ll][Aa][Aa][Cc])
+ 			return 0
+ 			;;
+		[Aa][Cc][Cc][Ee][Pp][Tt]_[Rr][Tt][Aa][Dd][Vv])
 			return 0
 			;;
 		esac
 	done
-
-	# backward compatibility: $ipv6_ifconfig_IF
-	_tmpargs=`get_if_var $_if ipv6_ifconfig_IF`
-	for _arg in $_tmpargs; do
-		case $_arg in
-		accept_rtadv)
+ 
+	_tmpargs=`_ifconfig_getargs $_if`
+        for _arg in $_tmpargs; do
+                case $_arg in
+		[Nn][Oo][Aa][Uu][Tt][Oo]|[Nn][Oo][Ss][Ll][Aa][Aa][Cc])
+			return 1
+			;;
+		-[Aa][Cc][Cc][Ee][Pp][Tt]_[Rr][Tt][Aa][Dd][Vv])
+			return 1
+			;;
+		[Aa][Uu][Tt][Oo]|[Ss][Ll][Aa][Aa][Cc])
+ 			return 0
+ 			;;
+		[Aa][Cc][Cc][Ee][Pp][Tt]_[Rr][Tt][Aa][Dd][Vv])
 			return 0
 			;;
 		esac
-	done
+        done
 
+	if checkyesno ipv6_slaac_default_enable; then
+		return 0
+	fi
+	
 	return 1
 }
 
@@ -543,7 +560,6 @@
 	if ! ipv6if $_if; then
 		return 0
 	fi
-
 	ifalias_up ${_if} inet6 && _ret=0
 	ipv6_prefix_hostid_addr_up ${_if} && _ret=0
 	ipv6_accept_rtadv_up ${_if} && _ret=0
@@ -725,30 +741,17 @@
 	# ifconfig_IF_aliasN which starts with "inet6"
 	alias=0
 	while : ; do
-		ifconfig_args=`get_if_var $1 ifconfig_IF_alias${alias}`
+		ifconfig_args=`get_if_var $1 ifconfig_IF_ipv6_alias${alias}`
 		case "${ifconfig_args}" in
-		inet6\ *)
-			ifconfig $1 ${ifconfig_args} alias && _ret=0
-			;;
 		"")
 			break
 			;;
-		esac
-		alias=$((${alias} + 1))
-	done
-
-	# backward compatibility: ipv6_ifconfig_IF_aliasN.
-	alias=0
-	while : ; do
-		ifconfig_args=`get_if_var $1 ipv6_ifconfig_IF_alias${alias}`
-		case "${ifconfig_args}" in
-		"")
-			break
+		inet6\ *)
+			ifconfig $1 ${ifconfig_args} alias && _ret=0
 			;;
 		*)
 			ifconfig $1 inet6 ${ifconfig_args} alias && _ret=0
-			warn "\$ipv6_ifconfig_$1_alias${alias} is obsolete." \
-			    "  Use ifconfig_$1_aliasN instead."
+			break
 			;;
 		esac
 		alias=$((${alias} + 1))
@@ -816,30 +819,16 @@
 	# ifconfig_IF_aliasN which starts with "inet6"
 	alias=0
 	while : ; do
-		ifconfig_args=`get_if_var $1 ifconfig_IF_alias${alias}`
+		ifconfig_args=`get_if_var $1 ifconfig_IF_ipv6_alias${alias}`
 		case "${ifconfig_args}" in
-		inet6\ *)
-			ifconfig $1 ${ifconfig_args} -alias && _ret=0
-			;;
 		"")
 			break
 			;;
-		esac
-		alias=$((${alias} + 1))
-	done
-
-	# backward compatibility: ipv6_ifconfig_IF_aliasN.
-	alias=0
-	while : ; do
-		ifconfig_args=`get_if_var $1 ipv6_ifconfig_IF_alias${alias}`
-		case "${ifconfig_args}" in
-		"")
-			break
+		inet6\ *)
+			ifconfig $1 ${ifconfig_args} -alias && _ret=0
 			;;
 		*)
 			ifconfig $1 inet6 ${ifconfig_args} -alias && _ret=0
-			warn "\$ipv6_ifconfig_$1_alias${alias} is obsolete." \
-			    "  Use ifconfig_$1_aliasN instead."
 			;;
 		esac
 		alias=$((${alias} + 1))
Index: etc/rc.d/netif
===================================================================
--- etc/rc.d/netif	(revision 205019)
+++ etc/rc.d/netif	(working copy)
@@ -41,8 +41,6 @@
 extra_commands="cloneup clonedown"
 cmdifn=
 
-set_rcvar_obsolete ipv6_enable ipv6_prefer
-
 network_start()
 {
 	# Set the list of interfaces to work on.
Index: etc/rc.d/ip6addrctl
===================================================================
--- etc/rc.d/ip6addrctl	(revision 205019)
+++ etc/rc.d/ip6addrctl	(working copy)
@@ -20,8 +20,6 @@
 prefer_ipv6_cmd="ip6addrctl_prefer_ipv6"
 prefer_ipv4_cmd="ip6addrctl_prefer_ipv4"
 
-set_rcvar_obsolete ipv6_enable ipv6_prefer
-
 ip6addrctl_prefer_ipv6()
 {
 	afexists inet6 || return 0
Index: etc/defaults/rc.conf
===================================================================
--- etc/defaults/rc.conf	(revision 205019)
+++ etc/defaults/rc.conf	(working copy)
@@ -158,6 +158,8 @@
 dummynet_enable="NO"		# Load the dummynet(4) module
 ip_portrange_first="NO"		# Set first dynamically allocated port
 ip_portrange_last="NO"		# Set last dynamically allocated port
+ipv4_dhcp_default_enable="NO"	# Set to YES to default all interfaces
+				# to automatically use DHCP for IPv4
 ike_enable="NO"			# Enable IKE daemon (usually racoon or isakmpd)
 ike_program="/usr/local/sbin/isakmpd"	# Path to IKE daemon
 ike_flags=""			# Additional flags for IKE daemon
@@ -439,8 +441,10 @@
 icmp_bmcastecho="NO"	# respond to broadcast ping packets
 
 ### IPv6 options: ###
-ipv6_network_interfaces="none"	# List of IPv6 network interfaces
+ipv6_network_interfaces="auto"	# List of IPv6 network interfaces
 				# (or "auto" or "none").
+ipv6_slaac_default_enable="NO"  # Set to YES to enable IPv6 SLAAC/accept_rtadv
+				# on all interfaces by default
 ipv6_defaultrouter="NO"		# Set to IPv6 default gateway (or NO).
 #ipv6_defaultrouter="2002:c058:6301::"	# Use this for 6to4 (RFC 3068)
 ipv6_static_routes=""		# Set to static route list (or leave empty).


More information about the freebsd-net mailing list