svn commit: r250524 - stable/9/etc/rc.d
Hiroki Sato
hrs at FreeBSD.org
Sat May 11 19:11:21 UTC 2013
Author: hrs
Date: Sat May 11 19:11:20 2013
New Revision: 250524
URL: http://svnweb.freebsd.org/changeset/base/250524
Log:
MFC r250240:
- Fix exit status when ip6addrctl_verbose=yes [*]
- Use the absolute pathname for ip6addrctl.
- Use "install" instead of "add" to reduce the number of invocations.
Reported by: Tatsuki Makino [*]
PR: conf/175006 [*]
Modified:
stable/9/etc/rc.d/ip6addrctl
Directory Properties:
stable/9/etc/rc.d/ (props changed)
Modified: stable/9/etc/rc.d/ip6addrctl
==============================================================================
--- stable/9/etc/rc.d/ip6addrctl Sat May 11 19:05:38 2013 (r250523)
+++ stable/9/etc/rc.d/ip6addrctl Sat May 11 19:11:20 2013 (r250524)
@@ -24,38 +24,42 @@ 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 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_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 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_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()
@@ -66,9 +70,8 @@ ip6addrctl_start()
case "${ip6addrctl_policy}" in
[Aa][Uu][Tt][Oo])
if [ -r "${config_file}" -a -s "${config_file}" ]; then
- ip6addrctl flush >/dev/null 2>&1
- ip6addrctl install "${config_file}"
- checkyesno ip6addrctl_verbose && ip6addrctl
+ ${IP6ADDRCTL_CMD} flush >/dev/null 2>&1
+ ${IP6ADDRCTL_CMD} install "${config_file}"
else
if checkyesno ipv6_activate_all_interfaces; then
ip6addrctl_prefer_ipv6
@@ -92,7 +95,7 @@ ip6addrctl_start()
ip6addrctl_prefer_ipv4
;;
[Nn][Oo][Nn][Ee])
- ip6addrctl flush >/dev/null 2>&1
+ ${IP6ADDRCTL_CMD} flush >/dev/null 2>&1
;;
*)
warn "\$ip6addrctl_policy is invalid: ${ip6addrctl_policy}. " \
@@ -100,6 +103,11 @@ ip6addrctl_start()
ip6addrctl_prefer_ipv4
;;
esac
+
+ if checkyesno ip6addrctl_verbose; then
+ echo 'Address selection policy table for IPv4 and IPv6:'
+ ${IP6ADDRCTL_CMD}
+ fi
}
ip6addrctl_stop()
More information about the svn-src-stable
mailing list