Date: Sat, 4 May 2013 15:42:56 +0000 (UTC) From: Hiroki Sato <hrs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250240 - head/etc/rc.d Message-ID: <201305041542.r44FguPv031525@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hrs Date: Sat May 4 15:42:55 2013 New Revision: 250240 URL: http://svnweb.freebsd.org/changeset/base/250240 Log: - 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 [*] MFC after: 1 week Modified: head/etc/rc.d/ip6addrctl Modified: head/etc/rc.d/ip6addrctl ============================================================================== --- head/etc/rc.d/ip6addrctl Sat May 4 15:10:01 2013 (r250239) +++ head/etc/rc.d/ip6addrctl Sat May 4 15:42:55 2013 (r250240) @@ -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()
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305041542.r44FguPv031525>