classify: pcap / packet trace debug CLI bugs 44/24544/2
authorDave Barach <dave@barachs.net>
Mon, 27 Jan 2020 14:56:58 +0000 (09:56 -0500)
committerDamjan Marion <dmarion@me.com>
Mon, 27 Jan 2020 20:43:29 +0000 (20:43 +0000)
"classify filter trace ... " and "classify filter pcap ..." are
mutually exclusive.

vnet_pcap_dispatch_trace_configure needs to check for
set->table_indices == NULL.

Type: fix
Ticket: VPP-1827

Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I43733364087ffb0a43de92e450955033431d559d

extras/pcapcli/setup.tracefilter
src/vnet/classify/vnet_classify.c
src/vnet/interface_cli.c

index e6c8629..db07a0e 100644 (file)
@@ -17,4 +17,6 @@ packet-generator new {
     }
 }
 
-classify filter trace mask l3 ip4 src match l3 ip4 src 192.168.1.15
+comment { Pick one, uncomment, and "pcap rx ..." or "trace add pg-input ..." }
+comment { classify filter trace mask l3 ip4 src match l3 ip4 src 192.168.1.15 }
+comment { classify filter pcap mask l3 ip4 src match l3 ip4 src 192.168.1.15 }
index b461463..bb9e52a 100755 (executable)
@@ -1744,6 +1744,10 @@ classify_filter_command_fn (vlib_main_t * vm,
   if (sw_if_index == ~0 && pkt_trace == 0 && pcap == 0)
     return clib_error_return (0, "Must specify trace, pcap or interface...");
 
+  if (pkt_trace && pcap)
+    return clib_error_return
+      (0, "Packet trace and pcap are mutually exclusive...");
+
   if (pkt_trace && sw_if_index != ~0)
     return clib_error_return (0, "Packet trace filter is per-system");
 
index 8fb315b..2e5714c 100644 (file)
@@ -1954,7 +1954,7 @@ vnet_pcap_dispatch_trace_configure (vnet_pcap_dispatch_trace_args_t * a)
 
   /* Classify filter specified, but no classify filter configured */
   if ((a->rx_enable + a->tx_enable + a->drop_enable) && a->filter &&
-      (set->table_indices[0] == ~0))
+      (set->table_indices == 0 || set->table_indices[0] == ~0))
     return VNET_API_ERROR_NO_SUCH_LABEL;
 
   if (a->rx_enable + a->tx_enable + a->drop_enable)