aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/readpcap.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-05-26 16:39:48 (GMT)
committerJouni Malinen <j@w1.fi>2013-05-26 17:58:42 (GMT)
commitba2beacc974c2ab9576e86707a0d3ccfb5f93c1b (patch)
treeae67dcd4d96be224105241cf15f08c987f559b85 /wlantest/readpcap.c
parenteb4737f6df53079ded33825323fb3217bd625f57 (diff)
downloadhostap-ba2beacc974c2ab9576e86707a0d3ccfb5f93c1b.zip
hostap-ba2beacc974c2ab9576e86707a0d3ccfb5f93c1b.tar.gz
hostap-ba2beacc974c2ab9576e86707a0d3ccfb5f93c1b.tar.bz2
wlantest: Add support for writing pcapng files
The new -n<file> command line argument can be used to request wlantest to write all read or captured frames into a pcapng file. This is similar to the -w argument, but with pcapng allowing per-frame comments to be embedded in the file. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wlantest/readpcap.c')
-rw-r--r--wlantest/readpcap.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/wlantest/readpcap.c b/wlantest/readpcap.c
index 6243bc8..7c3ce18 100644
--- a/wlantest/readpcap.c
+++ b/wlantest/readpcap.c
@@ -73,6 +73,10 @@ int read_cap_file(struct wlantest *wt, const char *fname)
wpa_printf(MSG_DEBUG, "pcap datalink type: %d", dlt);
for (;;) {
+ clear_notes(wt);
+ os_free(wt->decrypted);
+ wt->decrypted = NULL;
+
res = pcap_next_ex(pcap, &hdr, &data);
if (res == -2)
break; /* No more packets */
@@ -100,9 +104,10 @@ int read_cap_file(struct wlantest *wt, const char *fname)
pcap_dump(wt->write_pcap_dumper, hdr, data);
}
if (hdr->caplen < hdr->len) {
- wpa_printf(MSG_DEBUG, "pcap: Dropped incomplete frame "
- "(%u/%u captured)",
- hdr->caplen, hdr->len);
+ add_note(wt, MSG_DEBUG, "pcap: Dropped incomplete "
+ "frame (%u/%u captured)",
+ hdr->caplen, hdr->len);
+ write_pcapng_write_read(wt, dlt, hdr, data);
continue;
}
count++;
@@ -115,7 +120,9 @@ int read_cap_file(struct wlantest *wt, const char *fname)
break;
case DLT_IEEE802_11:
wlantest_process_80211(wt, data, hdr->caplen);
+ break;
}
+ write_pcapng_write_read(wt, dlt, hdr, data);
}
pcap_close(pcap);