classify: add bpf support to pcap classifier
[vpp.git] / src / vnet / classify / pcap_classify.h
index 1f1c38f..a4ebcd1 100644 (file)
@@ -33,6 +33,7 @@ vnet_is_packet_pcaped (vnet_pcap_t *pp, vlib_buffer_t *b, u32 sw_if_index)
 {
   const u32 pcap_sw_if_index = pp->pcap_sw_if_index;
   const u32 filter_classify_table_index = pp->filter_classify_table_index;
+  const vlib_error_t pcap_error_index = pp->pcap_error_index;
 
   if (pcap_sw_if_index != 0)
     {
@@ -42,12 +43,15 @@ vnet_is_packet_pcaped (vnet_pcap_t *pp, vlib_buffer_t *b, u32 sw_if_index)
        return 0; /* wrong interface, skip */
     }
 
+  if (pcap_error_index != (vlib_error_t) ~0 && pcap_error_index != b->error)
+    return 0; /* wrong error */
+
   if (filter_classify_table_index != ~0 &&
-      vnet_is_packet_traced_inline (b, filter_classify_table_index,
-                                   0 /* full classify */) != 1)
+      pp->current_filter_function (b, filter_classify_table_index,
+                                  0 /* full classify */) != 1)
     return 0; /* not matching the filter, skip */
 
-  return 1; /* success */
+  return 1;
 }
 
 /*