[PATCH v2 03/17] EHT: Add support for Multi-Link element defragmentation

Veerendranath Jakkam quic_vjakkam at quicinc.com
Sat Oct 1 01:21:15 PDT 2022


Add support for element defragmentation of different types of Multi-Link
elements.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam at quicinc.com>
---
 src/common/ieee802_11_common.c | 49 +++++++++++++++++++++++++++++++++++++++---
 src/common/ieee802_11_common.h | 10 +++++++--
 2 files changed, 54 insertions(+), 5 deletions(-)

diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index 41346a0..6891eca 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -235,6 +235,9 @@ static int ieee802_11_parse_mle(const u8 *pos, size_t elen,
 		return -1;
 	}
 
+	if (elen == 254)
+		elems->frag_ies.last_mle_type = mle_type;
+
 	return 0;
 }
 
@@ -257,6 +260,7 @@ static int ieee802_11_parse_extension(const u8 *pos, size_t elen,
 	elen--;
 
 	elems->frag_ies.last_eid_ext = 0;
+	elems->frag_ies.last_mle_type = -1;
 
 	switch (ext_id) {
 	case WLAN_EID_EXT_ASSOC_DELAY_INFO:
@@ -399,6 +403,7 @@ static void ieee802_11_parse_fragment(struct frag_ies_info *frag_ies,
 	frag_ies->frags[frag_ies->n_frags].ie_len = elen;
 	frag_ies->frags[frag_ies->n_frags].eid = frag_ies->last_eid;
 	frag_ies->frags[frag_ies->n_frags].eid_ext = frag_ies->last_eid_ext;
+	frag_ies->frags[frag_ies->n_frags].mle_type = frag_ies->last_mle_type;
 	frag_ies->n_frags++;
 }
 
@@ -2729,7 +2734,7 @@ enum oper_chan_width op_class_to_ch_width(u8 op_class)
 
 
 struct wpabuf * ieee802_11_defrag_data(struct ieee802_11_elems *elems,
-				       u8 eid, u8 eid_ext,
+				       u8 eid, u8 eid_ext, int mle_type,
 				       const u8 *data, u8 len)
 {
 	struct frag_ies_info *frag_ies = &elems->frag_ies;
@@ -2747,7 +2752,8 @@ struct wpabuf * ieee802_11_defrag_data(struct ieee802_11_elems *elems,
 		int ret;
 
 		if (frag_ies->frags[i].eid != eid ||
-		    frag_ies->frags[i].eid_ext != eid_ext)
+		    frag_ies->frags[i].eid_ext != eid_ext ||
+		    frag_ies->frags[i].mle_type != mle_type)
 			continue;
 
 		ret = wpabuf_resize(&buf, frag_ies->frags[i].ie_len);
@@ -2799,7 +2805,44 @@ struct wpabuf * ieee802_11_defrag(struct ieee802_11_elems *elems,
 		return NULL;
 	}
 
-	return ieee802_11_defrag_data(elems, eid, eid_ext, data, len);
+	return ieee802_11_defrag_data(elems, eid, eid_ext, -1, data, len);
+}
+
+
+struct wpabuf * ieee802_11_defrag_mle(struct ieee802_11_elems *elems, u8 type)
+{
+	const u8 *data;
+	u8 len;
+
+	switch (type) {
+	case MULTI_LINK_CONTROL_TYPE_BASIC:
+		data = elems->basic_mle;
+		len = elems->basic_mle_len;
+		break;
+	case MULTI_LINK_CONTROL_TYPE_PROBE_REQ:
+		data = elems->probe_req_mle;
+		len = elems->probe_req_mle_len;
+		break;
+	case MULTI_LINK_CONTROL_TYPE_RECONF:
+		data = elems->reconf_mle;
+		len = elems->reconf_mle_len;
+		break;
+	case MULTI_LINK_CONTROL_TYPE_TDLS:
+		data = elems->tdls_mle;
+		len = elems->tdls_mle_len;
+		break;
+	case MULTI_LINK_CONTROL_TYPE_PRIOR_ACCESS:
+		data = elems->prior_access_mle;
+		len = elems->prior_access_mle_len;
+		break;
+	default:
+		wpa_printf(MSG_DEBUG,
+			   "Defragmentation not supported. mle_type=%d", type);
+		return NULL;
+	}
+
+	return ieee802_11_defrag_data(elems, WLAN_EID_EXTENSION,
+				      WLAN_EID_EXT_MULTI_LINK, type, data, len);
 }
 
 
diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h
index ff6d2a8..0203e03 100644
--- a/src/common/ieee802_11_common.h
+++ b/src/common/ieee802_11_common.h
@@ -35,15 +35,20 @@ struct frag_ies_info {
 	struct {
 		u8 eid;
 		u8 eid_ext;
+		int mle_type;
 		const u8 *ie;
 		u8 ie_len;
 	} frags[MAX_NUM_FRAG_IES_SUPPORTED];
 
 	u8 n_frags;
 
-	/* the last parsed element ID and element extension ID */
+	/*
+	 * the last parsed element ID, element extension ID and Multi-Link
+	 * element type.
+	 */
 	u8 last_eid;
 	u8 last_eid_ext;
+	int last_mle_type;
 };
 
 /* Parsed Information Elements */
@@ -349,10 +354,11 @@ int ieee802_edmg_is_allowed(struct ieee80211_edmg_config allowed,
 			    struct ieee80211_edmg_config requested);
 
 struct wpabuf * ieee802_11_defrag_data(struct ieee802_11_elems *elems,
-				       u8 eid, u8 eid_ext,
+				       u8 eid, u8 eid_ext, int mle_type,
 				       const u8 *data, u8 len);
 struct wpabuf * ieee802_11_defrag(struct ieee802_11_elems *elems,
 				  u8 eid, u8 eid_ext);
+struct wpabuf * ieee802_11_defrag_mle(struct ieee802_11_elems *elems, u8 type);
 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);
 
-- 
2.7.4




More information about the Hostap mailing list