From c2d476b26dead1097f120a2bf35cda904c4f55f9 Mon Sep 17 00:00:00 2001 From: Paul Atkins Date: Mon, 4 Oct 2021 16:29:52 +0100 Subject: 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 Change-Id: I36dec394f30e85cdca120dd8706b5d90f5e07c48 --- src/plugins/ioam/analyse/ioam_summary_export.c | 10 ++++------ src/plugins/ioam/analyse/ioam_summary_export.h | 6 ++---- src/plugins/ioam/udp-ping/udp_ping_export.c | 10 ++++------ 3 files changed, 10 insertions(+), 16 deletions(-) (limited to 'src/plugins/ioam') diff --git a/src/plugins/ioam/analyse/ioam_summary_export.c b/src/plugins/ioam/analyse/ioam_summary_export.c index c9cc0770a8c..9fbeaa2ac9a 100644 --- a/src/plugins/ioam/analyse/ioam_summary_export.c +++ b/src/plugins/ioam/analyse/ioam_summary_export.c @@ -21,10 +21,8 @@ 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 collector_port, ipfix_report_element_t *elts, + u32 n_elts, u32 *stream_index) { ip4_header_t *ip; udp_header_t *udp; @@ -74,8 +72,8 @@ ioam_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 (collector_port); udp->dst_port = clib_host_to_net_u16 (UDP_DST_PORT_ipfix); udp->length = clib_host_to_net_u16 (vec_len (rewrite) - sizeof (*ip)); diff --git a/src/plugins/ioam/analyse/ioam_summary_export.h b/src/plugins/ioam/analyse/ioam_summary_export.h index 8c604b9b04a..7d1c5d00829 100644 --- a/src/plugins/ioam/analyse/ioam_summary_export.h +++ b/src/plugins/ioam/analyse/ioam_summary_export.h @@ -66,10 +66,8 @@ typedef struct clib_error_t *ioam_flow_create (u8 del); 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 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 d8926aa01d4..3dc1436a1a9 100644 --- a/src/plugins/ioam/udp-ping/udp_ping_export.c +++ b/src/plugins/ioam/udp-ping/udp_ping_export.c @@ -24,13 +24,11 @@ static u8 * 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) + u16 collector_port, ipfix_report_element_t *elts, + u32 n_elts, u32 *stream_index) { - return ioam_template_rewrite (exp, fr, collector_address, src_address, - collector_port, elts, n_elts, stream_index); + return ioam_template_rewrite (exp, fr, collector_port, elts, n_elts, + stream_index); } static vlib_frame_t * -- cgit 1.2.3-korg