From ff02f734baf871583135c07e1018832c5e6c0e3f Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 25 Aug 2023 11:19:24 +0300 Subject: [PATCH] wlantest: Allow specific link BSS to be found with bss_find_mld() Make this function more capable to address cases where a specific affiliated link of an AP MLD needs to be found. Signed-off-by: Jouni Malinen --- wlantest/bss.c | 7 +++++-- wlantest/rx_mgmt.c | 4 ++-- wlantest/wlantest.h | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/wlantest/bss.c b/wlantest/bss.c index 64e4421ae..01c9c6242 100644 --- a/wlantest/bss.c +++ b/wlantest/bss.c @@ -29,12 +29,15 @@ 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_find_mld(struct wlantest *wt, const u8 *mld_mac_addr, + int link_id) { 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) + if (os_memcmp(bss->mld_mac_addr, mld_mac_addr, ETH_ALEN) == 0 && + (link_id < 0 || + (bss->link_id_set && bss->link_id == link_id))) return bss; } diff --git a/wlantest/rx_mgmt.c b/wlantest/rx_mgmt.c index c4fc06a97..82a2255c2 100644 --- a/wlantest/rx_mgmt.c +++ b/wlantest/rx_mgmt.c @@ -2138,7 +2138,7 @@ static void rx_mgmt_action_ft_request(struct wlantest *wt, } bss = bss_find(wt, aa); - bss2 = bss_find_mld(wt, aa); + bss2 = bss_find_mld(wt, aa, -1); if (!bss) bss = bss2; if (bss && bss2 && bss != bss2 && !sta_find(bss, spa)) @@ -2199,7 +2199,7 @@ static void rx_mgmt_action_ft_response(struct wlantest *wt, } bss = bss_find(wt, aa); - bss2 = bss_find_mld(wt, aa); + bss2 = bss_find_mld(wt, aa, -1); if (!bss) bss = bss2; if (bss && bss2 && bss != bss2 && !sta_find(bss, spa)) diff --git a/wlantest/wlantest.h b/wlantest/wlantest.h index 3668c753f..65ae74cb4 100644 --- a/wlantest/wlantest.h +++ b/wlantest/wlantest.h @@ -296,7 +296,8 @@ 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_find_mld(struct wlantest *wt, const u8 *mld_mac_addr, + int link_id); 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,