From df2f22faf9ac7f36570e0bc225e9e5a76aeb2f17 Mon Sep 17 00:00:00 2001 From: Veerendranath Jakkam Date: Fri, 5 May 2023 16:47:42 +0530 Subject: [PATCH] MLD STA: Use AP MLD address as previous BSSID for reassociation requests The Linux kernel expects to use the AP MLD address in NL80211_ATTR_PREV_BSSID for reassociation requests when the current association is MLO capable. Previously, wpa_supplicant was using the BSSID value in NL80211_ATTR_PREV_BSSID even if the connection is MLO capable. Fix this by sending the AP MLD address in NL80211_ATTR_PREV_BSSID for reassociation requests when MLO is used. Signed-off-by: Veerendranath Jakkam --- wpa_supplicant/events.c | 8 +++++++- wpa_supplicant/wpa_supplicant.c | 11 ++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 896c53841..70d65b6fe 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -3674,7 +3674,13 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s, wpas_fst_update_mb_assoc(wpa_s, data); #ifdef CONFIG_SME - os_memcpy(wpa_s->sme.prev_bssid, bssid, ETH_ALEN); + /* + * Cache the current AP's BSSID (for non-MLO connection) or MLD address + * (for MLO connection) as the previous BSSID for subsequent + * reassociation requests handled by SME-in-wpa_supplicant. + */ + os_memcpy(wpa_s->sme.prev_bssid, + wpa_s->valid_links ? wpa_s->ap_mld_addr : bssid, ETH_ALEN); wpa_s->sme.prev_bssid_set = 1; wpa_s->sme.last_unprot_disconnect.sec = 0; #endif /* CONFIG_SME */ diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 909a4bcfe..e0f3240e8 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -3972,7 +3972,16 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) return; } - os_memcpy(prev_bssid, wpa_s->bssid, ETH_ALEN); + /* + * Set the current AP's BSSID (for non-MLO connection) or MLD address + * (for MLO connection) as the previous BSSID for reassociation requests + * handled by SME-in-driver. If wpa_supplicant is in disconnected state, + * prev_bssid will be zero as both wpa_s->valid_links and wpa_s->bssid + * will be zero. + */ + os_memcpy(prev_bssid, + wpa_s->valid_links ? wpa_s->ap_mld_addr : wpa_s->bssid, + ETH_ALEN); os_memset(¶ms, 0, sizeof(params)); wpa_s->reassociate = 0; wpa_s->eap_expected_failure = 0;