diff mbox series

[06/13] wpa_supplicant: Add more fields to MLO links information

Message ID 20221124124533.54965-7-andrei.otcheretianski@intel.com
State Changes Requested
Headers show
Series MLD STA: Add SME MLO support | expand

Commit Message

Otcheretianski, Andrei Nov. 24, 2022, 12:45 p.m. UTC
This new info will be needed for auth and assoc flows.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
---
 src/common/defs.h                 | 15 +++++++++++++++
 wpa_supplicant/events.c           |  9 ++++-----
 wpa_supplicant/wpa_supplicant_i.h | 10 +++-------
 3 files changed, 22 insertions(+), 12 deletions(-)

Comments

Jouni Malinen Nov. 24, 2022, 8:27 p.m. UTC | #1
On Thu, Nov 24, 2022 at 02:45:26PM +0200, Andrei Otcheretianski wrote:
> This new info will be needed for auth and assoc flows.

> diff --git a/src/common/defs.h b/src/common/defs.h
> @@ -520,4 +520,19 @@ enum frame_encryption {
> +struct ml_sta_link_info {
..
> +	/* pointer to the corresponding BSS */
> +	struct wpa_bss *bss;

This does not feel correct. struct wpa_bss is internal to
wpa_supplicant/* and I would not expect to see it being used anywhere
in src/* directories. Does this struct define really belong into
src/common/defs.h?
Otcheretianski, Andrei Nov. 27, 2022, 1:51 p.m. UTC | #2
> On Thu, Nov 24, 2022 at 02:45:26PM +0200, Andrei Otcheretianski wrote:
> > This new info will be needed for auth and assoc flows.
> 
> > diff --git a/src/common/defs.h b/src/common/defs.h @@ -520,4 +520,19
> > @@ enum frame_encryption {
> > +struct ml_sta_link_info {
> ..
> > +	/* pointer to the corresponding BSS */
> > +	struct wpa_bss *bss;
> 
> This does not feel correct. struct wpa_bss is internal to
> wpa_supplicant/* and I would not expect to see it being used anywhere in
> src/* directories. Does this struct define really belong into
> src/common/defs.h?

Right, it definitely shouldn't be there...
Actually I see now that I didn't send out the part that uses sta_profile and status fields yet, so this patch may be dropped except for making valid_links u16 and adding mld field.
I will fix this.

Andrei
> 
> --
> Jouni Malinen                                            PGP id EFC895FA
diff mbox series

Patch

diff --git a/src/common/defs.h b/src/common/defs.h
index 3e658cbcf4..d2dbeaf32b 100644
--- a/src/common/defs.h
+++ b/src/common/defs.h
@@ -520,4 +520,19 @@  enum frame_encryption {
 
 #define MAX_NUM_MLD_LINKS 15
 
+#define EHT_ML_MAX_STA_PROF_LEN 1024
+
+struct ml_sta_link_info {
+	u8 addr[ETH_ALEN];
+	u8 bssid[ETH_ALEN];
+	unsigned int freq;
+
+	/* pointer to the corresponding BSS */
+	struct wpa_bss *bss;
+
+	/* The status of the link. See WLAN_STATUS_* */
+	u16 status;
+	size_t sta_profile_len;
+	u8 sta_profile[EHT_ML_MAX_STA_PROF_LEN];
+};
 #endif /* DEFS_H */
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 35f3694a0b..91c0e7eb2d 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -310,17 +310,16 @@  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->mld = 0;
 	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));
 }
 
-
 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s)
 {
 	int bssid_changed;
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index add24f07df..9e1ee269c8 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -685,15 +685,11 @@  struct wpa_supplicant {
 	struct wpa_bss *current_bss;
 	int ap_ies_from_associnfo;
 	unsigned int assoc_freq;
+	u8 mld;
 	u8 ap_mld_addr[ETH_ALEN];
 	u8 mlo_assoc_link_id;
-	u8 valid_links; /* bitmap of valid MLO link IDs */
-	struct {
-		u8 addr[ETH_ALEN];
-		u8 bssid[ETH_ALEN];
-		unsigned int freq;
-		struct wpa_bss *bss;
-	} links[MAX_NUM_MLD_LINKS];
+	u16 valid_links; /* bitmap of valid MLO link IDs */
+	struct ml_sta_link_info links[MAX_NUM_MLD_LINKS];
 	u8 *last_con_fail_realm;
 	size_t last_con_fail_realm_len;