[PATCH] nl80211: fix AP scan with STA fallback error path
Jouni Malinen
j at w1.fi
Fri Jul 12 06:53:11 PDT 2024
On Fri, Apr 26, 2024 at 02:35:53PM +0200, Nicolas Escande wrote:
> I've run into a case where I can bring a 2.4GHz AP up whithout it being in a
> bridge while I used the 'bridge=' config option. This happens when the HT scan
> needed for 40MHz operation failed to start from the get go because another dev
> on the same phy was already in a scan. At the end the AP is up and running but
> not enslaved to any bridge.
>
> Upon looking at the code, It seems that some hardware fails to issue a scan
> while in AP and thus we have a fallback that switches the interface from AP to
> STA before retrying another scan (it will change it back to AP later on when
> finished). As we cannot have a (non wds) STA in a bridge, during that procedure,
> we also remove/add the AP/STA from/to the bridge as needed.
>
> However, in wpa_driver_nl80211_scan() we do not set drv->ap_scan_as_station
> until the end of the switch-to-sta & retry-scan-start block. This means that
> when the recursive call to wpa_driver_nl80211_scan() fails (the hardware is busy
> in my case) we restore the interface to AP with wpa_driver_nl80211_set_mode()
> but that will not add it back to the bridge. Problem.
>
> To Fix this lets always set drv->ap_scan_as_station before calling
> wpa_driver_nl80211_set_mode(). In case wpa_driver_nl80211_set_mode() or
> wpa_driver_nl80211_scan() fails lets call nl80211_restore_ap_mode() that will
> set the mode back to AP but also handle the bridge thing as needed.
Thanks, applied.
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list