15 rcvar="ip6addrctl_enable"
16 start_cmd="ip6addrctl_start"
17 stop_cmd="ip6addrctl_stop"
18 extra_commands="status prefer_ipv6 prefer_ipv4"
19 status_cmd="ip6addrctl"
20 prefer_ipv6_cmd="ip6addrctl_prefer_ipv6"
21 prefer_ipv4_cmd="ip6addrctl_prefer_ipv4"
22 config_file="/etc/ip6addrctl.conf"
24 set_rcvar_obsolete ipv6_enable ipv6_activate_all_interfaces
25 set_rcvar_obsolete ipv6_prefer ip6addrctl_policy
27 IP6ADDRCTL_CMD="/usr/sbin/ip6addrctl"
29 ip6addrctl_prefer_ipv6()
31 afexists inet6 || return 0
33 ${IP6ADDRCTL_CMD} flush >/dev/null 2>&1
34 cat <<EOT | ${IP6ADDRCTL_CMD} install /dev/stdin
47 ip6addrctl_prefer_ipv4()
49 afexists inet6 || return 0
51 ${IP6ADDRCTL_CMD} flush >/dev/null 2>&1
52 cat <<EOT | ${IP6ADDRCTL_CMD} install /dev/stdin
67 afexists inet6 || return 0
69 # install the policy of the address selection algorithm.
70 case "${ip6addrctl_policy}" in
72 if [ -r "${config_file}" -a -s "${config_file}" ]; then
73 ${IP6ADDRCTL_CMD} flush >/dev/null 2>&1
74 ${IP6ADDRCTL_CMD} install "${config_file}"
76 if checkyesno ipv6_activate_all_interfaces; then
77 ip6addrctl_prefer_ipv6
79 ip6addrctl_prefer_ipv4
84 ip6addrctl_prefer_ipv4
87 ip6addrctl_prefer_ipv6
89 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
90 # Backward compatibility when ipv6_prefer=YES
91 ip6addrctl_prefer_ipv6
93 [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
94 # Backward compatibility when ipv6_prefer=NO
95 ip6addrctl_prefer_ipv4
98 ${IP6ADDRCTL_CMD} flush >/dev/null 2>&1
101 warn "\$ip6addrctl_policy is invalid: ${ip6addrctl_policy}. " \
102 " \"ipv4_prefer\" is used instead."
103 ip6addrctl_prefer_ipv4
107 if checkyesno ip6addrctl_verbose; then
108 echo 'Address selection policy table for IPv4 and IPv6:'
115 afexists inet6 || return 0
117 ip6addrctl flush >/dev/null 2>&1