From 74e4a0a6f1e420e2f5492a54c8786b5288ec1533 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 10 Aug 2023 10:57:07 +0300 Subject: [PATCH] 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 --- wlantest/bss.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/wlantest/bss.c b/wlantest/bss.c index 4fc0b17a7..5b7a2e49f 100644 --- a/wlantest/bss.c +++ b/wlantest/bss.c @@ -230,6 +230,17 @@ void bss_update(struct wlantest *wt, struct wlantest_bss *bss, 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) return;