diff options
author | Dave Barach <dave@barachs.net> | 2019-11-20 09:28:31 -0500 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-11-20 17:39:17 +0000 |
commit | d28437cdf2133533c9092b881ce0e4c243d6c1f6 (patch) | |
tree | a678817510990cf73b68444fd6f6fff1fc5a4329 /src/vnet/ethernet | |
parent | e51a9bbe7693294e2e1021f13697fa97b02a89fb (diff) |
classify: per-interface rx/tx pcap capture filters
Finish the feature, and fix a couple of doc bugs
Type: feature
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I2c62745fda137776204c8fc4fca0e7e288051573
Diffstat (limited to 'src/vnet/ethernet')
-rwxr-xr-x | src/vnet/ethernet/node.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/vnet/ethernet/node.c b/src/vnet/ethernet/node.c index 9c9143dd4ba..428a8d5662c 100755 --- a/src/vnet/ethernet/node.c +++ b/src/vnet/ethernet/node.c @@ -1125,8 +1125,18 @@ ethernet_input_trace (vlib_main_t * vm, vlib_node_runtime_t * node, if (pp->pcap_sw_if_index == 0 || pp->pcap_sw_if_index == vnet_buffer (b0)->sw_if_index[VLIB_RX]) { - pcap_add_buffer (&pp->pcap_main, vm, bi0, - pp->max_bytes_per_pkt); + vnet_main_t *vnm = vnet_get_main (); + 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); } } } |