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 <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2023-08-25 11:19:24 +03:00 committed by Jouni Malinen
parent a83575df59
commit ff02f734ba
3 changed files with 9 additions and 5 deletions

View file

@ -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; struct wlantest_bss *bss;
dl_list_for_each(bss, &wt->bss, struct wlantest_bss, list) { 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; return bss;
} }

View file

@ -2138,7 +2138,7 @@ static void rx_mgmt_action_ft_request(struct wlantest *wt,
} }
bss = bss_find(wt, aa); bss = bss_find(wt, aa);
bss2 = bss_find_mld(wt, aa); bss2 = bss_find_mld(wt, aa, -1);
if (!bss) if (!bss)
bss = bss2; bss = bss2;
if (bss && bss2 && bss != bss2 && !sta_find(bss, spa)) 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); bss = bss_find(wt, aa);
bss2 = bss_find_mld(wt, aa); bss2 = bss_find_mld(wt, aa, -1);
if (!bss) if (!bss)
bss = bss2; bss = bss2;
if (bss && bss2 && bss != bss2 && !sta_find(bss, spa)) if (bss && bss2 && bss != bss2 && !sta_find(bss, spa))

View file

@ -296,7 +296,8 @@ void rx_data_80211_encap(struct wlantest *wt, const u8 *bssid,
const u8 *data, size_t len); const u8 *data, size_t len);
struct wlantest_bss * bss_find(struct wlantest *wt, const u8 *bssid); 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); struct wlantest_bss * bss_get(struct wlantest *wt, const u8 *bssid);
void bss_deinit(struct wlantest_bss *bss); void bss_deinit(struct wlantest_bss *bss);
void bss_update(struct wlantest *wt, struct wlantest_bss *bss, void bss_update(struct wlantest *wt, struct wlantest_bss *bss,