svn commit: r200209 - stable/8/etc

Hiroki Sato hrs at FreeBSD.org
Sun Dec 6 23:41:30 PST 2009


Author: hrs
Date: Mon Dec  7 07:41:29 2009
New Revision: 200209
URL: http://svn.freebsd.org/changeset/base/200209

Log:
  MFC:
  
  r197139
  - Add afexists() to check if the specified address family exists
    on the system or not.
  
  r197697
  - Add AF_IPX and AF_NATM to afexists().

Modified:
  stable/8/etc/network.subr
Directory Properties:
  stable/8/etc/   (props changed)

Modified: stable/8/etc/network.subr
==============================================================================
--- stable/8/etc/network.subr	Mon Dec  7 07:33:51 2009	(r200208)
+++ stable/8/etc/network.subr	Mon Dec  7 07:41:29 2009	(r200209)
@@ -276,6 +276,37 @@ wpaif()
 	return 1
 }
 
+# afexists af
+#	Returns 0 if the address family is enabled in the kernel
+#	1 otherwise.
+afexists()
+{
+	local _af
+	_af=$1
+
+	case ${_af} in
+	inet)
+		${SYSCTL_N} net.inet > /dev/null 2>&1
+		;;
+	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"
+		;;
+	esac
+}
+
 # ipv6if if
 #	Returns 0 if the interface should be configured for IPv6 and
 #	1 otherwise.


More information about the svn-src-stable mailing list