diff options
author | hrs <hrs@FreeBSD.org> | 2009-10-02 02:24:25 +0000 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2009-10-02 02:24:25 +0000 |
commit | 415abdb87d0c125010f49ffd33750d1057f10e21 (patch) | |
tree | a1510915dc87f81737f2af15f6d1a1a8c4675af6 /etc/rc.d/ip6addrctl | |
parent | a1020b6c31d2177ae8780c7d352313ddec80e596 (diff) | |
download | FreeBSD-src-415abdb87d0c125010f49ffd33750d1057f10e21.zip FreeBSD-src-415abdb87d0c125010f49ffd33750d1057f10e21.tar.gz |
- Add AF_IPX and AF_NATM to afexists().
- Add afexists() check to address family specific rc.d scripts. A
script for an AF will be silently ignored if the kernel has no
support for the AF.
Diffstat (limited to 'etc/rc.d/ip6addrctl')
-rwxr-xr-x | etc/rc.d/ip6addrctl | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/etc/rc.d/ip6addrctl b/etc/rc.d/ip6addrctl index 66f1952..d3b1856 100755 --- a/etc/rc.d/ip6addrctl +++ b/etc/rc.d/ip6addrctl @@ -9,6 +9,7 @@ # KEYWORD: nojail . /etc/rc.subr +. /etc/network.subr name="ip6addrctl" rcvar=`set_rcvar` @@ -23,6 +24,8 @@ set_rcvar_obsolete ipv6_enable ipv6_prefer ip6addrctl_prefer_ipv6() { + afexists inet6 || return 0 + ip6addrctl flush >/dev/null 2>&1 ip6addrctl add ::1/128 50 0 ip6addrctl add ::/0 40 1 @@ -34,6 +37,8 @@ ip6addrctl_prefer_ipv6() ip6addrctl_prefer_ipv4() { + afexists inet6 || return 0 + ip6addrctl flush >/dev/null 2>&1 ip6addrctl add ::ffff:0:0/96 50 0 ip6addrctl add ::1/128 40 1 @@ -45,30 +50,27 @@ ip6addrctl_prefer_ipv4() ip6addrctl_start() { - if ifconfig lo0 inet6 >/dev/null 2>&1; then - # We have IPv6 support in kernel. + afexists inet6 || return 0 - # install the policy of the address selection algorithm. - if [ -f /etc/ip6addrctl.conf ]; then - ip6addrctl flush >/dev/null 2>&1 - ip6addrctl install /etc/ip6addrctl.conf - checkyesno ip6addrctl_verbose && ip6addrctl + # install the policy of the address selection algorithm. + if [ -f /etc/ip6addrctl.conf ]; then + ip6addrctl flush >/dev/null 2>&1 + ip6addrctl install /etc/ip6addrctl.conf + checkyesno ip6addrctl_verbose && ip6addrctl + else + if checkyesno ipv6_prefer; then + ip6addrctl_prefer_ipv6 else - if checkyesno ipv6_prefer; then - ip6addrctl_prefer_ipv6 - else - ip6addrctl_prefer_ipv4 - fi + ip6addrctl_prefer_ipv4 fi fi } ip6addrctl_stop() { - if ifconfig lo0 inet6 >/dev/null 2>&1; then - # We have IPv6 support in kernel. - ip6addrctl flush >/dev/null 2>&1 - fi + afexists inet6 || return 0 + + ip6addrctl flush >/dev/null 2>&1 } load_rc_config $name |