[PATCH 3/9] nl80211: Don't try to scan on AP interface with active links

Benjamin Berg benjamin at sipsolutions.net
Fri Jul 18 04:00:59 PDT 2025


From: Ilan Peer <ilan.peer at intel.com>

When the kernel driver doesn't support scanning on an AP interface,
nl80211 drivers attempts to switch to station interface to perform
a scan. However, when the AP is an AP MLD and there are already
active links this is not valid. In such a case, fail the scan.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
---
 src/drivers/driver_nl80211_scan.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/drivers/driver_nl80211_scan.c b/src/drivers/driver_nl80211_scan.c
index da90b55553..06e1e7058b 100644
--- a/src/drivers/driver_nl80211_scan.c
+++ b/src/drivers/driver_nl80211_scan.c
@@ -458,19 +458,28 @@ int wpa_driver_nl80211_scan(struct i802_bss *bss,
 
 			/*
 			 * mac80211 does not allow scan requests in AP mode, so
-			 * try to do this in station mode.
+			 * try to do this in station mode. Do so only if there
+			 * are not active links in the AP MLD.
 			 */
+			wpa_printf(MSG_DEBUG,
+				   "nl80211: AP scan failed on %s. Links=0x%x",
+				   bss->ifname, bss->valid_links);
+
+			if (bss->valid_links)
+				goto fail;
+
 			drv->ap_scan_as_station = drv->nlmode;
-			if (wpa_driver_nl80211_set_mode(
-				    bss, NL80211_IFTYPE_STATION) ||
+			if (wpa_driver_nl80211_set_mode(bss,
+							NL80211_IFTYPE_STATION) ||
 			    wpa_driver_nl80211_scan(bss, params)) {
 				nl80211_restore_ap_mode(bss);
 				goto fail;
 			}
 
 			ret = 0;
-		} else
+		} else {
 			goto fail;
+		}
 	}
 
 	drv->scan_state = SCAN_REQUESTED;
-- 
2.50.0




More information about the Hostap mailing list