aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorChristian E. Hopps <chopps@chopps.org>2019-09-27 14:35:32 -0400
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-08-12 11:16:27 +0000
commitc7e6b50fddca4f4d4580ba433a7c260372a27e00 (patch)
treea523b1dc5b8c0f3a054b5d677a3a048b7637b542 /src/vnet
parent99e0ee56ebac5fe224ecbf1204aacdcc79bf2ad4 (diff)
pg: don't leak open files in packet-generator
Fix pg code to close it's open file descriptors before zero'ing the pcap_main structure for re-use. Ticket: VPP-1780 Type: fix Signed-off-by: Christian E. Hopps <chopps@chopps.org> Change-Id: I32945c6476ae83b8d210ee67ac78db3e8f786f46 (cherry picked from commit 19871f25394fa9a4bfb55006092cbcc28b446c04)
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/pg/cli.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vnet/pg/cli.c b/src/vnet/pg/cli.c
index c43ff903e75..f78bb37bf61 100644
--- a/src/vnet/pg/cli.c
+++ b/src/vnet/pg/cli.c
@@ -93,7 +93,10 @@ pg_capture (pg_capture_args_t * a)
pi = pool_elt_at_index (pg->interfaces, a->dev_instance);
vec_free (pi->pcap_file_name);
+ if ((pi->pcap_main.flags & PCAP_MAIN_INIT_DONE))
+ pcap_close (&pi->pcap_main);
clib_memset (&pi->pcap_main, 0, sizeof (pi->pcap_main));
+ pi->pcap_main.file_descriptor = -1;
if (a->is_enabled == 0)
return 0;