aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/readpcap.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/readpcap.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/readpcap.c')
-rw-r--r--wlantest/readpcap.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/wlantest/readpcap.c b/wlantest/readpcap.c
index bd93d7b..ecb5ae2 100644
--- a/wlantest/readpcap.c
+++ b/wlantest/readpcap.c
@@ -27,6 +27,7 @@ int read_cap_file(struct wlantest *wt, const char *fname)
struct pcap_pkthdr *hdr;
const u_char *data;
int res;
+ int dlt;
pcap = pcap_open_offline(fname, errbuf);
if (pcap == NULL) {
@@ -34,6 +35,14 @@ int read_cap_file(struct wlantest *wt, const char *fname)
fname, errbuf);
return -1;
}
+ dlt = pcap_datalink(pcap);
+ if (dlt != DLT_IEEE802_11_RADIO && dlt != DLT_PRISM_HEADER) {
+ wpa_printf(MSG_ERROR, "Unsupported pcap datalink type: %d",
+ dlt);
+ pcap_close(pcap);
+ return -1;
+ }
+ wpa_printf(MSG_DEBUG, "pcap datalink type: %d", dlt);
for (;;) {
res = pcap_next_ex(pcap, &hdr, &data);
@@ -66,7 +75,14 @@ int read_cap_file(struct wlantest *wt, const char *fname)
continue;
}
count++;
- wlantest_process(wt, data, hdr->caplen);
+ switch (dlt) {
+ case DLT_IEEE802_11_RADIO:
+ wlantest_process(wt, data, hdr->caplen);
+ break;
+ case DLT_PRISM_HEADER:
+ wlantest_process_prism(wt, data, hdr->caplen);
+ break;
+ }
}
pcap_close(pcap);