[PATCH 09/18] Add API to get MLD address from ML IE

Veerendranath Jakkam quic_vjakkam at quicinc.com
Thu Jul 28 06:45:38 PDT 2022


From: Shivani Baranwal <quic_shivbara at quicinc.com>

Add utility API to fetch Multi-Link Device(MLD) address from
Multi-Link(ML) IE.

Signed-off-by: Shivani Baranwal <quic_shivbara at quicinc.com>
---
 src/common/ieee802_11_common.c | 18 ++++++++++++++++++
 src/common/ieee802_11_common.h |  1 +
 2 files changed, 19 insertions(+)

diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index c8ee90cd7..f781a13ea 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -2755,3 +2755,21 @@ struct wpabuf * ieee802_11_defrag(struct ieee802_11_elems *elems,
 
 	return ieee802_11_defrag_data(elems, eid, eid_ext, data, len);
 }
+
+#define MULTI_LINK_IE_MINIMUM_BYTES 9
+#define ML_IE_MLD_ADDR_OFFSET \
+		(2 + /* Control field */ \
+		 1) /* Common Info length field */
+void wpa_get_mld_addr(u8 *mld_addr, const u8 *buf, size_t len)
+{
+	if (len < MULTI_LINK_IE_MINIMUM_BYTES)
+		wpa_printf(MSG_ERROR, "Incomplete Multi-Link IE");
+
+	buf += ML_IE_MLD_ADDR_OFFSET;
+	len -= ML_IE_MLD_ADDR_OFFSET;
+
+	/*
+	 * Getting AP mld addr
+	 */
+	memcpy(mld_addr, buf, ETH_ALEN);
+}
diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h
index 94e1d7b8b..e481af8da 100644
--- a/src/common/ieee802_11_common.h
+++ b/src/common/ieee802_11_common.h
@@ -343,5 +343,6 @@ struct wpabuf * ieee802_11_defrag_data(struct ieee802_11_elems *elems,
 				       const u8 *data, u8 len);
 struct wpabuf * ieee802_11_defrag(struct ieee802_11_elems *elems,
 				  u8 eid, u8 eid_ext);
+void wpa_get_mld_addr(u8 *mld_addr, const u8 *buf, size_t len);
 
 #endif /* IEEE802_11_COMMON_H */
-- 
2.25.1




More information about the Hostap mailing list