I've had this change floating around for a while to allow hostapd(8) to manage multiple wireless interfaces using rc.conf...
In rc.conf, we specify our wireless interfaces: > hostapd_ifaces="wlan0 wlan1" ...and enable our hostapd as before: > hostapd_enable="YES" Behind the scene, we need to create /etc/hostapd-wlan0.conf and /etc/hostapd-wlan1.conf Here are the diffs: diff --git a/etc/rc.d/hostapd b/etc/rc.d/hostapd index d0c2d88f2ff..43c6cf4e480 100755 --- a/etc/rc.d/hostapd +++ b/etc/rc.d/hostapd @@ -13,15 +13,27 @@ name="hostapd" desc="Authenticator for IEEE 802.11 networks" command="/usr/sbin/${name}" -ifn="$2" -if [ -z "$ifn" ]; then - rcvar="hostapd_enable" - conf_file="/etc/${name}.conf" - pidfile="/var/run/${name}.pid" +load_rc_config ${name} + + +if [ -n "$hostapd_ifaces" ]; then + nl_hostapd_ifaces=`(echo $hostapd_ifaces | tr '\s+' '\n')` + for iface in $nl_hostapd_ifaces + do + conf_file="/etc/${name}-${iface}.conf $conf_file" + done + pidfile="/var/run/${name}.pid" else - rcvar= - conf_file="/etc/${name}-${ifn}.conf" - pidfile="/var/run/${name}-${ifn}.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 fi command_args="-P ${pidfile} -B ${conf_file}" @@ -29,5 +41,4 @@ required_files="${conf_file}" required_modules="wlan_xauth wlan_wep wlan_tkip wlan_ccmp" extra_commands="reload" -load_rc_config ${name} run_rc_command "$1" diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index a03f4de5cb9..7217cbc1f16 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -409,6 +409,10 @@ Set to to start .Xr hostapd 8 at system boot time. +.It Va hostapd_ifaces +.Pq Vt str +Space separated list of interfaces managed by +.Xr hostapd 8 .It Va hostname .Pq Vt str The fully qualified domain name (FQDN) of this host on the network. My shell isn't great, but the above changes do seem to work. Let me know if there is interest in merging this, and if so, what I can do to move the process ahead. Thanks! Kamil _______________________________________________ freebsd-wireless@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-wireless To unsubscribe, send any mail to "freebsd-wireless-unsubscr...@freebsd.org"