Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Oct 2009 02:24:25 +0000 (UTC)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r197697 - in head/etc: . rc.d
Message-ID:  <200910020224.n922OPcG086114@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hrs
Date: Fri Oct  2 02:24:25 2009
New Revision: 197697
URL: http://svn.freebsd.org/changeset/base/197697

Log:
  - 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.

Modified:
  head/etc/network.subr
  head/etc/rc.d/defaultroute
  head/etc/rc.d/faith
  head/etc/rc.d/ip6addrctl
  head/etc/rc.d/static_arp
  head/etc/rc.d/stf

Modified: head/etc/network.subr
==============================================================================
--- head/etc/network.subr	Fri Oct  2 01:45:11 2009	(r197696)
+++ head/etc/network.subr	Fri Oct  2 02:24:25 2009	(r197697)
@@ -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"
 		;;

Modified: head/etc/rc.d/defaultroute
==============================================================================
--- head/etc/rc.d/defaultroute	Fri Oct  2 01:45:11 2009	(r197696)
+++ head/etc/rc.d/defaultroute	Fri Oct  2 02:24:25 2009	(r197697)
@@ -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`

Modified: head/etc/rc.d/faith
==============================================================================
--- head/etc/rc.d/faith	Fri Oct  2 01:45:11 2009	(r197696)
+++ head/etc/rc.d/faith	Fri Oct  2 02:24:25 2009	(r197697)
@@ -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

Modified: head/etc/rc.d/ip6addrctl
==============================================================================
--- head/etc/rc.d/ip6addrctl	Fri Oct  2 01:45:11 2009	(r197696)
+++ head/etc/rc.d/ip6addrctl	Fri Oct  2 02:24:25 2009	(r197697)
@@ -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_pref
 
 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

Modified: head/etc/rc.d/static_arp
==============================================================================
--- head/etc/rc.d/static_arp	Fri Oct  2 01:45:11 2009	(r197696)
+++ head/etc/rc.d/static_arp	Fri Oct  2 02:24:25 2009	(r197697)
@@ -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

Modified: head/etc/rc.d/stf
==============================================================================
--- head/etc/rc.d/stf	Fri Oct  2 01:45:11 2009	(r197696)
+++ head/etc/rc.d/stf	Fri Oct  2 02:24:25 2009	(r197697)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910020224.n922OPcG086114>