interface: use the correct condition for checking if the pcap fd is open 56/22256/2
authorAndrew Yourtchenko <[email protected]>
Wed, 11 Sep 2019 14:14:43 +0000 (14:14 +0000)
committerDamjan Marion <[email protected]>
Wed, 25 Sep 2019 22:19:59 +0000 (22:19 +0000)
commit2abe699d10450553148307bb614979902f2bf4b3
tree0b6feb59bf4871c4f33e60bcefe9c122b0f19b06
parentcbc5e50cafa2c6e928c71513cd90b7c83f96ce99
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 <[email protected]>
(cherry picked from commit 4da1506d39eb8f67ed2c48c76916bb6bcca6fbf1)
src/vlib/main.c
src/vnet/interface_cli.c
src/vnet/interface_output.c
src/vnet/pg/output.c