[PATCH 02/12] MLD STA: set MLO connection info to wpa_sm

Veerendranath Jakkam quic_vjakkam at quicinc.com
Wed Aug 24 22:53:01 PDT 2022


Update MLO connection info such as valid links, AP MLD address and other
link information to wpa_sm.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam at quicinc.com>
---
 src/rsn_supp/wpa.c      | 23 +++++++++++++++++++++++
 src/rsn_supp/wpa.h      | 11 +++++++++++
 src/rsn_supp/wpa_i.h    |  7 +++++++
 wpa_supplicant/events.c | 18 ++++++++++++++++++
 4 files changed, 59 insertions(+)

diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c
index cf9b21039..a28d49225 100644
--- a/src/rsn_supp/wpa.c
+++ b/src/rsn_supp/wpa.c
@@ -3277,6 +3277,29 @@ void wpa_sm_set_config(struct wpa_sm *sm, struct rsn_supp_config *config)
 }
 
 
+void wpa_sm_set_ml_params(struct wpa_sm *sm, const u8 *ap_mld_addr,
+			  u16 valid_links, const u8 (*link_addr)[ETH_ALEN],
+			  const u8 (*link_bssid)[ETH_ALEN])
+{
+	int i;
+
+	if (!sm)
+		return;
+
+	sm->valid_links = valid_links;
+	if (!valid_links)
+		return;
+
+	os_memcpy(sm->ap_mld_addr, ap_mld_addr, ETH_ALEN);
+	for (i = 0; i < MAX_NUM_MLD_LINKS; i++) {
+		if (!(valid_links & BIT(i)))
+			continue;
+
+		os_memcpy(sm->links[i].addr, link_addr[i], ETH_ALEN);
+		os_memcpy(sm->links[i].bssid, link_bssid[i], ETH_ALEN);
+	}
+}
+
 /**
  * wpa_sm_set_own_addr - Set own MAC address
  * @sm: Pointer to WPA state machine data from wpa_sm_init()
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index be70f4156..e6eef0c99 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -153,6 +153,9 @@ void wpa_sm_set_fast_reauth(struct wpa_sm *sm, int fast_reauth);
 void wpa_sm_set_scard_ctx(struct wpa_sm *sm, void *scard_ctx);
 void wpa_sm_set_config(struct wpa_sm *sm, struct rsn_supp_config *config);
 void wpa_sm_set_own_addr(struct wpa_sm *sm, const u8 *addr);
+void wpa_sm_set_ml_params(struct wpa_sm *sm, const u8 *ap_mld_addr,
+			  u16 valid_links, const u8 (*link_addr)[ETH_ALEN],
+			  const u8 (*link_bssid)[ETH_ALEN]);
 void wpa_sm_set_ifname(struct wpa_sm *sm, const char *ifname,
 		       const char *bridge_ifname);
 void wpa_sm_set_eapol(struct wpa_sm *sm, struct eapol_sm *eapol);
@@ -266,6 +269,14 @@ static inline void wpa_sm_set_own_addr(struct wpa_sm *sm, const u8 *addr)
 {
 }
 
+static inline void wpa_sm_set_ml_params(struct wpa_sm *sm,
+					const u8 *ap_mld_addr,
+					u16 valid_links,
+					const u8 (*link_addr)[ETH_ALEN],
+					const u8 (*link_bssid)[ETH_ALEN])
+{
+}
+
 static inline void wpa_sm_set_ifname(struct wpa_sm *sm, const char *ifname,
 				     const char *bridge_ifname)
 {
diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h
index fabd6cb26..62b85cb2e 100644
--- a/src/rsn_supp/wpa_i.h
+++ b/src/rsn_supp/wpa_i.h
@@ -218,6 +218,13 @@ struct wpa_sm {
 	struct wpabuf *dpp_z;
 	int dpp_pfs;
 #endif /* CONFIG_DPP2 */
+
+	u16 valid_links;
+	u8 ap_mld_addr[ETH_ALEN];
+	struct {
+		u8 addr[ETH_ALEN];
+		u8 bssid[ETH_ALEN];
+	} links[MAX_NUM_MLD_LINKS];
 };
 
 
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 0db2e8dd8..db4de316f 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -3387,6 +3387,23 @@ static int wpa_drv_get_mlo_info(struct wpa_supplicant *wpa_s)
 	return 0;
 }
 
+static void wpa_sm_update_ml_params(struct wpa_supplicant *wpa_s)
+{
+	int i;
+	u8 link_addr[MAX_NUM_MLD_LINKS][ETH_ALEN];
+	u8 link_bssid[MAX_NUM_MLD_LINKS][ETH_ALEN];
+
+	for (i = 0; i < MAX_NUM_MLD_LINKS && wpa_s->valid_links; i++) {
+		if (!(wpa_s->valid_links & BIT(i)))
+			continue;
+
+		os_memcpy(link_addr[i], wpa_s->links[i].addr, ETH_ALEN);
+		os_memcpy(link_bssid[i], wpa_s->links[i].bssid, ETH_ALEN);
+	}
+
+	wpa_sm_set_ml_params(wpa_s->wpa, wpa_s->ap_mld_addr, wpa_s->valid_links,
+			     link_addr, link_bssid);
+}
 
 static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
 				       union wpa_event_data *data)
@@ -3512,6 +3529,7 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
 		wpa_supplicant_scard_init(wpa_s, wpa_s->current_ssid);
 	}
 	wpa_sm_notify_assoc(wpa_s->wpa, bssid);
+	wpa_sm_update_ml_params(wpa_s);
 	if (wpa_s->l2)
 		l2_packet_notify_auth_start(wpa_s->l2);
 
-- 
2.25.1




More information about the Hostap mailing list