summaryrefslogtreecommitdiffstats
path: root/src/plugins/flowprobe
diff options
context:
space:
mode:
authorAlexander Chernavin <achernavin@netgate.com>2023-10-11 12:15:55 +0000
committerMatthew Smith <mgsmith@netgate.com>2023-10-12 22:15:20 +0000
commit120095d3d33bfac64c1f3c870f8a332eeaf638f0 (patch)
tree89732bda264b2aabbdc887e70c07c21c948ace1c /src/plugins/flowprobe
parent006c071b0a5f0bfc1302bad17cf018792ea2f712 (diff)
flowprobe: fix sending L2 flows using L2_IP6 template
Currently, L2 flows are exported using L2_IP6 template if L3 or L4 recording is enabled on L2 datapath. That occurs because during feature enable, L2 template is added and its ID is not saved immediately. Then L2_IP4 and L2_IP6 templates are added overwriting "template_id" each time. And in the end, the current value of "template_id" is saved for L2 template. The problem is that "template_id" at that point contains the ID of L2_IP6 template. With this fix, save the template ID immediately after adding a template for all variants (datapaths). Also, cover the case with a test. Type: fix Change-Id: Id27288043b3b8f0e89e77f45ae9a01fa7439e20e Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
Diffstat (limited to 'src/plugins/flowprobe')
-rw-r--r--src/plugins/flowprobe/flowprobe.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/plugins/flowprobe/flowprobe.c b/src/plugins/flowprobe/flowprobe.c
index 058a642bcd5..3b060bec529 100644
--- a/src/plugins/flowprobe/flowprobe.c
+++ b/src/plugins/flowprobe/flowprobe.c
@@ -554,6 +554,7 @@ flowprobe_interface_add_del_feature (flowprobe_main_t *fm, u32 sw_if_index,
flowprobe_data_callback_l2,
flowprobe_template_rewrite_l2,
is_add, &template_id);
+ fm->template_reports[flags] = (is_add) ? template_id : 0;
}
if (fm->record & FLOW_RECORD_L3 || fm->record & FLOW_RECORD_L4)
{
@@ -576,20 +577,22 @@ flowprobe_interface_add_del_feature (flowprobe_main_t *fm, u32 sw_if_index,
flags | FLOW_RECORD_L2_IP4;
fm->context[FLOW_VARIANT_L2_IP6].flags =
flags | FLOW_RECORD_L2_IP6;
-
- fm->template_reports[flags] = template_id;
}
}
else if (which == FLOW_VARIANT_IP4)
- rv = flowprobe_template_add_del (1, UDP_DST_PORT_ipfix, flags,
- flowprobe_data_callback_ip4,
- flowprobe_template_rewrite_ip4,
- is_add, &template_id);
+ {
+ rv = flowprobe_template_add_del (
+ 1, UDP_DST_PORT_ipfix, flags, flowprobe_data_callback_ip4,
+ flowprobe_template_rewrite_ip4, is_add, &template_id);
+ fm->template_reports[flags] = (is_add) ? template_id : 0;
+ }
else if (which == FLOW_VARIANT_IP6)
- rv = flowprobe_template_add_del (1, UDP_DST_PORT_ipfix, flags,
- flowprobe_data_callback_ip6,
- flowprobe_template_rewrite_ip6,
- is_add, &template_id);
+ {
+ rv = flowprobe_template_add_del (
+ 1, UDP_DST_PORT_ipfix, flags, flowprobe_data_callback_ip6,
+ flowprobe_template_rewrite_ip6, is_add, &template_id);
+ fm->template_reports[flags] = (is_add) ? template_id : 0;
+ }
}
if (rv && rv != VNET_API_ERROR_VALUE_EXIST)
{
@@ -600,7 +603,6 @@ flowprobe_interface_add_del_feature (flowprobe_main_t *fm, u32 sw_if_index,
if (which != (u8) ~ 0)
{
fm->context[which].flags = fm->record;
- fm->template_reports[flags] = (is_add) ? template_id : 0;
}
if (direction == FLOW_DIRECTION_RX || direction == FLOW_DIRECTION_BOTH)