wlantest: Learn AP MLD MAC address from Beacon frames

Use the Basic Multi-Link element in Beacon frames (and Probe Response
frames for that matter) to learn the AP MLD MAC address instead of
having to wait until this address is included in an EAPOL-Key frame.
This is needed for FT protocol (where 4-way handshake is not used) and
it is also convenient to have the MLD MAC address available as soon as
possible to be able to decrypt frames and even to recognize some special
AP vs. STA cases when either the BSSID or the AP MLD MAC address might
be used.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2023-08-10 10:57:07 +03:00 committed by Jouni Malinen
parent 3973300b8d
commit 74e4a0a6f1

View file

@ -230,6 +230,17 @@ void bss_update(struct wlantest *wt, struct wlantest_bss *bss,
bss->mesh = elems->mesh_id != NULL; bss->mesh = elems->mesh_id != NULL;
if (is_zero_ether_addr(bss->mld_mac_addr) &&
elems->basic_mle && elems->basic_mle_len >= 2 + 1 + ETH_ALEN &&
elems->basic_mle[2] >= 1 + ETH_ALEN) {
os_memcpy(bss->mld_mac_addr, &elems->basic_mle[2 + 1],
ETH_ALEN);
wpa_printf(MSG_DEBUG,
"Learned AP MLD MAC Address from Beacon/Probe Response frame: "
MACSTR " (BSSID " MACSTR ")",
MAC2STR(bss->mld_mac_addr), MAC2STR(bss->bssid));
}
if (!update) if (!update)
return; return;