diff options
author | Denis Ovsienko <denis@ovsienko.info> | 2020-08-29 02:48:07 +0100 |
---|---|---|
committer | Denis Ovsienko <denis@ovsienko.info> | 2020-08-29 02:48:07 +0100 |
commit | 870eeabe8970db22c9c5f88d64b7b37bdd84bd49 (patch) | |
tree | 1dc681bf4c661c02512a4b9b08cd4d71e59ccc09 /tcpdump.c | |
parent | bc3bc62f51d022e86618a7c8d5408cbec06020c9 (diff) | |
download | tcpdump-870eeabe8970db22c9c5f88d64b7b37bdd84bd49.tar.gz |
Report periodic stats only when safe to do so. [skip ci]tcpdump-4.10.0-bp
As explained in GH #155, when tcpdump is given -r, -w and -v and it
takes long enough to read from the input file (because it is stdin
connected through network or a pipe to stdout of another tcpdump doing
a live capture), pcap_loop() will error before long. One of the ways to
reproduce the fault is as follows:
$ tcpdump -i eno1 -w - | tcpdump -r - -w /tmp/tmp.pcap -v
tcpdump: listening on eno1, link-type EN10MB (Ethernet), snapshot length 262144 bytes
reading from file -, link-type EN10MB (Ethernet), snapshot length 262144
tcpdump: pcap_loop: error reading dump file: Interrupted system call
Skip the verbose_stats_dump() timer setup in this specific corner case
for the time being and document it.
Diffstat (limited to 'tcpdump.c')
-rw-r--r-- | tcpdump.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -2438,11 +2438,14 @@ DIAG_ON_CLANG(assign-enum) (void)setsignal(SIGNAL_FLUSH_PCAP, flushpcap); #endif - if (ndo->ndo_vflag > 0 && WFileName && !print) { + if (ndo->ndo_vflag > 0 && WFileName && RFileName == NULL && !print) { /* * When capturing to a file, if "--print" wasn't specified, *"-v" means tcpdump should, once per second, * "v"erbosely report the number of packets captured. + * Except when reading from a file, because -r, -w and -v + * together used to make a corner case, in which pcap_loop() + * errored due to EINTR (see GH #155 for details). */ #ifdef _WIN32 /* |