[PATCH 09/18] Add API to get MLD address from ML IE

Jouni Malinen j at w1.fi
Wed Aug 31 12:50:01 PDT 2022


On Thu, Jul 28, 2022 at 07:15:38PM +0530, Veerendranath Jakkam wrote:
> Add utility API to fetch Multi-Link Device(MLD) address from
> Multi-Link(ML) IE.

> diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
> +#define MULTI_LINK_IE_MINIMUM_BYTES 9
> +#define ML_IE_MLD_ADDR_OFFSET \
> +		(2 + /* Control field */ \
> +		 1) /* Common Info length field */
> +void wpa_get_mld_addr(u8 *mld_addr, const u8 *buf, size_t len)
> +{
> +	if (len < MULTI_LINK_IE_MINIMUM_BYTES)
> +		wpa_printf(MSG_ERROR, "Incomplete Multi-Link IE");
> +
> +	buf += ML_IE_MLD_ADDR_OFFSET;
> +	len -= ML_IE_MLD_ADDR_OFFSET;
> +
> +	/*
> +	 * Getting AP mld addr
> +	 */
> +	memcpy(mld_addr, buf, ETH_ALEN);
> +}

How is this supposed to handle all different types of Multi-Link
element? Is this only for the Basic Multi-Link element? If so, shouldn't
this verify that the element being parsed here does indeed have the Type
subfield set to 0 (Basic) before trying to parse the Common Info field?
It would also seem reasonable to verify that the Common Info Length
field has a value that is large enough to include the MLD MAC Address
field.

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list