8aa4c57946
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.
76 lines
1.4 KiB
Bash
Executable File
76 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: ip6addrctl
|
|
# REQUIRE: FILESYSTEMS
|
|
# BEFORE: netif
|
|
# KEYWORD: nojail
|
|
|
|
. /etc/rc.subr
|
|
. /etc/network.subr
|
|
|
|
name="ip6addrctl"
|
|
rcvar=`set_rcvar`
|
|
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()
|
|
{
|
|
afexists inet6 || return 0
|
|
|
|
ip6addrctl flush >/dev/null 2>&1
|
|
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
|
|
checkyesno ip6addrctl_verbose && ip6addrctl
|
|
}
|
|
|
|
ip6addrctl_prefer_ipv4()
|
|
{
|
|
afexists inet6 || return 0
|
|
|
|
ip6addrctl flush >/dev/null 2>&1
|
|
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
|
|
checkyesno ip6addrctl_verbose && ip6addrctl
|
|
}
|
|
|
|
ip6addrctl_start()
|
|
{
|
|
afexists inet6 || return 0
|
|
|
|
# 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_prefer; then
|
|
ip6addrctl_prefer_ipv6
|
|
else
|
|
ip6addrctl_prefer_ipv4
|
|
fi
|
|
fi
|
|
}
|
|
|
|
ip6addrctl_stop()
|
|
{
|
|
afexists inet6 || return 0
|
|
|
|
ip6addrctl flush >/dev/null 2>&1
|
|
}
|
|
|
|
load_rc_config $name
|
|
run_rc_command "$1"
|