diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vnet/interface_output.c | 2 | ||||
-rw-r--r-- | src/vnet/pg/output.c | 5 | ||||
-rw-r--r-- | src/vppinfra/pcap.c | 3 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c index 30462532fed..9702a9e31ee 100644 --- a/src/vnet/interface_output.c +++ b/src/vnet/interface_output.c @@ -1441,6 +1441,8 @@ pcap_drop_trace_command_fn (vlib_main_t * vm, im->pcap_main.n_packets_to_capture = im->pcap_main.n_packets_captured; error = pcap_write (&im->pcap_main); + if (im->pcap_main.file_descriptor >= 0) + pcap_close (&im->pcap_main); if (error) clib_error_report (error); else diff --git a/src/vnet/pg/output.c b/src/vnet/pg/output.c index a84f30301dc..b5ee157b4c6 100644 --- a/src/vnet/pg/output.c +++ b/src/vnet/pg/output.c @@ -79,7 +79,10 @@ 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 + && pif->pcap_main.n_packets_captured >= + pif->pcap_main.n_packets_to_capture) + pcap_close (&pif->pcap_main); vlib_buffer_free (vm, vlib_frame_vector_args (frame), n_buffers); if (PREDICT_FALSE (pif->lockp != 0)) diff --git a/src/vppinfra/pcap.c b/src/vppinfra/pcap.c index 8f644e30f1d..0ca923e81cf 100644 --- a/src/vppinfra/pcap.c +++ b/src/vppinfra/pcap.c @@ -157,9 +157,6 @@ pcap_write (pcap_main_t * pm) pm->n_pcap_data_written = 0; } - if (pm->n_packets_captured >= pm->n_packets_to_capture) - pcap_close (pm); - done: if (error) { |