From owner-svn-src-stable@FreeBSD.ORG Mon Dec 7 07:41:30 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 364F5106566B; Mon, 7 Dec 2009 07:41:30 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24AF28FC08; Mon, 7 Dec 2009 07:41:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB77fU1S045411; Mon, 7 Dec 2009 07:41:30 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB77fUOh045409; Mon, 7 Dec 2009 07:41:30 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <200912070741.nB77fUOh045409@svn.freebsd.org> From: Hiroki Sato Date: Mon, 7 Dec 2009 07:41:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200209 - stable/8/etc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 07:41:30 -0000 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.