[PATCH v2 06/15] wpa_supplicant: make valid_links u16

Andrei Otcheretianski andrei.otcheretianski at intel.com
Wed Nov 30 05:09:30 PST 2022


MAX_NUM_MLD_LINKS is 15, thus u8 isn't enough for the bitmap.
Fix it.
While at it, clean mlo information better.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 wpa_supplicant/events.c           | 7 +++----
 wpa_supplicant/wpa_supplicant_i.h | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index fe8ab50ff3..69e8034340 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -310,14 +310,13 @@ void wpa_supplicant_stop_countermeasures(void *eloop_ctx, void *sock_ctx)
 
 static void wpas_reset_mlo_info(struct wpa_supplicant *wpa_s)
 {
-	int i;
-
 	if (!wpa_s->valid_links)
 		return;
 
 	wpa_s->valid_links = 0;
-	for (i = 0; i < MAX_NUM_MLD_LINKS; i++)
-		wpa_s->links[i].bss = NULL;
+	wpa_s->mlo_assoc_link_id = 0;
+	os_memset(wpa_s->ap_mld_addr, 0, ETH_ALEN);
+	os_memset(wpa_s->links, 0, sizeof(wpa_s->links));
 }
 
 
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 0cc8633eea..f10674de49 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -687,8 +687,8 @@ struct wpa_supplicant {
 	unsigned int assoc_freq;
 	u8 ap_mld_addr[ETH_ALEN];
 	u8 mlo_assoc_link_id;
-	u8 valid_links; /* bitmap of valid MLO link IDs */
-	struct {
+	u16 valid_links; /* bitmap of valid MLO link IDs */
+	struct ml_sta_link_info {
 		u8 addr[ETH_ALEN];
 		u8 bssid[ETH_ALEN];
 		unsigned int freq;
-- 
2.25.1




More information about the Hostap mailing list