classify: pcap / packet trace debug CLI bugs
[vpp.git] / src / vnet / interface_cli.c
index 9de674a..2e5714c 100644 (file)
@@ -52,6 +52,7 @@
 #include <vnet/fib/ip6_fib.h>
 #include <vnet/l2/l2_output.h>
 #include <vnet/l2/l2_input.h>
+#include <vnet/classify/vnet_classify.h>
 
 static int
 compare_interface_names (void *a1, void *a2)
@@ -781,9 +782,6 @@ create_sub_interfaces (vlib_main_t * vm,
          continue;
        }
 
-      kp = clib_mem_alloc (sizeof (*kp));
-      *kp = sup_and_sub_key;
-
       template.type = VNET_SW_INTERFACE_TYPE_SUB;
       template.flood_class = VNET_FLOOD_CLASS_NORMAL;
       template.sup_sw_if_index = hi->sw_if_index;
@@ -795,6 +793,9 @@ create_sub_interfaces (vlib_main_t * vm,
       if (error)
        goto done;
 
+      kp = clib_mem_alloc (sizeof (*kp));
+      *kp = sup_and_sub_key;
+
       hash_set (hi->sub_interface_sw_if_index_by_id, id, sw_if_index);
       hash_set_mem (im->sw_if_index_by_sup_and_sub, kp, sw_if_index);
       vlib_cli_output (vm, "%U\n", format_vnet_sw_if_index_name,
@@ -1953,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)