From 9ec6449e298ed10695c4afbba951ac46daa52e43 Mon Sep 17 00:00:00 2001 From: Paul Atkins Date: Tue, 21 Sep 2021 20:49:12 +0100 Subject: ipfix-export: refactor fields in flow_report_main Pull out the fields in flow_report_main_t that are specific to a single exporter and move them into a new structure that represents an exporter. Add a pool of exporters to flow_report_main_t and do a pool_get() to get the entry at index 0, so that the existing users of the code need only change the path at which they access the old fields and have no need to make further code changes. In functions that were accessing the fields that now make up the ipfix_exporter create a local var that points to the first (always valid) exporter and use this as the base for the fields rather than finding them from flow_report_main. This is in preparation for supporting multiple flow_exporters. Note that at the moment the code supports multiple 'streams' for a given exporter, where each stream has its own source port, domain id and template space. But all streams within an exporter have the same destination address, so this is not the same as multiple exporters. Type: refactor Signed-off-by: Paul Atkins Change-Id: I49f5c7fb9e901773351d31dc8a59178c37e99301 --- src/plugins/flowprobe/flowprobe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins/flowprobe/flowprobe.c') diff --git a/src/plugins/flowprobe/flowprobe.c b/src/plugins/flowprobe/flowprobe.c index ffc43bcd440..ff49b0b94e4 100644 --- a/src/plugins/flowprobe/flowprobe.c +++ b/src/plugins/flowprobe/flowprobe.c @@ -223,8 +223,9 @@ flowprobe_template_rewrite_inline (flow_report_main_t * frm, flowprobe_main_t *fm = &flowprobe_main; flowprobe_record_t flags = fr->opaque.as_uword; bool collect_ip4 = false, collect_ip6 = false; + ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0); - stream = &frm->streams[fr->stream_index]; + stream = &exp->streams[fr->stream_index]; if (flags & FLOW_RECORD_L3) { -- cgit 1.2.3-korg