- 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.
This commit is contained in:
Hiroki Sato 2009-10-02 02:24:25 +00:00
parent b4a22c365c
commit b558571de6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=197697
6 changed files with 43 additions and 16 deletions

View File

@ -356,6 +356,16 @@ afexists()
inet6)
${SYSCTL_N} net.inet6 > /dev/null 2>&1
;;
ipx)
${SYSCTL_N} net.ipx > /dev/null 2>&1
;;
atm)
if [ -x /sbin/atmconfig ]; then
/sbin/atmconfig diag list > /dev/null 2>&1
else
return 1
fi
;;
*)
err 1 "afexists(): Unsupported address family: $_af"
;;

View File

@ -20,6 +20,8 @@ defaultroute_start()
{
local output carrier nocarrier nl
afexists inet || return 0
# Return without waiting if we don't have dhcp interfaces or
# if none of the dhcp interfaces is plugged in.
dhcp_interfaces=`list_net_interfaces dhcp`

View File

@ -15,6 +15,8 @@ stop_cmd="faith_down"
faith_up()
{
afexists inet6 || return 0
case ${ipv6_faith_prefix} in
[Nn][Oo] | '')
;;
@ -48,6 +50,8 @@ faith_up()
faith_down()
{
afexists inet6 || return 0
echo "Removing IPv6-to-IPv4 TCP relay capturing interface: faith0."
ifconfig faith0 destroy
${SYSCTL_W} net.inet6.ip6.keepfaith=0

View File

@ -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

View File

@ -34,6 +34,7 @@
# KEYWORD: nojail
. /etc/rc.subr
. /etc/network.subr
name="static_arp"
start_cmd="static_arp_start"
@ -43,6 +44,8 @@ static_arp_start()
{
local e arp_args
afexists inet || return 0
if [ -n "${static_arp_pairs}" ]; then
echo -n 'Binding static ARP pair(s):'
for e in ${static_arp_pairs}; do
@ -58,6 +61,8 @@ static_arp_stop()
{
local e arp_args
afexists inet || return 0
if [ -n "${static_arp_pairs}" ]; then
echo -n 'Unbinding static ARP pair(s):'
for e in ${static_arp_pairs}; do

View File

@ -15,6 +15,8 @@ stop_cmd="stf_down"
stf_up()
{
afexists inet6 || return 0
case ${stf_interface_ipv4addr} in
[Nn][Oo] | '')
;;
@ -67,6 +69,8 @@ stf_up()
stf_down()
{
afexists inet6 || return 0
echo "Removing 6to4 tunnel interface: stf0."
ifconfig stf0 destroy
route delete -inet6 2002:e000:: -prefixlen 20 ::1