diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c index 54db7c82e..1bc262a4c 100644 --- a/src/common/ieee802_11_common.c +++ b/src/common/ieee802_11_common.c @@ -2772,3 +2772,22 @@ 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) +{ + const size_t mld_addr_pos = + 2 /* Control field */ + + 1 /* Common Info Length field */; + const size_t fixed_len = mld_addr_pos + + ETH_ALEN /* MLD MAC Address field */; + + if (len < fixed_len) + return NULL; + + if ((buf[0] & MULTI_LINK_CONTROL_TYPE_MASK) != + MULTI_LINK_CONTROL_TYPE_BASIC) + return NULL; + + return &buf[mld_addr_pos]; +} 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 */