From 82831cae2d171da4d1c6f13bd75be2be8f792f91 Mon Sep 17 00:00:00 2001 From: emanuele-f Date: Tue, 25 Jan 2022 11:31:14 +0100 Subject: [PATCH] Provide recv stats when reading from file --- app/src/main/jni/pcapd/pcapd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/jni/pcapd/pcapd.c b/app/src/main/jni/pcapd/pcapd.c index 787f5f5d..516fd287 100644 --- a/app/src/main/jni/pcapd/pcapd.c +++ b/app/src/main/jni/pcapd/pcapd.c @@ -839,6 +839,12 @@ static int read_pkt(pcapd_runtime_t *rt, pcapd_iface_t *iface, time_t now) { printf("[%s:%d] %s (%u B) [%cX]\n", iface->name, iface->ifid, buf, phdr.len, is_tx ? 'T' : 'R'); } + + if(iface->is_file) { + // libpcap does not provide stats for savefiles + // https://www.tcpdump.org/manpages/pcap_stats.3pcap.html + iface->stats.ps_recv++; + } } } }