classify: honor pcap interface filter also when classify filter is used
[vpp.git] / src / vnet / ethernet / node.c
index c31e222..88b4a70 100644 (file)
@@ -44,7 +44,7 @@
 #include <vnet/devices/pipe/pipe.h>
 #include <vppinfra/sparse_vec.h>
 #include <vnet/l2/l2_bvi.h>
-#include <vnet/classify/trace_classify.h>
+#include <vnet/classify/pcap_classify.h>
 
 #define foreach_ethernet_input_next            \
   _ (PUNT, "error-punt")                       \
@@ -1169,38 +1169,13 @@ ethernet_input_trace (vlib_main_t * vm, vlib_node_runtime_t * node,
       n_left = from_frame->n_vectors;
       while (n_left > 0)
        {
-         int classify_filter_result;
          vlib_buffer_t *b0;
          bi0 = from[0];
          from++;
          n_left--;
          b0 = vlib_get_buffer (vm, bi0);
-         if (pp->filter_classify_table_index != ~0)
-           {
-             classify_filter_result =
-               vnet_is_packet_traced_inline
-               (b0, pp->filter_classify_table_index, 0 /* full classify */ );
-             if (classify_filter_result)
-               pcap_add_buffer (&pp->pcap_main, vm, bi0,
-                                pp->max_bytes_per_pkt);
-             continue;
-           }
-
-         if (pp->pcap_sw_if_index == 0 ||
-             pp->pcap_sw_if_index == vnet_buffer (b0)->sw_if_index[VLIB_RX])
-           {
-             vnet_hw_interface_t *hi =
-               vnet_get_sup_hw_interface
-               (vnm, vnet_buffer (b0)->sw_if_index[VLIB_RX]);
-
-             /* Capture pkt if not filtered, or if filter hits */
-             if (hi->trace_classify_table_index == ~0 ||
-                 vnet_is_packet_traced_inline
-                 (b0, hi->trace_classify_table_index,
-                  0 /* full classify */ ))
-               pcap_add_buffer (&pp->pcap_main, vm, bi0,
-                                pp->max_bytes_per_pkt);
-           }
+         if (vnet_is_packet_pcaped (pp, b0, ~0))
+           pcap_add_buffer (&pp->pcap_main, vm, bi0, pp->max_bytes_per_pkt);
        }
     }
 }