Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Dec 2009 07:41:30 +0000 (UTC)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r200209 - stable/8/etc
Message-ID:  <200912070741.nB77fUOh045409@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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.



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