]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
MLD: Ignore failed links from association attempt
authorBenjamin Berg <benjamin.berg@intel.com>
Mon, 20 Nov 2023 23:51:28 +0000 (01:51 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 25 Nov 2023 15:10:38 +0000 (17:10 +0200)
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 <benjamin.berg@intel.com>
wpa_supplicant/sme.c

index 6a2f3602a30d14bb70b566dcf3b10682cf8e57b4..2d26c12561183a5a175f6d6327c4198d0dfea441 100644 (file)
@@ -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, &params) < 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;
        }