From 3cd377eb54e7d835d72733999b58017f45daeb82 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Tue, 21 Nov 2023 01:51:28 +0200 Subject: [PATCH] MLD: Ignore failed links from association attempt If for some reason association fails and a link which has an error is reported, add that specific link to the ignore list. After that, immediately retrigger the connection code. In the usual case, we are then going to reconnect to the same AP MLD but with that particular link not being included in the connection. Signed-off-by: Benjamin Berg --- wpa_supplicant/sme.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 6a2f3602a..2d26c1256 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -28,6 +28,7 @@ #include "p2p_supplicant.h" #include "notify.h" #include "bss.h" +#include "bssid_ignore.h" #include "scan.h" #include "sme.h" #include "hs20_supplicant.h" @@ -2594,11 +2595,36 @@ mscs_fail: } if (wpa_drv_associate(wpa_s, ¶ms) < 0) { + unsigned int n_failed_links = 0; + int i; + wpa_msg(wpa_s, MSG_INFO, "SME: Association request to the " "driver failed"); - wpas_connection_failed(wpa_s, wpa_s->pending_bssid, NULL); - wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); - os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); + + /* Prepare list of failed links for error report */ + for (i = 0; i < MAX_NUM_MLD_LINKS; i++) { + if (!(wpa_s->valid_links & BIT(i)) || + wpa_s->mlo_assoc_link_id == i || + !params.mld_params.mld_links[i].error) + continue; + + wpa_bssid_ignore_add(wpa_s, wpa_s->links[i].bssid); + n_failed_links++; + } + + if (n_failed_links) { + /* Deauth and connect (possibly to the same AP MLD) */ + wpa_drv_deauthenticate(wpa_s, wpa_s->ap_mld_addr, + WLAN_REASON_DEAUTH_LEAVING); + wpas_connect_work_done(wpa_s); + wpa_supplicant_mark_disassoc(wpa_s); + wpas_request_connection(wpa_s); + } else { + wpas_connection_failed(wpa_s, wpa_s->pending_bssid, + NULL); + wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); + os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); + } return; }