aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/pg/output.c
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2019-09-11 14:14:43 +0000
committerDamjan Marion <dmarion@me.com>2019-09-23 12:42:38 +0000
commit4da1506d39eb8f67ed2c48c76916bb6bcca6fbf1 (patch)
tree10770efa0d803802cd074ea6014954c50625ff88 /src/vnet/pg/output.c
parent1c887d9362f6c819e7fcf5b3bdecbeb386c9152b (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>
Diffstat (limited to 'src/vnet/pg/output.c')
-rw-r--r--src/vnet/pg/output.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vnet/pg/output.c b/src/vnet/pg/output.c
index b5ee157b4c6..d8059fab186 100644
--- a/src/vnet/pg/output.c
+++ b/src/vnet/pg/output.c
@@ -79,7 +79,7 @@ pg_output (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
}
if (pif->pcap_file_name != 0)
pcap_write (&pif->pcap_main);
- if (pif->pcap_main.file_descriptor >= 0
+ if ((pif->pcap_main.flags & PCAP_MAIN_INIT_DONE)
&& pif->pcap_main.n_packets_captured >=
pif->pcap_main.n_packets_to_capture)
pcap_close (&pif->pcap_main);