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

Jouni Malinen j at w1.fi
Mon Jul 27 09:40:06 PDT 2026


On Wed, Jul 01, 2026 at 02:02:12PM +0800, MaQiang wrote:
> 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.

What do you mean with "BSSID connection"? How exactly does ssid_set
being set prevent a network structure from being found? Please keep in
mind that setting a specific BSSID is supposed to prevent connection to
any other BSS than the one with that BSSID.

> diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
> +int wpa_supplicant_set_bssidset(void *ctx, int bssidset)
> +{
> +	(void) ctx;
> +	(void) bssidset;
> +	wpa_printf(MSG_INFO,"do nothing!");
> +	return 0;
> +}

These feels very wrong and something that should not be in this file..

> diff --git a/src/drivers/driver.h b/src/drivers/driver.h
> @@ -7932,6 +7932,7 @@ const char * driver_flag2_to_string(u64 flag2);
> +int wpa_supplicant_set_bssidset(void *ctx, int bssidset);

And this is unacceptable. src/drivers/*.c are not allowed to call
functions from src/ap/*.c or wpa_supplicant/*.c directly.

> diff --git 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,
>  	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);
> +		}

This is in wrong place and is asking for a change that is not allowed..
ssid->bssid_set is not supposed to be cleared on connectin.

> diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
> +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;

wpa_s->conf->ssid is a pointer to the first configured network block,
not necessarily the one that is being used (which would likely be
wpa_s->current_ssid). In any case, this change in configuration based on
a connection is not the correct way of addressing the issue. However, it
was not clear what the exact issue is, so it is a bit difficult to
propose a proper way of addressing it.
 
-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list