aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@codeaurora.org>2019-06-12 19:23:30 (GMT)
committerJouni Malinen <jouni@codeaurora.org>2019-06-12 19:27:34 (GMT)
commitb3c43c3c2449efe2d02304a8640d17baf11fb142 (patch)
tree24defdbdf9a319b473da6a7b0f56da44df1342a6
parenta6ed414c826647719b2b1e0cf37e75357275fa99 (diff)
downloadhostap-b3c43c3c2449efe2d02304a8640d17baf11fb142.zip
hostap-b3c43c3c2449efe2d02304a8640d17baf11fb142.tar.gz
hostap-b3c43c3c2449efe2d02304a8640d17baf11fb142.tar.bz2
wlantest: Allow duplicate frame processing after decryption failure
If a sniffer capture does not include FCS for each frame, but may included frames with invalid FCS, it would be possible for wlantest to try to decrypt the first received frame and fail (e.g., due to CCMP MIC mismatch) because that particular frame was corrupted and then ignore the following retry of that frame as a duplicate even if that retry has different payload (e.g., if its reception did not show corruption). Work around this by skipping duplicate frame detection immediately following a decryption failure. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
-rw-r--r--wlantest/process.c4
-rw-r--r--wlantest/rx_data.c12
-rw-r--r--wlantest/rx_mgmt.c6
-rw-r--r--wlantest/wlantest.h1
4 files changed, 20 insertions, 3 deletions
diff --git a/wlantest/process.c b/wlantest/process.c
index 54ddf6b..c496e0d 100644
--- a/wlantest/process.c
+++ b/wlantest/process.c
@@ -161,7 +161,8 @@ static int rx_duplicate(struct wlantest *wt, const struct ieee80211_hdr *hdr,
else
seq_ctrl = &sta->seq_ctrl_to_sta[tid];
- if ((fc & WLAN_FC_RETRY) && hdr->seq_ctrl == *seq_ctrl) {
+ if ((fc & WLAN_FC_RETRY) && hdr->seq_ctrl == *seq_ctrl &&
+ !sta->allow_duplicate) {
u16 s = le_to_host16(hdr->seq_ctrl);
add_note(wt, MSG_MSGDUMP, "Ignore duplicated frame (seq=%u "
"frag=%u A1=" MACSTR " A2=" MACSTR ")",
@@ -171,6 +172,7 @@ static int rx_duplicate(struct wlantest *wt, const struct ieee80211_hdr *hdr,
}
*seq_ctrl = hdr->seq_ctrl;
+ sta->allow_duplicate = 0;
return 0;
}
diff --git a/wlantest/rx_data.c b/wlantest/rx_data.c
index bafc33f..28202d8 100644
--- a/wlantest/rx_data.c
+++ b/wlantest/rx_data.c
@@ -485,8 +485,16 @@ skip_replay_det:
dlen, 1, peer_addr);
write_pcap_decrypted(wt, (const u8 *) hdr, hdrlen,
decrypted, dlen);
- } else if (!try_ptk_iter)
- add_note(wt, MSG_DEBUG, "Failed to decrypt frame");
+ } else {
+ if (!try_ptk_iter)
+ add_note(wt, MSG_DEBUG, "Failed to decrypt frame");
+
+ /* Assume the frame was corrupted and there was no FCS to check.
+ * Allow retry of this particular frame to be processed so that
+ * it could end up getting decrypted if it was received without
+ * corruption. */
+ sta->allow_duplicate = 1;
+ }
os_free(decrypted);
}
diff --git a/wlantest/rx_mgmt.c b/wlantest/rx_mgmt.c
index 95ff258..c008138 100644
--- a/wlantest/rx_mgmt.c
+++ b/wlantest/rx_mgmt.c
@@ -1315,6 +1315,12 @@ static u8 * mgmt_ccmp_decrypt(struct wlantest *wt, const u8 *data, size_t len,
os_memcpy(frame + 24, decrypted, *dlen);
*dlen += 24;
}
+ } else {
+ /* Assume the frame was corrupted and there was no FCS to check.
+ * Allow retry of this particular frame to be processed so that
+ * it could end up getting decrypted if it was received without
+ * corruption. */
+ sta->allow_duplicate = 1;
}
os_free(decrypted);
diff --git a/wlantest/wlantest.h b/wlantest/wlantest.h
index bad005d..4e313e0 100644
--- a/wlantest/wlantest.h
+++ b/wlantest/wlantest.h
@@ -93,6 +93,7 @@ struct wlantest_sta {
le16 seq_ctrl_to_sta[17];
le16 seq_ctrl_to_ap[17];
+ int allow_duplicate;
int pwrmgt;
int pspoll;