]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Only do station mode fallback for -EOPNOTSUPP
authorBenjamin Berg <benjamin.berg@intel.com>
Fri, 17 Oct 2025 14:00:35 +0000 (16:00 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 13 Dec 2025 18:38:23 +0000 (20:38 +0200)
If the AP interface does not support scanning (or if
NL80211_SCAN_FLAG_AP is not set), then mac80211 will report -EOPNOTSUPP.
Only in this case it makes sense to try switching the interface type. So
change the restriction and drop the now unreachable code. Note that in
the case of MLD we will still never try to do an interface switch as
there is a check for valid_links later on.

This replaces the earlier changes from commit 666d695bbd04 ("nl80211:
Fix simultaneous scanning failure in case of MLO") with a simpler design
for avoiding the undesired change to STA mode in the AP MLD case.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
src/drivers/driver_nl80211_scan.c

index 6fa99f45b606dfe540f650313ad36f47e5fdfe48..b39943f60de3d318ad1a4b8ce9b78ed9f2bae70e 100644 (file)
@@ -420,43 +420,10 @@ int wpa_driver_nl80211_scan(struct i802_bss *bss,
        if (ret) {
                wpa_printf(MSG_DEBUG, "nl80211: Scan trigger failed: ret=%d "
                           "(%s)", ret, strerror(-ret));
-               if (drv->hostapd && is_ap_interface(drv->nlmode)) {
-#ifdef CONFIG_IEEE80211BE
-                       /* For multi link BSS, retry scan if any other links
-                        * are busy scanning. */
-                       if (ret == -EBUSY &&
-                           nl80211_link_valid(bss->valid_links,
-                                              params->link_id)) {
-                               struct i802_bss *link_bss;
-                               u8 link_id;
-
-                               wpa_printf(MSG_DEBUG,
-                                          "nl80211: Scan trigger on multi link BSS failed (requested link=%d on interface %s)",
-                                          params->link_id, bss->ifname);
-
-                               for (link_bss = drv->first_bss; link_bss;
-                                    link_bss = link_bss->next) {
-                                       if (link_bss->scan_link)
-                                               break;
-                               }
-
-                               if (!link_bss) {
-                                       wpa_printf(MSG_DEBUG,
-                                                  "nl80211: BSS information already running scan not available");
-                                       goto fail;
-                               }
-
-                               link_id = nl80211_get_link_id_from_link(
-                                       link_bss, link_bss->scan_link);
-                               wpa_printf(MSG_DEBUG,
-                                          "nl80211: Scan already running on interface %s link %d",
-                                          link_bss->ifname, link_id);
-                               goto fail;
-                       }
-#endif /* CONFIG_IEEE80211BE */
-
+               if (ret == -EOPNOTSUPP &&
+                   drv->hostapd && is_ap_interface(drv->nlmode)) {
                        /*
-                        * mac80211 does not allow scan requests in AP mode, so
+                        * mac80211 may not allow scan requests in AP mode, so
                         * try to do this in station mode. Do so only if there
                         * are not active links in the AP MLD.
                         */