]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wlantest: Recognize non-AP MLD based on any link address for decryption
authorJouni Malinen <quic_jouni@quicinc.com>
Thu, 10 Aug 2023 08:22:47 +0000 (11:22 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 10 Aug 2023 09:14:31 +0000 (12:14 +0300)
Compare A1 against all the link addresses of a non-AP MLD when
determining whether a Data frame is from the non-AP MLD or the AP MLD
during a decryption attempt.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
wlantest/rx_data.c

index 2a03f5c9a37ca334b62dda141681e336274e1360..a3dca3e1631a707f8fad943acdf94e028d91be83 100644 (file)
@@ -376,6 +376,21 @@ skip_replay_det:
 }
 
 
+static bool is_sta_link_addr(struct wlantest_sta *sta, const u8 *addr)
+{
+       unsigned int link_id;
+
+       if (os_memcmp(addr, sta->addr, ETH_ALEN) == 0)
+               return true;
+       for (link_id = 0; link_id < MAX_NUM_MLO_LINKS; link_id++) {
+               if (os_memcmp(sta->link_addr[link_id], addr, ETH_ALEN) == 0)
+                       return true;
+       }
+
+       return false;
+}
+
+
 static u8 * try_ptk_decrypt(struct wlantest *wt, struct wlantest_sta *sta,
                            const struct ieee80211_hdr *hdr, int keyid,
                            const u8 *data, size_t len,
@@ -388,7 +403,7 @@ static u8 * try_ptk_decrypt(struct wlantest *wt, struct wlantest_sta *sta,
        if ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) &&
            !is_zero_ether_addr(sta->mld_mac_addr) &&
            !is_zero_ether_addr(sta->bss->mld_mac_addr)) {
-               if (os_memcmp(hdr->addr1, sta->addr, ETH_ALEN) == 0) {
+               if (is_sta_link_addr(sta, hdr->addr1)) {
                        a1 = sta->mld_mac_addr;
                        a2 = sta->bss->mld_mac_addr;
                } else {