From 5434a42ec69cfcd7bfbea65b83d31ba59ac73208 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 10 Aug 2023 11:42:06 +0300 Subject: [PATCH] wlantest: Search for FT Target AP using MLD MAC address as well When FT over-the-DS is used with MLO, the Target AP Address field is expected to identify the AP MLD using its MLD MAC address. Signed-off-by: Jouni Malinen --- wlantest/bss.c | 13 +++++++++++++ wlantest/rx_mgmt.c | 13 +++++++++++-- wlantest/wlantest.h | 1 + 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/wlantest/bss.c b/wlantest/bss.c index 5b7a2e49f..f34f674dd 100644 --- a/wlantest/bss.c +++ b/wlantest/bss.c @@ -29,6 +29,19 @@ struct wlantest_bss * bss_find(struct wlantest *wt, const u8 *bssid) } +struct wlantest_bss * bss_find_mld(struct wlantest *wt, const u8 *mld_mac_addr) +{ + struct wlantest_bss *bss; + + dl_list_for_each(bss, &wt->bss, struct wlantest_bss, list) { + if (os_memcmp(bss->mld_mac_addr, mld_mac_addr, ETH_ALEN) == 0) + return bss; + } + + return NULL; +} + + struct wlantest_bss * bss_get(struct wlantest *wt, const u8 *bssid) { struct wlantest_bss *bss; diff --git a/wlantest/rx_mgmt.c b/wlantest/rx_mgmt.c index 3a0755ccf..941158018 100644 --- a/wlantest/rx_mgmt.c +++ b/wlantest/rx_mgmt.c @@ -2084,7 +2084,7 @@ static void rx_mgmt_action_ft_response(struct wlantest *wt, const struct ieee80211_mgmt *mgmt, size_t len) { - struct wlantest_bss *bss; + struct wlantest_bss *bss, *bss2; struct wlantest_sta *new_sta; const u8 *ies; size_t ies_len; @@ -2113,7 +2113,16 @@ static void rx_mgmt_action_ft_response(struct wlantest *wt, return; } - bss = bss_get(wt, mgmt->u.action.u.ft_action_resp.target_ap_addr); + bss = bss_find(wt, mgmt->u.action.u.ft_action_resp.target_ap_addr); + bss2 = bss_find_mld(wt, mgmt->u.action.u.ft_action_resp.target_ap_addr); + if (!bss) + bss = bss2; + if (bss && bss2 && bss != bss2 && !sta_find(bss, sta->addr)) + bss = bss2; + if (!bss) + bss = bss_get(wt, + mgmt->u.action.u.ft_action_resp.target_ap_addr); + if (!bss) { add_note(wt, MSG_INFO, "No BSS entry for Target AP"); return; diff --git a/wlantest/wlantest.h b/wlantest/wlantest.h index 068cf3efb..befe09f87 100644 --- a/wlantest/wlantest.h +++ b/wlantest/wlantest.h @@ -294,6 +294,7 @@ void rx_data_80211_encap(struct wlantest *wt, const u8 *bssid, const u8 *data, size_t len); struct wlantest_bss * bss_find(struct wlantest *wt, const u8 *bssid); +struct wlantest_bss * bss_find_mld(struct wlantest *wt, const u8 *mld_mac_addr); struct wlantest_bss * bss_get(struct wlantest *wt, const u8 *bssid); void bss_deinit(struct wlantest_bss *bss); void bss_update(struct wlantest *wt, struct wlantest_bss *bss,