[PATCH] wpa_supplicant: Fix roaming failure after connecting to a specific BSSID

MaQiang 343846366 at qq.com
Tue Jun 30 23:02:12 PDT 2026


When configuring a BSSID connection via the D-Bus interface, a roaming trigger results in the error: "WPA: No SSID info found (msg 1 of 4)". This occurs because the wpa_supplicant_get_ssid function returns NULL due to the presence of bssid_set, which prevents proper SSID lookup during roaming. The solution is to clear the bssid_set flag upon roaming initiation.

Signed-off-by: MaQiang <343846366 at qq.com>
---
 src/ap/drv_callbacks.c             |  9 +++++++++
 src/drivers/driver.h               |  1 +
 src/drivers/driver_nl80211_event.c |  4 ++++
 wpa_supplicant/events.c            | 13 +++++++++++++
 4 files changed, 27 insertions(+)

diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
index 1d85d9726..fd0ec2307 100644
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -2996,4 +2996,13 @@ void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
 		wpa_supplicant_event(hapd, event, data);
 }
 
+int wpa_supplicant_set_bssidset(void *ctx, int bssidset)
+{
+	(void) ctx;
+	(void) bssidset;
+	wpa_printf(MSG_INFO,"do nothing!");
+	return 0;
+}
+
+
 #endif /* HOSTAPD */
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index ae8ed00b8..9eda01689 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -7932,6 +7932,7 @@ const char * driver_flag2_to_string(u64 flag2);
 /* NULL terminated array of linked in driver wrappers */
 extern const struct wpa_driver_ops *const wpa_drivers[];
 
+int wpa_supplicant_set_bssidset(void *ctx, int bssidset);
 
 /* Available drivers */
 
diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c
index 4fd4bcb5c..4faacc152 100644
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -4944,6 +4944,10 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd,
 		break;
 	case NL80211_CMD_CONNECT:
 	case NL80211_CMD_ROAM:
+		if(bss->ctx){
+            /*Clear bssid_set prior to connection to allow automatic AP selection*/
+			wpa_supplicant_set_bssidset(bss->ctx,0);
+		}
 		mlme_event_connect(drv, cmd, false,
 				   tb[NL80211_ATTR_STATUS_CODE],
 				   tb[NL80211_ATTR_MAC],
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 5faeddfbe..002933992 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -7792,3 +7792,16 @@ void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
 	if (wpa_s)
 		wpa_supplicant_event(wpa_s, event, data);
 }
+
+int wpa_supplicant_set_bssidset(void *ctx, int bssidset)
+{
+	struct wpa_supplicant *wpa_s =ctx;
+	if(wpa_s && wpa_s->conf && wpa_s->conf->ssid){
+		wpa_dbg(wpa_s, MSG_DEBUG,"bssidset change from %d to %d",wpa_s->conf->ssid->bssid_set,bssidset);
+		wpa_s->conf->ssid->bssid_set=bssidset;
+		return 0;
+	}
+	wpa_printf(MSG_INFO,"bssidset failed!");
+	return -1;
+}
+
-- 
2.25.1




More information about the Hostap mailing list