Date: Tue, 5 Sep 2017 15:29:27 -0700 From: Adrian Chadd <adrian.chadd@gmail.com> To: Kamil Choudhury <Kamil.Choudhury@anserinae.net> Cc: "freebsd-wireless@freebsd.org" <freebsd-wireless@freebsd.org> Subject: Re: Configure hostapd(8) to manage multiple interfaces Message-ID: <CAJ-Vmon4HqSbkeeT2ZTsYf8wJxxjmtRfdTpxSYvH8=UE3KQ7cA@mail.gmail.com> In-Reply-To: <59af1e76.c138ed0a.3bf3f.ad1aSMTPIN_ADDED_MISSING@mx.google.com> References: <59af1e76.c138ed0a.3bf3f.ad1aSMTPIN_ADDED_MISSING@mx.google.com>
next in thread | previous in thread | raw e-mail | index | archive | help
please do this! -a On 5 September 2017 at 14:53, Kamil Choudhury <Kamil.Choudhury@anserinae.net> wrote: > 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-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmon4HqSbkeeT2ZTsYf8wJxxjmtRfdTpxSYvH8=UE3KQ7cA>