summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorPaul Atkins <patkins@graphiant.com>2021-10-04 16:29:52 +0100
committerNeale Ranns <neale@graphiant.com>2021-11-22 09:30:09 +0000
commitc2d476b26dead1097f120a2bf35cda904c4f55f9 (patch)
treea59372deeef7aa31f017f8e3cffed49b244cc077 /src/vnet
parent19a5f23b23e4eec54d99f105725ddc4df7421a5c (diff)
ipfix-export: refactor params to the callback fns
When a new flow-report is created the caller provides 2 callback functions. These functions both take a pointer to the exporter, plus a pointer to the source and dest address. However the pointers to the address are not adding any value as these are always set to the src/dest addresses of the exporter (which is already being passed). Remove these parameters and leave the callback functions to get the addresses out of the exporter. Type: improvement Signed-off-by: Paul Atkins <patkins@graphiant.com> Change-Id: I36dec394f30e85cdca120dd8706b5d90f5e07c48
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/ipfix-export/flow_report.c10
-rw-r--r--src/vnet/ipfix-export/flow_report.h4
-rw-r--r--src/vnet/ipfix-export/flow_report_classify.c6
-rw-r--r--src/vnet/ipfix-export/flow_report_classify.h2
4 files changed, 7 insertions, 15 deletions
diff --git a/src/vnet/ipfix-export/flow_report.c b/src/vnet/ipfix-export/flow_report.c
index 55c3b4d789c..d2532f9e52f 100644
--- a/src/vnet/ipfix-export/flow_report.c
+++ b/src/vnet/ipfix-export/flow_report.c
@@ -101,8 +101,8 @@ send_template_packet (flow_report_main_t *frm, ipfix_exporter_t *exp,
if (fr->update_rewrite)
{
fr->rewrite = fr->rewrite_callback (
- exp, fr, &exp->ipfix_collector, &exp->src_address, exp->collector_port,
- fr->report_elements, fr->n_report_elements, fr->stream_indexp);
+ exp, fr, exp->collector_port, fr->report_elements,
+ fr->n_report_elements, fr->stream_indexp);
fr->update_rewrite = 0;
}
@@ -156,8 +156,6 @@ send_template_packet (flow_report_main_t *frm, ipfix_exporter_t *exp,
u8 *
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)
@@ -200,8 +198,8 @@ vnet_flow_rewrite_generic_callback (ipfix_exporter_t *exp, flow_report_t *fr,
ip->ip_version_and_header_length = 0x45;
ip->ttl = 254;
ip->protocol = IP_PROTOCOL_UDP;
- ip->src_address.as_u32 = src_address->as_u32;
- ip->dst_address.as_u32 = collector_address->as_u32;
+ ip->src_address.as_u32 = exp->src_address.as_u32;
+ ip->dst_address.as_u32 = exp->ipfix_collector.as_u32;
udp->src_port = clib_host_to_net_u16 (stream->src_port);
udp->dst_port = clib_host_to_net_u16 (collector_port);
udp->length = clib_host_to_net_u16 (vec_len (rewrite) - sizeof (*ip));
diff --git a/src/vnet/ipfix-export/flow_report.h b/src/vnet/ipfix-export/flow_report.h
index 6b884a2e28e..319533decac 100644
--- a/src/vnet/ipfix-export/flow_report.h
+++ b/src/vnet/ipfix-export/flow_report.h
@@ -56,13 +56,11 @@ typedef vlib_frame_t *(vnet_flow_data_callback_t) (
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 ipfix_exporter *exp,
- struct flow_report *, ip4_address_t *,
- ip4_address_t *, u16,
+ struct flow_report *, u16,
ipfix_report_element_t *elts,
u32 n_elts, u32 *stream_index);
diff --git a/src/vnet/ipfix-export/flow_report_classify.c b/src/vnet/ipfix-export/flow_report_classify.c
index 717d2966fbf..2c4285b287c 100644
--- a/src/vnet/ipfix-export/flow_report_classify.c
+++ b/src/vnet/ipfix-export/flow_report_classify.c
@@ -30,8 +30,6 @@ flow_report_classify_main_t flow_report_classify_main;
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)
@@ -108,8 +106,8 @@ ipfix_classify_template_rewrite (ipfix_exporter_t *exp, flow_report_t *fr,
ip->ip_version_and_header_length = 0x45;
ip->ttl = 254;
ip->protocol = IP_PROTOCOL_UDP;
- ip->src_address.as_u32 = src_address->as_u32;
- ip->dst_address.as_u32 = collector_address->as_u32;
+ ip->src_address.as_u32 = exp->src_address.as_u32;
+ ip->dst_address.as_u32 = exp->ipfix_collector.as_u32;
udp->src_port = clib_host_to_net_u16 (stream->src_port);
udp->dst_port = clib_host_to_net_u16 (collector_port);
udp->length = clib_host_to_net_u16 (vec_len (rewrite) - sizeof (*ip));
diff --git a/src/vnet/ipfix-export/flow_report_classify.h b/src/vnet/ipfix-export/flow_report_classify.h
index 3199c85f68f..8ca40688599 100644
--- a/src/vnet/ipfix-export/flow_report_classify.h
+++ b/src/vnet/ipfix-export/flow_report_classify.h
@@ -113,8 +113,6 @@ ipfix_classify_delete_table (u32 index)
}
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);