diff options
author | Andrew Yourtchenko <ayourtch@gmail.com> | 2019-09-11 14:14:43 +0000 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-09-25 22:19:59 +0000 |
commit | 2abe699d10450553148307bb614979902f2bf4b3 (patch) | |
tree | 0b6feb59bf4871c4f33e60bcefe9c122b0f19b06 /src/vlib | |
parent | cbc5e50cafa2c6e928c71513cd90b7c83f96ce99 (diff) |
interface: use the correct condition for checking if the pcap fd is open
The 9af7e2e87e used a comparison that fd is >= 0 to check that
the pcap needs closing. While the pcap_close() function does
reset the file descriptor to -1, the freshly initialized structure
has it equal to 0.
This causes the VPP to close stdin if the packets are being seen
on pg interface without the capture file being opened.
This triggers the vpp attempting to read from STDIN
(another bug), which results in running out of memory.
Change-Id: I11d61422701500a9b3e0dd52d59383f297d57f54
Type: fix
Fixes: 9af7e2e87e
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
(cherry picked from commit 4da1506d39eb8f67ed2c48c76916bb6bcca6fbf1)
Diffstat (limited to 'src/vlib')
-rw-r--r-- | src/vlib/main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vlib/main.c b/src/vlib/main.c index 2df935a5e17..f49790d28b5 100644 --- a/src/vlib/main.c +++ b/src/vlib/main.c @@ -2254,7 +2254,7 @@ vlib_pcap_dispatch_trace_configure (vlib_pcap_dispatch_trace_args_t * a) vlib_cli_output (vm, "Write %d packets to %s, and stop capture...", pm->n_packets_captured, pm->file_name); error = pcap_write (pm); - if (pm->file_descriptor >= 0) + if (pm->flags & PCAP_MAIN_INIT_DONE) pcap_close (pm); /* Report I/O errors... */ if (error) |