interface: fix pcap tx/rx trace cli handling

Provide default packet_to_capture value. Display interface name
correctly for "pcap tx/rx trace status".

Type: fix

Signed-off-by: John Lo <loj@cisco.com>
Change-Id: I7064d0dbea236a9aff68bba7fbaf2c4a73b16c6f
Signed-off-by: John Lo <loj@cisco.com>
This commit is contained in:
John Lo
2019-08-01 15:15:36 -04:00
committed by Dave Barach
parent 49568afd20
commit 778ce57318
4 changed files with 7 additions and 16 deletions

View File

@ -1700,8 +1700,6 @@ pcap_trace_command_internal (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd, int rx_tx)
{
#define PCAP_DEF_PKT_TO_CAPTURE (1000)
unformat_input_t _line_input, *line_input = &_line_input;
u8 *filename;
u8 *chroot_filename = 0;
@ -1722,6 +1720,8 @@ pcap_trace_command_internal (vlib_main_t * vm,
if (vm->pcap[rx_tx].pcap_enable == 0)
{
enabled = 1;
vm->pcap[rx_tx].pcap_main.n_packets_to_capture =
PCAP_DEF_PKT_TO_CAPTURE;
}
else
{
@ -1812,9 +1812,7 @@ pcap_trace_command_internal (vlib_main_t * vm,
{
vlib_cli_output
(vm, "max is %d for any interface to file %s",
vm->pcap[rx_tx].pcap_main.n_packets_to_capture ?
vm->pcap[rx_tx].pcap_main.n_packets_to_capture
: PCAP_DEF_PKT_TO_CAPTURE,
vm->pcap[rx_tx].pcap_main.n_packets_to_capture,
vm->pcap[rx_tx].pcap_main.file_name ?
(u8 *) vm->pcap[rx_tx].pcap_main.file_name :
(u8 *) "/tmp/vpe.pcap");
@ -1822,10 +1820,7 @@ pcap_trace_command_internal (vlib_main_t * vm,
else
{
vlib_cli_output (vm, "max is %d for interface %U to file %s",
vm->pcap[rx_tx].pcap_main.n_packets_to_capture
? vm->pcap[rx_tx].
pcap_main.n_packets_to_capture :
PCAP_DEF_PKT_TO_CAPTURE,
vm->pcap[rx_tx].pcap_main.n_packets_to_capture,
format_vnet_sw_if_index_name, vnm,
vm->pcap[rx_tx].pcap_sw_if_index,
vm->pcap[rx_tx].