wlantest: Select BSS more carefully for MLO EAPOL-Key cases

Prefer a BSS entry that has a matching STA entry when processing
EAPOL-Key frames. This avoids issues where some combination of MLD
and/or link addresses are used in a sequence that could end up
generating two separate STA entries for the same non-AP MLD.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2023-01-10 12:00:59 +02:00 committed by Jouni Malinen
parent 0ba17557ea
commit 5c86622175

View file

@ -102,7 +102,7 @@ static void rx_data_eapol_key_1_of_4(struct wlantest *wt, const u8 *dst,
} else { } else {
bss = bss_find(wt, bssid); bss = bss_find(wt, bssid);
bss_mld = bss_find(wt, src); bss_mld = bss_find(wt, src);
if (bss_mld) if (bss_mld && (!bss || sta_find(bss_mld, src)))
bss = bss_get(wt, src); bss = bss_get(wt, src);
else else
bss = bss_get(wt, bssid); bss = bss_get(wt, bssid);
@ -349,7 +349,7 @@ static void rx_data_eapol_key_2_of_4(struct wlantest *wt, const u8 *dst,
} else { } else {
bss = bss_find(wt, bssid); bss = bss_find(wt, bssid);
bss_mld = bss_find(wt, dst); bss_mld = bss_find(wt, dst);
if (bss_mld) if (bss_mld && (!bss || sta_find(bss_mld, src)))
bss = bss_get(wt, dst); bss = bss_get(wt, dst);
else else
bss = bss_get(wt, bssid); bss = bss_get(wt, bssid);
@ -932,7 +932,7 @@ static void rx_data_eapol_key_3_of_4(struct wlantest *wt, const u8 *dst,
} else { } else {
bss = bss_find(wt, bssid); bss = bss_find(wt, bssid);
bss_mld = bss_find(wt, src); bss_mld = bss_find(wt, src);
if (bss_mld) if (bss_mld && (!bss || sta_find(bss_mld, src)))
bss = bss_get(wt, src); bss = bss_get(wt, src);
else else
bss = bss_get(wt, bssid); bss = bss_get(wt, bssid);
@ -1164,7 +1164,7 @@ static void rx_data_eapol_key_4_of_4(struct wlantest *wt, const u8 *dst,
} else { } else {
bss = bss_find(wt, bssid); bss = bss_find(wt, bssid);
bss_mld = bss_find(wt, dst); bss_mld = bss_find(wt, dst);
if (bss_mld) if (bss_mld && (!bss || sta_find(bss_mld, src)))
bss = bss_get(wt, dst); bss = bss_get(wt, dst);
else else
bss = bss_get(wt, bssid); bss = bss_get(wt, bssid);
@ -1235,7 +1235,7 @@ static void rx_data_eapol_key_1_of_2(struct wlantest *wt, const u8 *dst,
} else { } else {
bss = bss_find(wt, bssid); bss = bss_find(wt, bssid);
bss_mld = bss_find(wt, src); bss_mld = bss_find(wt, src);
if (bss_mld) if (bss_mld && (!bss || sta_find(bss_mld, src)))
bss = bss_get(wt, src); bss = bss_get(wt, src);
else else
bss = bss_get(wt, bssid); bss = bss_get(wt, bssid);
@ -1372,7 +1372,7 @@ static void rx_data_eapol_key_2_of_2(struct wlantest *wt, const u8 *dst,
} else { } else {
bss = bss_find(wt, bssid); bss = bss_find(wt, bssid);
bss_mld = bss_find(wt, dst); bss_mld = bss_find(wt, dst);
if (bss_mld) if (bss_mld && (!bss || sta_find(bss_mld, src)))
bss = bss_get(wt, dst); bss = bss_get(wt, dst);
else else
bss = bss_get(wt, bssid); bss = bss_get(wt, bssid);