Add a helper function to get ML IE of specified type from IEs buffer

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>
This commit is contained in:
Veerendranath Jakkam 2022-09-08 20:14:08 +05:30 committed by Jouni Malinen
parent 36645f8394
commit bd499f0e6e
2 changed files with 18 additions and 0 deletions

View 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); 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;
}

View file

@ -343,5 +343,6 @@ struct wpabuf * ieee802_11_defrag_data(struct ieee802_11_elems *elems,
const u8 *data, u8 len); const u8 *data, u8 len);
struct wpabuf * ieee802_11_defrag(struct ieee802_11_elems *elems, struct wpabuf * ieee802_11_defrag(struct ieee802_11_elems *elems,
u8 eid, u8 eid_ext); u8 eid, u8 eid_ext);
const u8 * get_ml_ie(const u8 *ies, size_t len, u8 type);
#endif /* IEEE802_11_COMMON_H */ #endif /* IEEE802_11_COMMON_H */