aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2017-11-15 00:12:20 (GMT)
committerJouni Malinen <j@w1.fi>2017-11-15 00:12:20 (GMT)
commitaab66128369c5953e70f867e997a54146bcca88b (patch)
tree4609e9437d33ce23907d8e1cc626edb30468b20e
parentaf6614ca10d8e24eb5c9723f0c3dab45e7a29607 (diff)
downloadhostap-aab66128369c5953e70f867e997a54146bcca88b.zip
hostap-aab66128369c5953e70f867e997a54146bcca88b.tar.gz
hostap-aab66128369c5953e70f867e997a54146bcca88b.tar.bz2
wlantest: Search bss/sta entry more thoroughly for 4-address frames
Previous design worked for the case where only one of the devices was beaconing, but failed in one direction to find the PTK if both devices beaconed. Fix this by checking the A1/A2 fields in both directions if the first pick fails to find the sta entry. In addition, select the proper rsc value (rsc_tods vs. rsc_fromds) based on A2 (TA) value for ToDS+FromDS frames to avoid reporting incorrect replay issues. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
-rw-r--r--wlantest/rx_data.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/wlantest/rx_data.c b/wlantest/rx_data.c
index 6437b83..ce9ab0d 100644
--- a/wlantest/rx_data.c
+++ b/wlantest/rx_data.c
@@ -250,7 +250,7 @@ static void rx_data_bss_prot(struct wlantest *wt,
const u8 *qos, const u8 *dst, const u8 *src,
const u8 *data, size_t len)
{
- struct wlantest_bss *bss;
+ struct wlantest_bss *bss, *bss2;
struct wlantest_sta *sta, *sta2;
int keyid;
u16 fc = le_to_host16(hdr->frame_control);
@@ -275,9 +275,17 @@ static void rx_data_bss_prot(struct wlantest *wt,
bss = bss_find(wt, hdr->addr1);
if (bss) {
sta = sta_find(bss, hdr->addr2);
- if (sta)
+ if (sta) {
sta->counters[
WLANTEST_STA_COUNTER_PROT_DATA_TX]++;
+ } else {
+ bss2 = bss_find(wt, hdr->addr2);
+ if (bss2) {
+ sta = sta_find(bss2, hdr->addr1);
+ if (sta)
+ bss = bss2;
+ }
+ }
} else {
bss = bss_find(wt, hdr->addr2);
if (!bss)
@@ -393,6 +401,12 @@ static void rx_data_bss_prot(struct wlantest *wt,
rsc = tdls->rsc_init[tid];
else
rsc = tdls->rsc_resp[tid];
+ } else if ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) ==
+ (WLAN_FC_TODS | WLAN_FC_FROMDS)) {
+ if (os_memcmp(sta->addr, hdr->addr2, ETH_ALEN) == 0)
+ rsc = sta->rsc_tods[tid];
+ else
+ rsc = sta->rsc_fromds[tid];
} else if (fc & WLAN_FC_TODS)
rsc = sta->rsc_tods[tid];
else