aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/process.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2010-12-02 20:56:37 (GMT)
committerJouni Malinen <j@w1.fi>2010-12-02 20:56:37 (GMT)
commit350132bec50b2dcc907082f1e9099cd006defedd (patch)
tree3814171803ab9c670fabfabded820ff6b5688866 /wlantest/process.c
parent482856c8ba2e516e6c5f159094bfce3c911af6d1 (diff)
downloadhostap-350132bec50b2dcc907082f1e9099cd006defedd.zip
hostap-350132bec50b2dcc907082f1e9099cd006defedd.tar.gz
hostap-350132bec50b2dcc907082f1e9099cd006defedd.tar.bz2
wlantest: Add support for reading pcap files with prism header
Diffstat (limited to 'wlantest/process.c')
-rw-r--r--wlantest/process.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/wlantest/process.c b/wlantest/process.c
index 7ca77b2..7890892 100644
--- a/wlantest/process.c
+++ b/wlantest/process.c
@@ -224,3 +224,41 @@ void wlantest_process(struct wlantest *wt, const u8 *data, size_t len)
else
tx_status(wt, frame, frame_len, !failed);
}
+
+
+void wlantest_process_prism(struct wlantest *wt, const u8 *data, size_t len)
+{
+ int fcs = 0;
+ const u8 *frame, *fcspos;
+ size_t frame_len;
+ u32 hdrlen;
+
+ wpa_hexdump(MSG_EXCESSIVE, "Process data", data, len);
+
+ if (len < 8)
+ return;
+ hdrlen = WPA_GET_LE32(data + 4);
+
+ if (len < hdrlen) {
+ wpa_printf(MSG_INFO, "Too short frame to include prism "
+ "header");
+ return;
+ }
+
+ frame = data + hdrlen;
+ frame_len = len - hdrlen;
+ fcs = 1;
+
+ if (fcs && frame_len >= 4) {
+ frame_len -= 4;
+ fcspos = frame + frame_len;
+ if (check_fcs(frame, frame_len, fcspos) < 0) {
+ wpa_printf(MSG_EXCESSIVE, "Drop RX frame with invalid "
+ "FCS");
+ wt->fcs_error++;
+ return;
+ }
+ }
+
+ rx_frame(wt, frame, frame_len);
+}