aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/flowprobe/flowprobe.c115
-rw-r--r--src/plugins/ioam/analyse/ioam_summary_export.c23
-rw-r--r--src/plugins/ioam/analyse/ioam_summary_export.h10
-rw-r--r--src/plugins/ioam/udp-ping/udp_ping_export.c27
-rw-r--r--src/plugins/nat/lib/ipfix_logging.c152
-rw-r--r--src/vnet/ipfix-export/flow_api.c8
-rw-r--r--src/vnet/ipfix-export/flow_report.c36
-rw-r--r--src/vnet/ipfix-export/flow_report.h43
-rw-r--r--src/vnet/ipfix-export/flow_report_classify.c27
-rw-r--r--src/vnet/ipfix-export/flow_report_classify.h19
10 files changed, 209 insertions, 251 deletions
diff --git a/src/plugins/flowprobe/flowprobe.c b/src/plugins/flowprobe/flowprobe.c
index ff49b0b94e4..713ff8bce32 100644
--- a/src/plugins/flowprobe/flowprobe.c
+++ b/src/plugins/flowprobe/flowprobe.c
@@ -202,10 +202,9 @@ flowprobe_template_l4_fields (ipfix_field_specifier_t * f)
* @returns u8 * vector containing the indicated IPFIX template packet
*/
static inline u8 *
-flowprobe_template_rewrite_inline (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
+flowprobe_template_rewrite_inline (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address,
u16 collector_port,
flowprobe_variant_t which)
{
@@ -223,7 +222,6 @@ 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 = &exp->streams[fr->stream_index];
@@ -310,73 +308,62 @@ flowprobe_template_rewrite_inline (flow_report_main_t * frm,
}
static u8 *
-flowprobe_template_rewrite_ip6 (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
- u16 collector_port,
- ipfix_report_element_t * elts,
- u32 n_elts, u32 * stream_index)
+flowprobe_template_rewrite_ip6 (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address, u16 collector_port,
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index)
{
- return flowprobe_template_rewrite_inline
- (frm, fr, collector_address, src_address, collector_port,
- FLOW_VARIANT_IP6);
+ return flowprobe_template_rewrite_inline (
+ exp, fr, collector_address, src_address, collector_port, FLOW_VARIANT_IP6);
}
static u8 *
-flowprobe_template_rewrite_ip4 (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
- u16 collector_port,
- ipfix_report_element_t * elts,
- u32 n_elts, u32 * stream_index)
+flowprobe_template_rewrite_ip4 (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address, u16 collector_port,
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index)
{
- return flowprobe_template_rewrite_inline
- (frm, fr, collector_address, src_address, collector_port,
- FLOW_VARIANT_IP4);
+ return flowprobe_template_rewrite_inline (
+ exp, fr, collector_address, src_address, collector_port, FLOW_VARIANT_IP4);
}
static u8 *
-flowprobe_template_rewrite_l2 (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
- u16 collector_port,
- ipfix_report_element_t * elts,
- u32 n_elts, u32 * stream_index)
+flowprobe_template_rewrite_l2 (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address, u16 collector_port,
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index)
{
- return flowprobe_template_rewrite_inline
- (frm, fr, collector_address, src_address, collector_port,
- FLOW_VARIANT_L2);
+ return flowprobe_template_rewrite_inline (
+ exp, fr, collector_address, src_address, collector_port, FLOW_VARIANT_L2);
}
static u8 *
-flowprobe_template_rewrite_l2_ip4 (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
+flowprobe_template_rewrite_l2_ip4 (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address,
u16 collector_port,
- ipfix_report_element_t * elts,
- u32 n_elts, u32 * stream_index)
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index)
{
- return flowprobe_template_rewrite_inline
- (frm, fr, collector_address, src_address, collector_port,
- FLOW_VARIANT_L2_IP4);
+ return flowprobe_template_rewrite_inline (exp, fr, collector_address,
+ src_address, collector_port,
+ FLOW_VARIANT_L2_IP4);
}
static u8 *
-flowprobe_template_rewrite_l2_ip6 (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
+flowprobe_template_rewrite_l2_ip6 (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address,
u16 collector_port,
- ipfix_report_element_t * elts,
- u32 n_elts, u32 * stream_index)
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index)
{
- return flowprobe_template_rewrite_inline
- (frm, fr, collector_address, src_address, collector_port,
- FLOW_VARIANT_L2_IP6);
+ return flowprobe_template_rewrite_inline (exp, fr, collector_address,
+ src_address, collector_port,
+ FLOW_VARIANT_L2_IP6);
}
/**
@@ -390,27 +377,27 @@ flowprobe_template_rewrite_l2_ip6 (flow_report_main_t * frm,
* will be sent.
*/
vlib_frame_t *
-flowprobe_data_callback_ip4 (flow_report_main_t * frm,
- flow_report_t * fr,
- vlib_frame_t * f, u32 * to_next, u32 node_index)
+flowprobe_data_callback_ip4 (flow_report_main_t *frm, ipfix_exporter_t *exp,
+ flow_report_t *fr, vlib_frame_t *f, u32 *to_next,
+ u32 node_index)
{
flowprobe_flush_callback_ip4 ();
return f;
}
vlib_frame_t *
-flowprobe_data_callback_ip6 (flow_report_main_t * frm,
- flow_report_t * fr,
- vlib_frame_t * f, u32 * to_next, u32 node_index)
+flowprobe_data_callback_ip6 (flow_report_main_t *frm, ipfix_exporter_t *exp,
+ flow_report_t *fr, vlib_frame_t *f, u32 *to_next,
+ u32 node_index)
{
flowprobe_flush_callback_ip6 ();
return f;
}
vlib_frame_t *
-flowprobe_data_callback_l2 (flow_report_main_t * frm,
- flow_report_t * fr,
- vlib_frame_t * f, u32 * to_next, u32 node_index)
+flowprobe_data_callback_l2 (flow_report_main_t *frm, ipfix_exporter_t *exp,
+ flow_report_t *fr, vlib_frame_t *f, u32 *to_next,
+ u32 node_index)
{
flowprobe_flush_callback_l2 ();
return f;
@@ -423,7 +410,7 @@ flowprobe_template_add_del (u32 domain_id, u16 src_port,
vnet_flow_rewrite_callback_t * rewrite_callback,
bool is_add, u16 * template_id)
{
- flow_report_main_t *frm = &flow_report_main;
+ ipfix_exporter_t *exp = &flow_report_main.exporters[0];
vnet_flow_report_add_del_args_t a = {
.rewrite_callback = rewrite_callback,
.flow_data_callback = flow_data_callback,
@@ -432,7 +419,7 @@ flowprobe_template_add_del (u32 domain_id, u16 src_port,
.src_port = src_port,
.opaque.as_uword = flags,
};
- return vnet_flow_report_add_del (frm, &a, template_id);
+ return vnet_flow_report_add_del (exp, &a, template_id);
}
static void
diff --git a/src/plugins/ioam/analyse/ioam_summary_export.c b/src/plugins/ioam/analyse/ioam_summary_export.c
index 141c03a97de..c9cc0770a8c 100644
--- a/src/plugins/ioam/analyse/ioam_summary_export.c
+++ b/src/plugins/ioam/analyse/ioam_summary_export.c
@@ -20,11 +20,11 @@
#include <ioam/analyse/ip6/ip6_ioam_analyse.h>
u8 *
-ioam_template_rewrite (flow_report_main_t * frm, flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address, u16 collector_port,
- ipfix_report_element_t * elts,
- u32 n_elts, u32 * stream_index)
+ioam_template_rewrite (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address, u16 collector_port,
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index)
{
ip4_header_t *ip;
udp_header_t *udp;
@@ -38,7 +38,6 @@ ioam_template_rewrite (flow_report_main_t * frm, flow_report_t * fr,
u32 field_count = 0;
u32 field_index = 0;
flow_report_stream_t *stream;
- ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0);
stream = &exp->streams[fr->stream_index];
@@ -265,8 +264,9 @@ ioam_analyse_add_ipfix_record (flow_report_t * fr,
}
vlib_frame_t *
-ioam_send_flows (flow_report_main_t * frm, flow_report_t * fr,
- vlib_frame_t * f, u32 * to_next, u32 node_index)
+ioam_send_flows (flow_report_main_t *frm, ipfix_exporter_t *exp,
+ flow_report_t *fr, vlib_frame_t *f, u32 *to_next,
+ u32 node_index)
{
vlib_buffer_t *b0 = NULL;
u32 next_offset = 0;
@@ -280,13 +280,12 @@ ioam_send_flows (flow_report_main_t * frm, flow_report_t * fr,
u32 records_this_buffer;
u16 new_l0, old_l0;
ip_csum_t sum0;
- vlib_main_t *vm = frm->vlib_main;
+ vlib_main_t *vm = vlib_get_main ();
ip6_address_t temp;
ioam_analyser_data_t *record = NULL;
flow_report_stream_t *stream;
ioam_analyser_data_t *aggregated_data;
u16 data_len;
- ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0);
stream = &exp->streams[fr->stream_index];
@@ -401,7 +400,7 @@ ioam_flow_create (u8 del)
vnet_flow_report_add_del_args_t args;
int rv;
u32 domain_id = 0;
- flow_report_main_t *frm = &flow_report_main;
+ ipfix_exporter_t *exp = &flow_report_main.exporters[0];
u16 template_id;
clib_memset (&args, 0, sizeof (args));
@@ -410,7 +409,7 @@ ioam_flow_create (u8 del)
del ? (args.is_add = 0) : (args.is_add = 1);
args.domain_id = domain_id;
- rv = vnet_flow_report_add_del (frm, &args, &template_id);
+ rv = vnet_flow_report_add_del (exp, &args, &template_id);
switch (rv)
{
diff --git a/src/plugins/ioam/analyse/ioam_summary_export.h b/src/plugins/ioam/analyse/ioam_summary_export.h
index 99890ad43d9..8c604b9b04a 100644
--- a/src/plugins/ioam/analyse/ioam_summary_export.h
+++ b/src/plugins/ioam/analyse/ioam_summary_export.h
@@ -65,11 +65,11 @@ typedef struct
clib_error_t *ioam_flow_create (u8 del);
-u8 *ioam_template_rewrite (flow_report_main_t * frm, flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address, u16 collector_port,
- ipfix_report_element_t * elts,
- u32 n_elts, u32 * stream_index);
+u8 *ioam_template_rewrite (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address, u16 collector_port,
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index);
u16 ioam_analyse_add_ipfix_record (flow_report_t * fr,
ioam_analyser_data_t * record,
diff --git a/src/plugins/ioam/udp-ping/udp_ping_export.c b/src/plugins/ioam/udp-ping/udp_ping_export.c
index 84d8ddf9e93..d8926aa01d4 100644
--- a/src/plugins/ioam/udp-ping/udp_ping_export.c
+++ b/src/plugins/ioam/udp-ping/udp_ping_export.c
@@ -23,20 +23,20 @@
#define UDP_PING_EXPORT_RECORD_SIZE 400
static u8 *
-udp_ping_template_rewrite (flow_report_main_t * frm, flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address, u16 collector_port,
- ipfix_report_element_t * elts,
- u32 n_elts, u32 * stream_index)
+udp_ping_template_rewrite (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address, u16 collector_port,
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index)
{
- return ioam_template_rewrite (frm, fr, collector_address,
- src_address, collector_port, elts, n_elts,
- stream_index);
+ return ioam_template_rewrite (exp, fr, collector_address, src_address,
+ collector_port, elts, n_elts, stream_index);
}
static vlib_frame_t *
-udp_ping_send_flows (flow_report_main_t * frm, flow_report_t * fr,
- vlib_frame_t * f, u32 * to_next, u32 node_index)
+udp_ping_send_flows (flow_report_main_t *frm, ipfix_exporter_t *exp,
+ flow_report_t *fr, vlib_frame_t *f, u32 *to_next,
+ u32 node_index)
{
vlib_buffer_t *b0 = NULL;
u32 next_offset = 0;
@@ -50,13 +50,12 @@ udp_ping_send_flows (flow_report_main_t * frm, flow_report_t * fr,
u32 records_this_buffer;
u16 new_l0, old_l0;
ip_csum_t sum0;
- vlib_main_t *vm = frm->vlib_main;
+ vlib_main_t *vm = vlib_get_main ();
flow_report_stream_t *stream;
udp_ping_flow_data *stats;
ip46_udp_ping_flow *ip46_flow;
u16 src_port, dst_port;
u16 data_len;
- ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0);
stream = &exp->streams[fr->stream_index];
data_len = vec_len (udp_ping_main.ip46_flow);
@@ -231,7 +230,7 @@ udp_ping_flow_create (u8 del)
vnet_flow_report_add_del_args_t args;
int rv;
u32 domain_id = 0;
- flow_report_main_t *frm = &flow_report_main;
+ ipfix_exporter_t *exp = &flow_report_main.exporters[0];
u16 template_id;
clib_memset (&args, 0, sizeof (args));
@@ -241,7 +240,7 @@ udp_ping_flow_create (u8 del)
args.domain_id = domain_id;
args.src_port = UDP_DST_PORT_ipfix;
- rv = vnet_flow_report_add_del (frm, &args, &template_id);
+ rv = vnet_flow_report_add_del (exp, &args, &template_id);
switch (rv)
{
diff --git a/src/plugins/nat/lib/ipfix_logging.c b/src/plugins/nat/lib/ipfix_logging.c
index 9bdb50dc1c3..0b67a34b200 100644
--- a/src/plugins/nat/lib/ipfix_logging.c
+++ b/src/plugins/nat/lib/ipfix_logging.c
@@ -143,12 +143,10 @@ do { \
* @returns template packet
*/
static inline u8 *
-nat_template_rewrite (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
- u16 collector_port,
- nat_event_t event, quota_exceed_event_t quota_event)
+nat_template_rewrite (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address, u16 collector_port,
+ nat_event_t event, quota_exceed_event_t quota_event)
{
nat_ipfix_logging_main_t *silm = &nat_ipfix_logging_main;
ip4_header_t *ip;
@@ -163,7 +161,6 @@ nat_template_rewrite (flow_report_main_t * frm,
u32 field_count = 0;
flow_report_stream_t *stream;
u32 stream_index;
- ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0);
stream = &exp->streams[fr->stream_index];
@@ -391,97 +388,86 @@ nat_template_rewrite (flow_report_main_t * frm,
}
u8 *
-nat_template_rewrite_addr_exhausted (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
- u16 collector_port,
- ipfix_report_element_t *elts,
- u32 n_elts, u32 *stream_index)
+nat_template_rewrite_addr_exhausted (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address,
+ u16 collector_port,
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index)
{
- return nat_template_rewrite (frm, fr, collector_address, src_address,
- collector_port, NAT_ADDRESSES_EXHAUTED, 0);
+ return nat_template_rewrite (exp, fr, collector_address, src_address,
+ collector_port, NAT_ADDRESSES_EXHAUTED, 0);
}
u8 *
-nat_template_rewrite_nat44_session (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
- u16 collector_port,
- ipfix_report_element_t *elts,
- u32 n_elts, u32 *stream_index)
+nat_template_rewrite_nat44_session (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address,
+ u16 collector_port,
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index)
{
- return nat_template_rewrite (frm, fr, collector_address, src_address,
- collector_port, NAT44_SESSION_CREATE, 0);
+ return nat_template_rewrite (exp, fr, collector_address, src_address,
+ collector_port, NAT44_SESSION_CREATE, 0);
}
u8 *
-nat_template_rewrite_max_entries_per_usr (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
- u16 collector_port,
- ipfix_report_element_t *elts,
- u32 n_elts, u32 *stream_index)
+nat_template_rewrite_max_entries_per_usr (
+ ipfix_exporter_t *exp, flow_report_t *fr, ip4_address_t *collector_address,
+ ip4_address_t *src_address, u16 collector_port, ipfix_report_element_t *elts,
+ u32 n_elts, u32 *stream_index)
{
- return nat_template_rewrite (frm, fr, collector_address, src_address,
- collector_port, QUOTA_EXCEEDED,
- MAX_ENTRIES_PER_USER);
+ return nat_template_rewrite (exp, fr, collector_address, src_address,
+ collector_port, QUOTA_EXCEEDED,
+ MAX_ENTRIES_PER_USER);
}
u8 *
-nat_template_rewrite_max_sessions (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
+nat_template_rewrite_max_sessions (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address,
u16 collector_port,
- ipfix_report_element_t *elts,
- u32 n_elts, u32 *stream_index)
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index)
{
- return nat_template_rewrite (frm, fr, collector_address, src_address,
- collector_port, QUOTA_EXCEEDED,
- MAX_SESSION_ENTRIES);
+ return nat_template_rewrite (exp, fr, collector_address, src_address,
+ collector_port, QUOTA_EXCEEDED,
+ MAX_SESSION_ENTRIES);
}
u8 *
-nat_template_rewrite_max_bibs (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
- u16 collector_port,
- ipfix_report_element_t *elts,
- u32 n_elts, u32 *stream_index)
+nat_template_rewrite_max_bibs (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address, u16 collector_port,
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index)
{
- return nat_template_rewrite (frm, fr, collector_address, src_address,
- collector_port, QUOTA_EXCEEDED,
- MAX_BIB_ENTRIES);
+ return nat_template_rewrite (exp, fr, collector_address, src_address,
+ collector_port, QUOTA_EXCEEDED,
+ MAX_BIB_ENTRIES);
}
u8 *
-nat_template_rewrite_nat64_bib (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
- u16 collector_port,
- ipfix_report_element_t *elts,
- u32 n_elts, u32 *stream_index)
+nat_template_rewrite_nat64_bib (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address, u16 collector_port,
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index)
{
- return nat_template_rewrite (frm, fr, collector_address, src_address,
- collector_port, NAT64_BIB_CREATE, 0);
+ return nat_template_rewrite (exp, fr, collector_address, src_address,
+ collector_port, NAT64_BIB_CREATE, 0);
}
u8 *
-nat_template_rewrite_nat64_session (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
- u16 collector_port,
- ipfix_report_element_t *elts,
- u32 n_elts, u32 *stream_index)
+nat_template_rewrite_nat64_session (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address,
+ u16 collector_port,
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index)
{
- return nat_template_rewrite (frm, fr, collector_address, src_address,
- collector_port, NAT64_SESSION_CREATE, 0);
+ return nat_template_rewrite (exp, fr, collector_address, src_address,
+ collector_port, NAT64_SESSION_CREATE, 0);
}
static inline void
@@ -1479,11 +1465,11 @@ nat_ipfix_logging_nat64_session (u32 thread_index,
}
vlib_frame_t *
-data_callback (flow_report_main_t * frm, flow_report_t * fr,
- vlib_frame_t * f, u32 * to_next, u32 node_index)
+data_callback (flow_report_main_t *frm, ipfix_exporter_t *exp,
+ flow_report_t *fr, vlib_frame_t *f, u32 *to_next,
+ u32 node_index)
{
nat_ipfix_logging_main_t *silm = &nat_ipfix_logging_main;
- ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0);
if (PREDICT_FALSE (++silm->call_counter >= vec_len (exp->reports)))
{
@@ -1507,7 +1493,7 @@ int
nat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
{
nat_ipfix_logging_main_t *silm = &nat_ipfix_logging_main;
- flow_report_main_t *frm = &flow_report_main;
+ ipfix_exporter_t *exp = &flow_report_main.exporters[0];
vnet_flow_report_add_del_args_t a;
int rv;
u8 e = enable ? 1 : 0;
@@ -1522,7 +1508,7 @@ nat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
a.flow_data_callback = data_callback;
a.rewrite_callback = nat_template_rewrite_nat44_session;
- rv = vnet_flow_report_add_del (frm, &a, NULL);
+ rv = vnet_flow_report_add_del (exp, &a, NULL);
if (rv)
{
//nat_elog_warn_X1 ("vnet_flow_report_add_del returned %d", "i4", rv);
@@ -1530,7 +1516,7 @@ nat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
}
a.rewrite_callback = nat_template_rewrite_addr_exhausted;
- rv = vnet_flow_report_add_del (frm, &a, NULL);
+ rv = vnet_flow_report_add_del (exp, &a, NULL);
if (rv)
{
//nat_elog_warn_X1 ("vnet_flow_report_add_del returned %d", "i4", rv);
@@ -1538,7 +1524,7 @@ nat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
}
a.rewrite_callback = nat_template_rewrite_max_sessions;
- rv = vnet_flow_report_add_del (frm, &a, NULL);
+ rv = vnet_flow_report_add_del (exp, &a, NULL);
if (rv)
{
//nat_elog_warn_X1 ("vnet_flow_report_add_del returned %d", "i4", rv);
@@ -1546,7 +1532,7 @@ nat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
}
a.rewrite_callback = nat_template_rewrite_max_bibs;
- rv = vnet_flow_report_add_del (frm, &a, NULL);
+ rv = vnet_flow_report_add_del (exp, &a, NULL);
if (rv)
{
//nat_elog_warn_X1 ("vnet_flow_report_add_del returned %d", "i4", rv);
@@ -1554,7 +1540,7 @@ nat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
}
a.rewrite_callback = nat_template_rewrite_nat64_bib;
- rv = vnet_flow_report_add_del (frm, &a, NULL);
+ rv = vnet_flow_report_add_del (exp, &a, NULL);
if (rv)
{
//nat_elog_warn_X1 ("vnet_flow_report_add_del returned %d", "i4", rv);
@@ -1562,7 +1548,7 @@ nat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
}
a.rewrite_callback = nat_template_rewrite_nat64_session;
- rv = vnet_flow_report_add_del (frm, &a, NULL);
+ rv = vnet_flow_report_add_del (exp, &a, NULL);
if (rv)
{
//nat_elog_warn_X1 ("vnet_flow_report_add_del returned %d", "i4", rv);
@@ -1572,7 +1558,7 @@ nat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
// if endpoint dependent per user max entries is also required
/*
a.rewrite_callback = nat_template_rewrite_max_entries_per_usr;
- rv = vnet_flow_report_add_del (frm, &a, NULL);
+ rv = vnet_flow_report_add_del (exp, &a, NULL);
if (rv)
{
//nat_elog_warn_X1 ("vnet_flow_report_add_del returned %d", "i4", rv);
diff --git a/src/vnet/ipfix-export/flow_api.c b/src/vnet/ipfix-export/flow_api.c
index 7e4f1fe8626..3636168139d 100644
--- a/src/vnet/ipfix-export/flow_api.c
+++ b/src/vnet/ipfix-export/flow_api.c
@@ -117,7 +117,7 @@ vl_api_set_ipfix_exporter_t_handler (vl_api_set_ipfix_exporter_t * mp)
if (exp->ipfix_collector.as_u32 != collector.as_u32 ||
exp->src_address.as_u32 != src.as_u32 ||
exp->collector_port != collector_port)
- vnet_flow_reports_reset (frm);
+ vnet_flow_reports_reset (exp);
exp->ipfix_collector.as_u32 = collector.as_u32;
exp->collector_port = collector_port;
@@ -183,6 +183,7 @@ static void
vl_api_set_ipfix_classify_stream_reply_t *rmp;
flow_report_classify_main_t *fcm = &flow_report_classify_main;
flow_report_main_t *frm = &flow_report_main;
+ ipfix_exporter_t *exp = &frm->exporters[0];
u32 domain_id = 0;
u32 src_port = UDP_DST_PORT_ipfix;
int rv = 0;
@@ -193,7 +194,7 @@ static void
if (fcm->src_port != 0 &&
(fcm->domain_id != domain_id || fcm->src_port != (u16) src_port))
{
- int rv = vnet_stream_change (frm, fcm->domain_id, fcm->src_port,
+ int rv = vnet_stream_change (exp, fcm->domain_id, fcm->src_port,
domain_id, (u16) src_port);
ASSERT (rv == 0);
}
@@ -234,6 +235,7 @@ static void
vl_api_registration_t *reg;
flow_report_classify_main_t *fcm = &flow_report_classify_main;
flow_report_main_t *frm = &flow_report_main;
+ ipfix_exporter_t *exp = &frm->exporters[0];
vnet_flow_report_add_del_args_t args;
ipfix_classify_table_t *table;
int is_add;
@@ -299,7 +301,7 @@ static void
args.domain_id = fcm->domain_id;
args.src_port = fcm->src_port;
- rv = vnet_flow_report_add_del (frm, &args, NULL);
+ rv = vnet_flow_report_add_del (exp, &args, NULL);
/* If deleting, or add failed */
if (is_add == 0 || (rv && is_add))
diff --git a/src/vnet/ipfix-export/flow_report.c b/src/vnet/ipfix-export/flow_report.c
index 0da47e11cb4..cc042799d5a 100644
--- a/src/vnet/ipfix-export/flow_report.c
+++ b/src/vnet/ipfix-export/flow_report.c
@@ -101,7 +101,7 @@ send_template_packet (flow_report_main_t * frm,
if (fr->update_rewrite)
{
fr->rewrite = fr->rewrite_callback (
- frm, fr, &exp->ipfix_collector, &exp->src_address, exp->collector_port,
+ exp, fr, &exp->ipfix_collector, &exp->src_address, exp->collector_port,
fr->report_elements, fr->n_report_elements, fr->stream_indexp);
fr->update_rewrite = 0;
}
@@ -155,13 +155,12 @@ send_template_packet (flow_report_main_t * frm,
}
u8 *
-vnet_flow_rewrite_generic_callback (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
+vnet_flow_rewrite_generic_callback (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address,
u16 collector_port,
- ipfix_report_element_t * report_elts,
- u32 n_elts, u32 * stream_indexp)
+ ipfix_report_element_t *report_elts,
+ u32 n_elts, u32 *stream_indexp)
{
ip4_header_t *ip;
udp_header_t *udp;
@@ -175,7 +174,6 @@ vnet_flow_rewrite_generic_callback (flow_report_main_t * frm,
flow_report_stream_t *stream;
int i;
ipfix_report_element_t *ep;
- ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0);
ASSERT (stream_indexp);
ASSERT (n_elts);
@@ -316,7 +314,7 @@ flow_report_process (vlib_main_t * vm,
nf->n_vectors++;
}
- nf = fr->flow_data_callback (frm, fr, nf, to_next,
+ nf = fr->flow_data_callback (frm, exp, fr, nf, to_next,
ip4_lookup_node_index);
if (nf)
vlib_put_frame_to_node (vm, ip4_lookup_node_index, nf);
@@ -335,16 +333,14 @@ VLIB_REGISTER_NODE (flow_report_process_node) = {
/* *INDENT-ON* */
int
-vnet_flow_report_add_del (flow_report_main_t * frm,
- vnet_flow_report_add_del_args_t * a,
- u16 * template_id)
+vnet_flow_report_add_del (ipfix_exporter_t *exp,
+ vnet_flow_report_add_del_args_t *a, u16 *template_id)
{
int i;
int found_index = ~0;
flow_report_t *fr;
flow_report_stream_t *stream;
u32 si;
- ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0);
si = find_stream (exp, a->domain_id, a->src_port);
if (si == -2)
@@ -437,11 +433,10 @@ flow_report_add_del_error_to_clib_error (int error)
}
void
-vnet_flow_reports_reset (flow_report_main_t * frm)
+vnet_flow_reports_reset (ipfix_exporter_t *exp)
{
flow_report_t *fr;
u32 i;
- ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0);
for (i = 0; i < vec_len (exp->streams); i++)
if (stream_index_valid (exp, i))
@@ -455,10 +450,9 @@ vnet_flow_reports_reset (flow_report_main_t * frm)
}
void
-vnet_stream_reset (flow_report_main_t * frm, u32 stream_index)
+vnet_stream_reset (ipfix_exporter_t *exp, u32 stream_index)
{
flow_report_t *fr;
- ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0);
exp->streams[stream_index].sequence_number = 0;
@@ -471,11 +465,9 @@ vnet_stream_reset (flow_report_main_t * frm, u32 stream_index)
}
int
-vnet_stream_change (flow_report_main_t * frm,
- u32 old_domain_id, u16 old_src_port,
+vnet_stream_change (ipfix_exporter_t *exp, u32 old_domain_id, u16 old_src_port,
u32 new_domain_id, u16 new_src_port)
{
- ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0);
i32 stream_index = find_stream (exp, old_domain_id, old_src_port);
if (stream_index < 0)
@@ -484,7 +476,7 @@ vnet_stream_change (flow_report_main_t * frm,
stream->domain_id = new_domain_id;
stream->src_port = new_src_port;
if (old_domain_id != new_domain_id || old_src_port != new_src_port)
- vnet_stream_reset (frm, stream_index);
+ vnet_stream_reset (exp, stream_index);
return 0;
}
@@ -546,7 +538,7 @@ set_ipfix_exporter_command_fn (vlib_main_t * vm,
if (exp->ipfix_collector.as_u32 != collector.as_u32 ||
exp->src_address.as_u32 != src.as_u32 ||
exp->collector_port != collector_port)
- vnet_flow_reports_reset (frm);
+ vnet_flow_reports_reset (exp);
exp->ipfix_collector.as_u32 = collector.as_u32;
exp->collector_port = collector_port;
diff --git a/src/vnet/ipfix-export/flow_report.h b/src/vnet/ipfix-export/flow_report.h
index d1f308011b8..7f0c92d3a92 100644
--- a/src/vnet/ipfix-export/flow_report.h
+++ b/src/vnet/ipfix-export/flow_report.h
@@ -47,25 +47,23 @@ typedef struct
struct flow_report_main;
struct flow_report;
+struct ipfix_exporter;
-typedef vlib_frame_t *(vnet_flow_data_callback_t) (struct flow_report_main *,
- struct flow_report *,
- vlib_frame_t *, u32 *,
- u32);
+typedef vlib_frame_t *(vnet_flow_data_callback_t) (
+ struct flow_report_main *frm, struct ipfix_exporter *exp,
+ struct flow_report *, vlib_frame_t *, u32 *, u32);
-typedef u8 *(vnet_flow_rewrite_callback_t) (struct flow_report_main *,
+typedef u8 *(vnet_flow_rewrite_callback_t) (struct ipfix_exporter *exp,
struct flow_report *,
- ip4_address_t *,
- ip4_address_t *, u16,
- ipfix_report_element_t * elts,
- u32 n_elts, u32 * stream_index);
-
-u8 *vnet_flow_rewrite_generic_callback (struct flow_report_main *,
- struct flow_report *,
- ip4_address_t *,
+ ip4_address_t *, ip4_address_t *,
+ u16, ipfix_report_element_t *elts,
+ u32 n_elts, u32 *stream_index);
+
+u8 *vnet_flow_rewrite_generic_callback (struct ipfix_exporter *exp,
+ struct flow_report *, ip4_address_t *,
ip4_address_t *, u16,
- ipfix_report_element_t * elts,
- u32 n_elts, u32 * stream_index);
+ ipfix_report_element_t *elts,
+ u32 n_elts, u32 *stream_index);
typedef union
{
@@ -174,19 +172,18 @@ typedef struct
u32 *stream_indexp;
} vnet_flow_report_add_del_args_t;
-int vnet_flow_report_add_del (flow_report_main_t * frm,
- vnet_flow_report_add_del_args_t * a,
- u16 * template_id);
+int vnet_flow_report_add_del (ipfix_exporter_t *exp,
+ vnet_flow_report_add_del_args_t *a,
+ u16 *template_id);
clib_error_t *flow_report_add_del_error_to_clib_error (int error);
-void vnet_flow_reports_reset (flow_report_main_t * frm);
+void vnet_flow_reports_reset (ipfix_exporter_t *exp);
-void vnet_stream_reset (flow_report_main_t * frm, u32 stream_index);
+void vnet_stream_reset (ipfix_exporter_t *exp, u32 stream_index);
-int vnet_stream_change (flow_report_main_t * frm,
- u32 old_domain_id, u16 old_src_port,
- u32 new_domain_id, u16 new_src_port);
+int vnet_stream_change (ipfix_exporter_t *exp, u32 old_domain_id,
+ u16 old_src_port, u32 new_domain_id, u16 new_src_port);
#endif /* __included_vnet_flow_report_h__ */
diff --git a/src/vnet/ipfix-export/flow_report_classify.c b/src/vnet/ipfix-export/flow_report_classify.c
index 35abf979bd9..717d2966fbf 100644
--- a/src/vnet/ipfix-export/flow_report_classify.c
+++ b/src/vnet/ipfix-export/flow_report_classify.c
@@ -29,13 +29,12 @@ typedef struct
flow_report_classify_main_t flow_report_classify_main;
u8 *
-ipfix_classify_template_rewrite (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
+ipfix_classify_template_rewrite (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address,
u16 collector_port,
- ipfix_report_element_t * elts,
- u32 n_elts, u32 * stream_index)
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index)
{
flow_report_classify_main_t *fcm = &flow_report_classify_main;
vnet_classify_table_t *tblp;
@@ -60,7 +59,6 @@ ipfix_classify_template_rewrite (flow_report_main_t * frm,
u8 transport_protocol;
u8 *virt_mask;
u8 *real_mask;
- ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0);
stream = &exp->streams[fr->stream_index];
@@ -159,9 +157,9 @@ ipfix_classify_template_rewrite (flow_report_main_t * frm,
}
vlib_frame_t *
-ipfix_classify_send_flows (flow_report_main_t * frm,
- flow_report_t * fr,
- vlib_frame_t * f, u32 * to_next, u32 node_index)
+ipfix_classify_send_flows (flow_report_main_t *frm, ipfix_exporter_t *exp,
+ flow_report_t *fr, vlib_frame_t *f, u32 *to_next,
+ u32 node_index)
{
flow_report_classify_main_t *fcm = &flow_report_classify_main;
vnet_classify_main_t *vcm = &vnet_classify_main;
@@ -191,7 +189,6 @@ ipfix_classify_send_flows (flow_report_main_t * frm,
u8 ip_version;
u8 transport_protocol;
u8 *virt_key;
- ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0);
stream = &exp->streams[fr->stream_index];
@@ -399,7 +396,7 @@ ipfix_classify_table_add_del_command_fn (vlib_main_t * vm,
vlib_cli_command_t * cmd)
{
flow_report_classify_main_t *fcm = &flow_report_classify_main;
- flow_report_main_t *frm = &flow_report_main;
+ ipfix_exporter_t *exp = &flow_report_main.exporters[0];
vnet_flow_report_add_del_args_t args;
ipfix_classify_table_t *table;
int rv;
@@ -477,7 +474,7 @@ ipfix_classify_table_add_del_command_fn (vlib_main_t * vm,
args.domain_id = fcm->domain_id;
args.src_port = fcm->src_port;
- rv = vnet_flow_report_add_del (frm, &args, NULL);
+ rv = vnet_flow_report_add_del (exp, &args, NULL);
error = flow_report_add_del_error_to_clib_error (rv);
@@ -502,7 +499,7 @@ set_ipfix_classify_stream_command_fn (vlib_main_t * vm,
vlib_cli_command_t * cmd)
{
flow_report_classify_main_t *fcm = &flow_report_classify_main;
- flow_report_main_t *frm = &flow_report_main;
+ ipfix_exporter_t *exp = &flow_report_main.exporters[0];
u32 domain_id = 1;
u32 src_port = UDP_DST_PORT_ipfix;
@@ -520,7 +517,7 @@ set_ipfix_classify_stream_command_fn (vlib_main_t * vm,
if (fcm->src_port != 0 &&
(fcm->domain_id != domain_id || fcm->src_port != (u16) src_port))
{
- int rv = vnet_stream_change (frm, fcm->domain_id, fcm->src_port,
+ int rv = vnet_stream_change (exp, fcm->domain_id, fcm->src_port,
domain_id, (u16) src_port);
ASSERT (rv == 0);
}
diff --git a/src/vnet/ipfix-export/flow_report_classify.h b/src/vnet/ipfix-export/flow_report_classify.h
index a923f36714a..3199c85f68f 100644
--- a/src/vnet/ipfix-export/flow_report_classify.h
+++ b/src/vnet/ipfix-export/flow_report_classify.h
@@ -112,18 +112,17 @@ ipfix_classify_delete_table (u32 index)
fcm->tables[index].classify_table_index = ~0;
}
-u8 *ipfix_classify_template_rewrite (flow_report_main_t * frm,
- flow_report_t * fr,
- ip4_address_t * collector_address,
- ip4_address_t * src_address,
+u8 *ipfix_classify_template_rewrite (ipfix_exporter_t *exp, flow_report_t *fr,
+ ip4_address_t *collector_address,
+ ip4_address_t *src_address,
u16 collector_port,
- ipfix_report_element_t * elts,
- u32 n_elts, u32 * stream_index);
+ ipfix_report_element_t *elts, u32 n_elts,
+ u32 *stream_index);
-vlib_frame_t *ipfix_classify_send_flows (flow_report_main_t * frm,
- flow_report_t * fr,
- vlib_frame_t * f,
- u32 * to_next, u32 node_index);
+vlib_frame_t *ipfix_classify_send_flows (flow_report_main_t *frm,
+ ipfix_exporter_t *exp,
+ flow_report_t *fr, vlib_frame_t *f,
+ u32 *to_next, u32 node_index);
#endif /* __included_flow_report_classify_h__ */