]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add a helper function to get ML IE of specified type from IEs buffer
authorVeerendranath Jakkam <quic_vjakkam@quicinc.com>
Thu, 8 Sep 2022 14:44:08 +0000 (20:14 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 15 Sep 2022 02:08:36 +0000 (05:08 +0300)
Add a helper function to find the specified type of Multi-Link element
from IEs buffer.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
src/common/ieee802_11_common.c
src/common/ieee802_11_common.h

index c8ee90cd7c6f3138643d984fe4b145ec1a233d8e..54db7c82e398c7cfd7e743c11c2591ce4947525b 100644 (file)
@@ -2755,3 +2755,20 @@ struct wpabuf * ieee802_11_defrag(struct ieee802_11_elems *elems,
 
        return ieee802_11_defrag_data(elems, eid, eid_ext, data, len);
 }
+
+
+const u8 * get_ml_ie(const u8 *ies, size_t len, u8 type)
+{
+       const struct element *elem;
+
+       if (!ies)
+               return NULL;
+
+       for_each_element_extid(elem, WLAN_EID_EXT_MULTI_LINK, ies, len) {
+               if (elem->datalen >= 2 &&
+                   (elem->data[1] & MULTI_LINK_CONTROL_TYPE_MASK) == type)
+                       return &elem->id;
+       }
+
+       return NULL;
+}
index 94e1d7b8b4af246b9c7943ad74720f52e08749c5..bd2c9fbf5f1806f4dea6bbd2ab31beffbad3015d 100644 (file)
@@ -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);
+const u8 * get_ml_ie(const u8 *ies, size_t len, u8 type);
 
 #endif /* IEEE802_11_COMMON_H */