From owner-freebsd-wireless@freebsd.org Tue Sep 5 22:29:29 2017 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C9D1E227C5 for ; Tue, 5 Sep 2017 22:29:29 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-yw0-x244.google.com (mail-yw0-x244.google.com [IPv6:2607:f8b0:4002:c05::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE76F7F3D4 for ; Tue, 5 Sep 2017 22:29:28 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-yw0-x244.google.com with SMTP id q80so1934049ywg.0 for ; Tue, 05 Sep 2017 15:29:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=x3+SYHfXen1pepIOMkLpOrkLtjmy4/2IHrIBUVi+vag=; b=cyMMYUM7+Mt/mmjuBVzlbnNNXbSM8Dw0w3NNOIM+1V9WPqoMwIR4hKvE+y7ly7Eppx wkHY5i7mmvUDUVPizwsayXZ64Vfnl0Ln8LNUQ4tgkTdSzNq9tnhlRjEpWkhKe+7FEgCc qSc1KhuV7IBkLwsYWSMgvw3QdDyaeQZtY2/6B5dWL3+2S3oW01lLFBwRnFthXih1Jv/f Rq/VECSCNH64EavfUzDzzx69PGyNOTj6KWLvW2AnQ7/BvKTzOBN1WbuTyhfObAje9jBW 8Bp7N1tMMfCfVQiyTQJxcCdBK2d2Z8lcxxW6PAW9jTe1YNwK/+z0p4GMWnJ/2yFSNj53 /Gng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=x3+SYHfXen1pepIOMkLpOrkLtjmy4/2IHrIBUVi+vag=; b=terBCL8mI1WO7NqTdwclQfLMXY/0SZ0tf6ivvdIeRUxD/FHkoez+4Ddetpu+o5N8id U9CVKFKmQtPY1H76InWEULJC+3NCLzXR89LrCRcdkPYup0GU0Ggayy/PAWpeh21m+att 01v8pItfUc0gGAu95CjC+i0Wu8fSTJaXSCnlEdQ4O4QjK2Cd4VH3FQ3QBslfJT6JX+dI /l0wI6+ER+a+BRlVmuLfzweccsVz+aTgZ+3XE8wjvk/f7HoRdFBJrvKXN22VywRw6xgd oOZgjHVPb6xTk1UD0Ca6OSDgYLZlTRGTpFhM7+ojtZzJ4CA4RsxF4z2nYhvIJeuD7KOC dkjw== X-Gm-Message-State: AHPjjUjN2x9Ob/LpwBPWRIs9Dj/qgeM9jCT9IH5PbuNV4i/eP1GwhaAL 5fRscZOx/KjJgeQ5tqdLsXkF0iqoLYDW X-Google-Smtp-Source: ADKCNb6qJ53GceZY7zMCBrJtN9Xp2vx/FFkPA2FJDbTfLKTUEQjNK2Y7zdrN9IS9C9RCATV8/361STaixExHfQtrgRQ= X-Received: by 10.37.220.19 with SMTP id y19mr492613ybe.230.1504650567879; Tue, 05 Sep 2017 15:29:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.125.65 with HTTP; Tue, 5 Sep 2017 15:29:27 -0700 (PDT) In-Reply-To: <59af1e76.c138ed0a.3bf3f.ad1aSMTPIN_ADDED_MISSING@mx.google.com> References: <59af1e76.c138ed0a.3bf3f.ad1aSMTPIN_ADDED_MISSING@mx.google.com> From: Adrian Chadd Date: Tue, 5 Sep 2017 15:29:27 -0700 Message-ID: Subject: Re: Configure hostapd(8) to manage multiple interfaces To: Kamil Choudhury Cc: "freebsd-wireless@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Sep 2017 22:29:29 -0000 please do this! -a On 5 September 2017 at 14:53, Kamil Choudhury 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"