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>
This commit is contained in:
parent
b488a12948
commit
4158b80eef
1 changed files with 8 additions and 2 deletions
|
@ -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,6 +235,7 @@ skip_replay_det:
|
|||
if (decrypted) {
|
||||
rx_data_process(wt, bss->bssid, NULL, dst, src, decrypted,
|
||||
dlen, 1, NULL);
|
||||
if (!replay)
|
||||
os_memcpy(bss->rsc[keyid], pn, 6);
|
||||
write_pcap_decrypted(wt, (const u8 *) hdr, hdrlen,
|
||||
decrypted, dlen);
|
||||
|
@ -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,6 +462,7 @@ skip_replay_det:
|
|||
const u8 *peer_addr = NULL;
|
||||
if (!(fc & (WLAN_FC_FROMDS | WLAN_FC_TODS)))
|
||||
peer_addr = hdr->addr1;
|
||||
if (!replay)
|
||||
os_memcpy(rsc, pn, 6);
|
||||
rx_data_process(wt, bss->bssid, sta->addr, dst, src, decrypted,
|
||||
dlen, 1, peer_addr);
|
||||
|
|
Loading…
Reference in a new issue