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
This commit is contained in:

committed by
Damjan Marion

parent
e51a9bbe76
commit
d28437cdf2
@ -549,22 +549,30 @@ not, the CLI command add a new table and the indicated mask rule
|
||||
### Configure a simple pcap classify filter
|
||||
|
||||
```
|
||||
classify filter pcap mask l3 ip4 src match l3 ip4 src 192.168.1.11"
|
||||
pcap rx trace on max 100 filter
|
||||
classify filter pcap mask l3 ip4 src match l3 ip4 src 192.168.1.11
|
||||
pcap trace rx max 100 filter
|
||||
```
|
||||
|
||||
### Configure a simple interface packet-tracer filter
|
||||
### Configure a simple per-interface capture filter
|
||||
|
||||
```
|
||||
classify filter GigabitEthernet3/0/0 mask l3 ip4 src match l3 ip4 src 192.168.1.11"
|
||||
[device-driver debug CLI TBD]
|
||||
pcap trace rx max 100 intfc GigabitEthernet3/0/0
|
||||
```
|
||||
|
||||
Note that per-interface capture filters are _always_ applied.
|
||||
|
||||
### Clear per-interface capture filters
|
||||
|
||||
```
|
||||
classify filter GigabitEthernet3/0/0 del
|
||||
```
|
||||
|
||||
### Configure another fairly simple pcap classify filter
|
||||
|
||||
```
|
||||
classify filter pcap mask l3 ip4 src dst match l3 ip4 src 192.168.1.10 dst 192.168.2.10
|
||||
pcap tx trace on max 100 filter
|
||||
pcap trace tx max 100 filter
|
||||
```
|
||||
|
||||
### Clear all current classifier filters
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -503,7 +503,16 @@ static_always_inline void vnet_interface_pcap_tx_trace
|
||||
sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_TX];
|
||||
|
||||
if (pp->pcap_sw_if_index == 0 || pp->pcap_sw_if_index == sw_if_index)
|
||||
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, sw_if_index);
|
||||
/* 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user