]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wlantest: Learn AP MLD MAC address from Beacon frames
authorJouni Malinen <quic_jouni@quicinc.com>
Thu, 10 Aug 2023 07:57:07 +0000 (10:57 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 10 Aug 2023 09:14:31 +0000 (12:14 +0300)
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>
wlantest/bss.c

index 4fc0b17a7bdde7751faee4e8d0a0f7cdf672ee49..5b7a2e49fa09913dcb1cf8a924750ffee2eb2844 100644 (file)
@@ -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;