From 97302b39dca60759e495e169148a2181318723e0 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 8 Dec 2017 21:51:47 +0200 Subject: [PATCH] wlantest: Try harder to find a STA entry with PTK for 4-address frames Commit aab66128369c5953e70f867e997a54146bcca88b ('wlantest: Search bss/sta entry more thoroughly for 4-address frames') allowed wlantest to find a STA entry in this type of cases, but it was still possible for that STA entry to be the one that has no derived PTK while the STA entry for the other side of the link might have the derived PTK available. Extend this BSS/STA selection mechanism to use sta->ptk_set to determine which STA entry is more useful for decryption, i.e., select the one with a known PTK. Signed-off-by: Jouni Malinen --- wlantest/rx_data.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wlantest/rx_data.c b/wlantest/rx_data.c index ce9ab0d14..bafc33fd9 100644 --- a/wlantest/rx_data.c +++ b/wlantest/rx_data.c @@ -278,12 +278,15 @@ static void rx_data_bss_prot(struct wlantest *wt, if (sta) { sta->counters[ WLANTEST_STA_COUNTER_PROT_DATA_TX]++; - } else { + } + if (!sta || !sta->ptk_set) { bss2 = bss_find(wt, hdr->addr2); if (bss2) { - sta = sta_find(bss2, hdr->addr1); - if (sta) + sta2 = sta_find(bss2, hdr->addr1); + if (sta2 && (!sta || sta2->ptk_set)) { bss = bss2; + sta = sta2; + } } } } else {