aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/flowprobe
diff options
context:
space:
mode:
authorDaniel Béreš <daniel.beres@pantheon.tech>2021-11-11 09:16:44 +0000
committerOle Tr�an <otroan@employees.org>2021-11-14 09:27:00 +0000
commit8d76ccf9cca5991d2f9b18035989ccb0baca1798 (patch)
treeee0c9d89c4a61ddaeb9b10f80faa2ee1c5ef7f3f /src/plugins/flowprobe
parent3ef8bf36605a8f83a5d070713a2c88e23c2fc3a9 (diff)
flowprobe: right values in records from subinterfaces
Skip 802.1q headers due to correct EtherType, ip addresses, ports. Ticket: VPP-1997 Type: fix Change-Id: I1a552fa6abe5b1459dd7d2c5ac6ad0f62c51417c Signed-off-by: Daniel Béreš <daniel.beres@pantheon.tech>
Diffstat (limited to 'src/plugins/flowprobe')
-rw-r--r--src/plugins/flowprobe/node.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/plugins/flowprobe/node.c b/src/plugins/flowprobe/node.c
index b164bf6eb15..fd5d60f7eac 100644
--- a/src/plugins/flowprobe/node.c
+++ b/src/plugins/flowprobe/node.c
@@ -400,9 +400,21 @@ add_to_flow_record_state (vlib_main_t * vm, vlib_node_runtime_t * node,
clib_memcpy_fast (k.dst_mac, eth->dst_address, 6);
k.ethertype = ethertype;
}
+ if (ethertype == ETHERNET_TYPE_VLAN)
+ {
+ /*VLAN TAG*/
+ ethernet_vlan_header_tv_t *ethv =
+ (ethernet_vlan_header_tv_t *) (&(eth->type));
+ /*Q in Q possibility */
+ while (clib_net_to_host_u16 (ethv->type) == ETHERNET_TYPE_VLAN)
+ {
+ ethv++;
+ }
+ k.ethertype = ethertype = clib_net_to_host_u16 ((ethv)->type);
+ }
if (collect_ip6 && ethertype == ETHERNET_TYPE_IP6)
{
- ip6 = (ip6_header_t *) (eth + 1);
+ ip6 = (ip6_header_t *) (b->data + vnet_buffer (b)->l3_hdr_offset);
if (flags & FLOW_RECORD_L3)
{
k.src_address.as_u64[0] = ip6->src_address.as_u64[0];
@@ -421,7 +433,7 @@ add_to_flow_record_state (vlib_main_t * vm, vlib_node_runtime_t * node,
}
if (collect_ip4 && ethertype == ETHERNET_TYPE_IP4)
{
- ip4 = (ip4_header_t *) (eth + 1);
+ ip4 = (ip4_header_t *) (b->data + vnet_buffer (b)->l3_hdr_offset);
if (flags & FLOW_RECORD_L3)
{
k.src_address.ip4.as_u32 = ip4->src_address.as_u32;