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
78 elif [ -n "$(list_vars ifconfig_\*_ipv6)" ]; then
79 ip6addrctl_prefer_ipv6
81 ip6addrctl_prefer_ipv4
86 ip6addrctl_prefer_ipv4
89 ip6addrctl_prefer_ipv6
91 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
92 # Backward compatibility when ipv6_prefer=YES
93 ip6addrctl_prefer_ipv6
95 [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
96 # Backward compatibility when ipv6_prefer=NO
97 ip6addrctl_prefer_ipv4
100 ${IP6ADDRCTL_CMD} flush >/dev/null 2>&1
103 warn "\$ip6addrctl_policy is invalid: ${ip6addrctl_policy}. " \
104 " \"ipv4_prefer\" is used instead."
105 ip6addrctl_prefer_ipv4
109 if checkyesno ip6addrctl_verbose; then
110 echo 'Address selection policy table for IPv4 and IPv6:'
117 afexists inet6 || return 0
119 ip6addrctl flush >/dev/null 2>&1