aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2017-10-14 09:15:52 (GMT)
committerJouni Malinen <j@w1.fi>2017-10-16 10:11:36 (GMT)
commit4158b80eef04c32a42e3412dc36c430349fc8a92 (patch)
treeeeaf769e498dca5646b7a67d6e467ae3917a7030 /wlantest
parentb488a12948751f57871f09baa345e59b23959a41 (diff)
downloadhostap-4158b80eef04c32a42e3412dc36c430349fc8a92.zip
hostap-4158b80eef04c32a42e3412dc36c430349fc8a92.tar.gz
hostap-4158b80eef04c32a42e3412dc36c430349fc8a92.tar.bz2
wlantest: Do not update RSC on replays
This changes wlantest behavior to mark CCMP/TKIP replays for more cases in case a device is resetting its TSC. Previously, the RSC check got cleared on the first marked replay and the following packets were not marked as replays if they continued incrementing the PN even if that PN was below the highest value received with this key at some point in the past. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wlantest')
-rw-r--r--wlantest/rx_data.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/wlantest/rx_data.c b/wlantest/rx_data.c
index 384e4dc..23586ea 100644
--- a/wlantest/rx_data.c
+++ b/wlantest/rx_data.c
@@ -146,6 +146,7 @@ static void rx_data_bss_prot_group(struct wlantest *wt,
u8 *decrypted = NULL;
size_t dlen;
u8 pn[6];
+ int replay = 0;
bss = bss_get(wt, hdr->addr2);
if (bss == NULL)
@@ -211,6 +212,7 @@ static void rx_data_bss_prot_group(struct wlantest *wt,
" Retry" : "");
wpa_hexdump(MSG_INFO, "RX PN", pn, 6);
wpa_hexdump(MSG_INFO, "RSC", bss->rsc[keyid], 6);
+ replay = 1;
}
skip_replay_det:
@@ -233,7 +235,8 @@ skip_replay_det:
if (decrypted) {
rx_data_process(wt, bss->bssid, NULL, dst, src, decrypted,
dlen, 1, NULL);
- os_memcpy(bss->rsc[keyid], pn, 6);
+ if (!replay)
+ os_memcpy(bss->rsc[keyid], pn, 6);
write_pcap_decrypted(wt, (const u8 *) hdr, hdrlen,
decrypted, dlen);
} else
@@ -259,6 +262,7 @@ static void rx_data_bss_prot(struct wlantest *wt,
const u8 *tk = NULL;
int ptk_iter_done = 0;
int try_ptk_iter = 0;
+ int replay = 0;
if (hdr->addr1[0] & 0x01) {
rx_data_bss_prot_group(wt, hdr, hdrlen, qos, dst, src,
@@ -413,6 +417,7 @@ static void rx_data_bss_prot(struct wlantest *wt,
" Retry" : "");
wpa_hexdump(MSG_INFO, "RX PN", pn, 6);
wpa_hexdump(MSG_INFO, "RSC", rsc, 6);
+ replay = 1;
}
skip_replay_det:
@@ -457,7 +462,8 @@ skip_replay_det:
const u8 *peer_addr = NULL;
if (!(fc & (WLAN_FC_FROMDS | WLAN_FC_TODS)))
peer_addr = hdr->addr1;
- os_memcpy(rsc, pn, 6);
+ if (!replay)
+ os_memcpy(rsc, pn, 6);
rx_data_process(wt, bss->bssid, sta->addr, dst, src, decrypted,
dlen, 1, peer_addr);
write_pcap_decrypted(wt, (const u8 *) hdr, hdrlen,