ip6addrctl (212574) | ip6addrctl (212579) |
---|---|
1#!/bin/sh 2# | 1#!/bin/sh 2# |
3# $FreeBSD: head/etc/rc.d/ip6addrctl 212574 2010-09-13 19:51:15Z hrs $ | 3# $FreeBSD: head/etc/rc.d/ip6addrctl 212579 2010-09-13 19:55:40Z hrs $ |
4# 5 6# PROVIDE: ip6addrctl 7# REQUIRE: FILESYSTEMS 8# BEFORE: netif 9# KEYWORD: nojail 10 11. /etc/rc.subr 12. /etc/network.subr 13 14name="ip6addrctl" 15rcvar=`set_rcvar` 16start_cmd="ip6addrctl_start" 17stop_cmd="ip6addrctl_stop" 18extra_commands="status prefer_ipv6 prefer_ipv4" 19status_cmd="ip6addrctl" 20prefer_ipv6_cmd="ip6addrctl_prefer_ipv6" 21prefer_ipv4_cmd="ip6addrctl_prefer_ipv4" | 4# 5 6# PROVIDE: ip6addrctl 7# REQUIRE: FILESYSTEMS 8# BEFORE: netif 9# KEYWORD: nojail 10 11. /etc/rc.subr 12. /etc/network.subr 13 14name="ip6addrctl" 15rcvar=`set_rcvar` 16start_cmd="ip6addrctl_start" 17stop_cmd="ip6addrctl_stop" 18extra_commands="status prefer_ipv6 prefer_ipv4" 19status_cmd="ip6addrctl" 20prefer_ipv6_cmd="ip6addrctl_prefer_ipv6" 21prefer_ipv4_cmd="ip6addrctl_prefer_ipv4" |
22config_file="/etc/ip6addrctl.conf" |
|
22 | 23 |
23set_rcvar_obsolete ipv6_enable ipv6_prefer | 24set_rcvar_obsolete ipv6_enable ipv6_activate_all_interfaces 25set_rcvar_obsolete ipv6_prefer ip6addrctl_policy |
24 25ip6addrctl_prefer_ipv6() 26{ 27 afexists inet6 || return 0 28 29 ip6addrctl flush >/dev/null 2>&1 30 ip6addrctl add ::1/128 50 0 31 ip6addrctl add ::/0 40 1 --- 16 unchanged lines hidden (view full) --- 48 checkyesno ip6addrctl_verbose && ip6addrctl 49} 50 51ip6addrctl_start() 52{ 53 afexists inet6 || return 0 54 55 # install the policy of the address selection algorithm. | 26 27ip6addrctl_prefer_ipv6() 28{ 29 afexists inet6 || return 0 30 31 ip6addrctl flush >/dev/null 2>&1 32 ip6addrctl add ::1/128 50 0 33 ip6addrctl add ::/0 40 1 --- 16 unchanged lines hidden (view full) --- 50 checkyesno ip6addrctl_verbose && ip6addrctl 51} 52 53ip6addrctl_start() 54{ 55 afexists inet6 || return 0 56 57 # install the policy of the address selection algorithm. |
56 if [ -f /etc/ip6addrctl.conf ]; then 57 ip6addrctl flush >/dev/null 2>&1 58 ip6addrctl install /etc/ip6addrctl.conf 59 checkyesno ip6addrctl_verbose && ip6addrctl 60 else 61 if checkyesno ipv6_prefer; then 62 ip6addrctl_prefer_ipv6 | 58 case "${ip6addrctl_policy}" in 59 [Aa][Uu][Tt][Oo]) 60 if [ -r "${config_file}" -a -s "${config_file}" ]; then 61 ip6addrctl flush >/dev/null 2>&1 62 ip6addrctl install "${config_file}" 63 checkyesno ip6addrctl_verbose && ip6addrctl |
63 else | 64 else |
64 ip6addrctl_prefer_ipv4 | 65 if checkyesno ipv6_activate_all_interfaces; then 66 ip6addrctl_prefer_ipv6 67 else 68 ip6addrctl_prefer_ipv4 69 fi |
65 fi | 70 fi |
66 fi | 71 ;; 72 ipv4_prefer) 73 ip6addrctl_prefer_ipv4 74 ;; 75 ipv6_prefer) 76 ip6addrctl_prefer_ipv6 77 ;; 78 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) 79 # Backward compatibility when ipv6_prefer=YES 80 ip6addrctl_prefer_ipv6 81 ;; 82 [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) 83 # Backward compatibility when ipv6_prefer=NO 84 ip6addrctl_prefer_ipv4 85 ;; 86 *) 87 warn "\$ip6addrctl_policy is invalid: ${ip6addrctl_policy}. " \ 88 " \"ipv4_prefer\" is used instead." 89 ip6addrctl_prefer_ipv4 90 ;; 91 esac |
67} 68 69ip6addrctl_stop() 70{ 71 afexists inet6 || return 0 72 73 ip6addrctl flush >/dev/null 2>&1 74} 75 76load_rc_config $name 77run_rc_command "$1" | 92} 93 94ip6addrctl_stop() 95{ 96 afexists inet6 || return 0 97 98 ip6addrctl flush >/dev/null 2>&1 99} 100 101load_rc_config $name 102run_rc_command "$1" |