summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2009-10-02 02:24:25 +0000
committerhrs <hrs@FreeBSD.org>2009-10-02 02:24:25 +0000
commit415abdb87d0c125010f49ffd33750d1057f10e21 (patch)
treea1510915dc87f81737f2af15f6d1a1a8c4675af6 /etc
parenta1020b6c31d2177ae8780c7d352313ddec80e596 (diff)
downloadFreeBSD-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')
-rw-r--r--etc/network.subr10
-rwxr-xr-xetc/rc.d/defaultroute2
-rwxr-xr-xetc/rc.d/faith4
-rwxr-xr-xetc/rc.d/ip6addrctl34
-rw-r--r--etc/rc.d/static_arp5
-rwxr-xr-xetc/rc.d/stf4
6 files changed, 43 insertions, 16 deletions
diff --git a/etc/network.subr b/etc/network.subr
index 83141ec..d2c2111 100644
--- a/etc/network.subr
+++ b/etc/network.subr
@@ -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"
;;
diff --git a/etc/rc.d/defaultroute b/etc/rc.d/defaultroute
index cade406..b4dc373 100755
--- a/etc/rc.d/defaultroute
+++ b/etc/rc.d/defaultroute
@@ -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`
diff --git a/etc/rc.d/faith b/etc/rc.d/faith
index 020b947..e48fff7 100755
--- a/etc/rc.d/faith
+++ b/etc/rc.d/faith
@@ -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
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
diff --git a/etc/rc.d/static_arp b/etc/rc.d/static_arp
index 582518f..816d581 100644
--- a/etc/rc.d/static_arp
+++ b/etc/rc.d/static_arp
@@ -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
diff --git a/etc/rc.d/stf b/etc/rc.d/stf
index 40b182a..fa1bfbd 100755
--- a/etc/rc.d/stf
+++ b/etc/rc.d/stf
@@ -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
OpenPOWER on IntegriCloud