[OpenWrt-Devel] [openwrt/openwrt] mac80211: do not try to setup hostapd-managed interfaces.
Oldřich Jedlička
oldium.pro at gmail.com
Tue Mar 24 10:29:20 EDT 2020
Hi John,
ok, my issue: https://bugs.openwrt.org/index.php?do=details&task_id=2698
Details:
When virtual access points are used (multiple BSSIDS on one physical
interface), only the first BSSID is assigned to an existing network
interface, all other access point's (BSSIDs) network interfaces are
created by hostapd. The original mac80211.sh script tries to call ip link
set dev <iface> up on all interfaces, even on virtual ones, and it tries to
set txpower too. This works as long as the interface exists prior to trying
to setting it up - when hostapd has enough time to create them. The script
uses sleep 1 most probably to give hostapd time to create the interfaces.
But when the creation of interfaces is delayed for any reason, like is for
DFS on 5GHz band, the interface is created after one minute (i.e. it takes
60 seconds to create virtual interfaces). The DFS on 5GHz works in a way
that the driver scans for any possible radar transmitting on the frequency
and if it does not find any within a minute, the frequency is allowed to be
used. In this case the setting-up (ip link set dev <iface> up) of the
interface fails (the interface does not exist yet) and wireless_add_vif is
not called. My patch ensures that the wireless_add_vif is called also for
virtual interfaces - those created by hostapd.
Regards,
Oldrich.
út 24. 3. 2020 v 15:05 odesílatel John Crispin <john at phrozen.org> napsal:
> Hi,
> what do you setup a device fully managed by hostapd ? I am not sure i
> understand what that is. Best if you explain your problem so i can try
> to reproduce and fix it.
>
> to answer your question, in a multi vap setup "wifi reconf" will break
> with your change as it breaks the symmetry of link up/down calls
>
> John
>
> On 24.03.20 14:55, Oldřich Jedlička wrote:
> > Hi John,
> >
> > Are you able to describe what exactly does not work - how to reproduce
> > it? Maybe it is simple and obvious to you, but please describe what does
> > not work.
> >
> > I just removed setting interface up and setting txpower on it - when the
> > interface is fully managed by hostapd. That looks reasonable to me, but
> > might be wrong as well. At least it made reporting of the interface
> > status working, see https://github.com/openwrt/openwrt/pull/2848 for
> > screen-shots.
> >
> > Regards,
> > Oldrich.
> >
> >
> >
> > út 24. 3. 2020 v 12:10 odesílatel John Crispin <john at phrozen.org
> > <mailto:john at phrozen.org>> napsal:
> >
> > Hi
> > below commit breaks wifi reconf feature and to be honest it looks
> like
> > the wrong fix to me.
> > John
> >
> >
> > > dangole pushed a commit to openwrt/openwrt.git, branch master:
> > > https://git.openwrt.org/23a885bf89a204f91e4f17ed96f1a9fc7f50ea34
> > >
> > > commit 23a885bf89a204f91e4f17ed96f1a9fc7f50ea34
> > > Author: Oldřich Jedlička <oldium.pro at gmail.com
> > <mailto:oldium.pro at gmail.com>>
> > > AuthorDate: Mon Mar 16 21:00:51 2020 +0100
> > >
> > > mac80211: do not try to setup hostapd-managed interfaces.
> > >
> > > For virtual access points (when multiple SSIDs are used for
> one
> > > physical AP), there exist one physical network interface and
> > > multiple virtual interfaces, which are fully under control of
> > > hostapd. When networking is setup, the script
> > > `/lib/netifd/wireless/mac80211.sh` is called, which tries to
> > bring
> > > the interface up by a call to `ip link set dev <iface> up`.
> This
> > > call might fail for virtual APs, because the virtual
> interface
> > > might not have been created by hostapd yet. There are some
> > artifical
> > > delays in the script most probably to handle this, but when
> DFS
> > > channel availability check on 5GHz band is issued, hostapd
> can
> > > delay creating virtual interfaces by a minute.
> > >
> > > In order to fix this (or work around it), do not try to
> > bring the
> > > interface up (this is responsibility of hostapd anyway) and
> > > do not try to set txpower on the virtual interface.
> > >
> > > Fixes FS#2698.
> > >
> > > Signed-off-by: Oldřich Jedlička <oldium.pro at gmail.com
> > <mailto:oldium.pro at gmail.com>>
> > > ---
> > > .../mac80211/files/lib/netifd/wireless/mac80211.sh | 18
> > +++++++++++-------
> > > 1 file changed, 11 insertions(+), 7 deletions(-)
> > >
> > > diff --git
> > a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
> > b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
> > > index f22730c9fc..f59c498215 100644
> > > ---
> a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
> > > +++
> b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
> > > @@ -533,6 +533,7 @@ mac80211_prepare_vif() {
> > >
> > > NEWAPLIST="${NEWAPLIST}$ifname "
> > > [ -n "$hostapd_ctrl" ] || {
> > > + ap_ifname="${ifname}"
> > >
> > hostapd_ctrl="${hostapd_ctrl:-/var/run/hostapd/$ifname}"
> > > }
> > > ;;
> > > @@ -753,13 +754,15 @@ mac80211_setup_vif() {
> > > json_get_var vif_enable enable 1
> > >
> > > [ "$vif_enable" = 1 ] || action=down
> > > - logger ip link set dev "$ifname" $action
> > > - ip link set dev "$ifname" "$action" || {
> > > - wireless_setup_vif_failed IFUP_ERROR
> > > - json_select ..
> > > - return
> > > - }
> > > - [ -z "$vif_txpower" ] || iw dev "$ifname" set txpower fixed
> > "${vif_txpower%%.*}00"
> > > + if [ "$mode" != "ap" ] || [ "$ifname" = "$ap_ifname" ]; then
> > > + logger ip link set dev "$ifname" $action
> > > + ip link set dev "$ifname" "$action" || {
> > > + wireless_setup_vif_failed IFUP_ERROR
> > > + json_select ..
> > > + return
> > > + }
> > > + [ -z "$vif_txpower" ] || iw dev "$ifname" set
> > txpower fixed "${vif_txpower%%.*}00"
> > > + fi
> > >
> > > case "$mode" in
> > > mesh)
> > > @@ -924,6 +927,7 @@ drv_mac80211_setup() {
> > >
> > > has_ap=
> > > hostapd_ctrl=
> > > + ap_ifname=
> > > hostapd_noscan=
> > > for_each_interface "ap" mac80211_check_ap
> > >
> > >
> > > _______________________________________________
> > > lede-commits mailing list
> > > lede-commits at lists.infradead.org
> > <mailto:lede-commits at lists.infradead.org>
> > > http://lists.infradead.org/mailman/listinfo/lede-commits
> > >
> >
> >
> > _______________________________________________
> > openwrt-devel mailing list
> > openwrt-devel at lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20200324/55aff9cf/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list