From owner-svn-src-stable-9@FreeBSD.ORG Fri Jul 5 02:07:00 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5BC1B36B; Fri, 5 Jul 2013 02:07:00 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3407819C3; Fri, 5 Jul 2013 02:07:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r65270CF036854; Fri, 5 Jul 2013 02:07:00 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6526xZN036843; Fri, 5 Jul 2013 02:06:59 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201307050206.r6526xZN036843@svn.freebsd.org> From: Rui Paulo Date: Fri, 5 Jul 2013 02:06:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252748 - in stable/9/etc: . rc.d X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Jul 2013 02:07:00 -0000 Author: rpaulo Date: Fri Jul 5 02:06:59 2013 New Revision: 252748 URL: http://svnweb.freebsd.org/changeset/base/252748 Log: Merge r252230: Implement ifconfig_wlanX="HOSTAP". Not only this is a bit cleaner, it allows multiple instances of hostapd to be running on the system host, useful for simultaneous dual-band WiFi. This is similar to ifconfig_wlanX="WPA" but it uses /etc/hostapd-wlanX.conf. Compatibility with hostapd_enable=YES/NO was kept. Modified: stable/9/etc/network.subr stable/9/etc/rc.d/hostapd Directory Properties: stable/9/etc/ (props changed) stable/9/etc/rc.d/ (props changed) Modified: stable/9/etc/network.subr ============================================================================== --- stable/9/etc/network.subr Fri Jul 5 01:53:51 2013 (r252747) +++ stable/9/etc/network.subr Fri Jul 5 02:06:59 2013 (r252748) @@ -159,6 +159,9 @@ ifconfig_up() if wpaif $1; then /etc/rc.d/wpa_supplicant start $1 _cfg=0 # XXX: not sure this should count + elif hostapif $1; then + /etc/rc.d/hostapd start $1 + _cfg=0 fi if dhcpif $1; then @@ -186,6 +189,9 @@ ifconfig_down() if wpaif $1; then /etc/rc.d/wpa_supplicant stop $1 _cfg=0 + elif hostapif $1; then + /etc/rc.d/hostapd stop $1 + _cfg=0 fi if dhcpif $1; then @@ -264,6 +270,7 @@ ifconfig_getargs() [Nn][Oo][Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) ;; [Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) ;; [Ww][Pp][Aa]) ;; + [Hh][Oo][Ss][Tt][Aa][Pp]) ;; *) _args="$_args $_arg" ;; @@ -364,6 +371,24 @@ wpaif() return 1 } +# hostapif if +# Returns 0 if the interface is a HOSTAP interface and 1 otherwise. +hostapif() +{ + local _tmpargs _arg + _tmpargs=`_ifconfig_getargs $1` + + for _arg in $_tmpargs; do + case $_arg in + [Hh][Oo][Ss][Tt][Aa][Pp]) + return 0 + ;; + esac + done + + return 1 +} + # afexists af # Returns 0 if the address family is enabled in the kernel # 1 otherwise. Modified: stable/9/etc/rc.d/hostapd ============================================================================== --- stable/9/etc/rc.d/hostapd Fri Jul 5 01:53:51 2013 (r252747) +++ stable/9/etc/rc.d/hostapd Fri Jul 5 02:06:59 2013 (r252748) @@ -10,11 +10,18 @@ . /etc/rc.subr name="hostapd" -rcvar="hostapd_enable" command="/usr/sbin/${name}" -conf_file="/etc/${name}.conf" -pidfile="/var/run/${name}.pid" +ifn="$2" +if [ -z "$ifn" ]; then + rcvar="hostapd_enable" + conf_file="/etc/${name}.conf" + pidfile="/var/run/${name}.pid" +else + rcvar= + conf_file="/etc/${name}-${ifn}.conf" + pidfile="/var/run/${name}-${ifn}.pid" +fi command_args="-P ${pidfile} -B ${conf_file}" required_files="${conf_file}"