[PATCH v2 08/17] Add API to get MLD address from basic ML IE

Veerendranath Jakkam quic_vjakkam at quicinc.com
Thu Sep 8 07:44:14 PDT 2022


From: Shivani Baranwal <quic_shivbara at quicinc.com>

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

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

diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index 0eac3f84c..8b3b7d3af 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -2771,3 +2771,24 @@ const u8 * get_ml_ie(const u8 *ies, size_t len, u8 type)
 
 	return NULL;
 }
+
+const u8 * get_basic_mle_mld_addr(const u8 *buf, size_t len)
+{
+#define BASIC_ML_IE_FIXED_LENGTH \
+		(2 + /* Control field */ \
+		 1 + /* Common info length field */ \
+		 6) /* MLD mac address field */
+	if (len < BASIC_ML_IE_FIXED_LENGTH)
+		return NULL;
+#undef BASIC_ML_IE_FIXED_LENGTH
+
+	if ((buf[0] & MULTI_LINK_CONTROL_TYPE_MASK) !=
+	     MULTI_LINK_CONTROL_TYPE_BASIC)
+		return NULL;
+
+#define BASIC_ML_IE_MLD_ADDR_IDX \
+		(2 + /* Control field */ \
+		 1) /* Common Info length field */
+	return &buf[BASIC_ML_IE_MLD_ADDR_IDX];
+#undef BASIC_ML_IE_MLD_ADDR_IDX
+}
diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h
index bd2c9fbf5..c3a3234b3 100644
--- a/src/common/ieee802_11_common.h
+++ b/src/common/ieee802_11_common.h
@@ -344,5 +344,6 @@ struct wpabuf * ieee802_11_defrag_data(struct ieee802_11_elems *elems,
 struct wpabuf * ieee802_11_defrag(struct ieee802_11_elems *elems,
 				  u8 eid, u8 eid_ext);
 const u8 * get_ml_ie(const u8 *ies, size_t len, u8 type);
+const u8 * get_basic_mle_mld_addr(const u8 *buf, size_t len);
 
 #endif /* IEEE802_11_COMMON_H */
-- 
2.25.1




More information about the Hostap mailing list