diff options
author | ume <ume@FreeBSD.org> | 2004-06-02 09:39:49 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2004-06-02 09:39:49 +0000 |
commit | 3203ab45377d894fbdac54576bd26f8e3f1fee5b (patch) | |
tree | b042dac5fca155fe7eee90481eaa6eb68c487e51 /etc | |
parent | 85f8b889c52bdacc53608fad651b73260d4180f4 (diff) | |
download | FreeBSD-src-3203ab45377d894fbdac54576bd26f8e3f1fee5b.zip FreeBSD-src-3203ab45377d894fbdac54576bd26f8e3f1fee5b.tar.gz |
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.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/defaults/rc.conf | 2 | ||||
-rw-r--r-- | etc/rc.d/ip6addrctl | 46 |
2 files changed, 45 insertions, 3 deletions
diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf index f5b3d33..eaf0bb5 100644 --- a/etc/defaults/rc.conf +++ b/etc/defaults/rc.conf @@ -340,6 +340,8 @@ ipv6_firewall_flags="" # Flags passed to ip6fw when type is a file ipv6_ipfilter_rules="/etc/ipf6.rules" # rules definition file for ipfilter, # see /usr/src/contrib/ipfilter/rules # for examples +ip6addrctl_enable="NO" # Set to NO to disable default address selection +ip6addrctl_verbose="NO" # Set to YES to enable verbose configuration messages ############################################################## ### System console options ################################# diff --git a/etc/rc.d/ip6addrctl b/etc/rc.d/ip6addrctl index 4f9bc5c..552c19c 100644 --- a/etc/rc.d/ip6addrctl +++ b/etc/rc.d/ip6addrctl @@ -9,11 +9,37 @@ # KEYWORD: FreeBSD nojail . /etc/rc.subr -. /etc/network.subr name="ip6addrctl" +rcvar=`set_rcvar` start_cmd="ip6addrctl_start" -stop_cmd=':' +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 2002::/16 30 2 + ip6addrctl add ::/96 20 3 + ip6addrctl add ::ffff:0:0/96 10 4 + checkyesno ip6addrctl_verbose && ip6addrctl +} + +ip6addrctl_prefer_ipv4() +{ + 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() { @@ -24,10 +50,24 @@ ip6addrctl_start() if [ -f /etc/ip6addrctl.conf ]; then ip6addrctl flush >/dev/null 2>&1 ip6addrctl install /etc/ip6addrctl.conf - ip6addrctl + 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" |