diff options
author | Paul Atkins <patkins@graphiant.com> | 2021-10-04 15:43:56 +0100 |
---|---|---|
committer | Neale Ranns <neale@graphiant.com> | 2021-11-22 09:30:09 +0000 |
commit | 5140484529d420af47d6aa8ffbe6818621d8b55f (patch) | |
tree | 0946e14e9556e5b63b2285a1562d92994d3db717 /src/plugins | |
parent | 0ea1485361dfd23fe5f2522495efb9990df5a790 (diff) |
ipfix-export: Change exp to use ip_address
Modify the ipfix_exporter to use ip_address instead of the ipv4 specific
version. Modify the current code so that it writes into the v4 specific
part of the address, i.e. we are not yet fully supporting IPv6. For the
exporter configured via the original API (the one that is always in slot0)
we will not support IPv6 addresses.
Type: improvement
Signed-off-by: Paul Atkins <patkins@graphiant.com>
Change-Id: Ic9854ac62aaee76a7a55a958234c456fd9828c4c
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/flowprobe/flowprobe.c | 4 | ||||
-rw-r--r-- | src/plugins/flowprobe/node.c | 7 | ||||
-rw-r--r-- | src/plugins/ioam/analyse/ioam_summary_export.c | 4 | ||||
-rw-r--r-- | src/plugins/nat/lib/ipfix_logging.c | 8 |
4 files changed, 12 insertions, 11 deletions
diff --git a/src/plugins/flowprobe/flowprobe.c b/src/plugins/flowprobe/flowprobe.c index 5e91a15ae18..27cb40093ec 100644 --- a/src/plugins/flowprobe/flowprobe.c +++ b/src/plugins/flowprobe/flowprobe.c @@ -260,8 +260,8 @@ flowprobe_template_rewrite_inline (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 = exp->src_address.as_u32; - ip->dst_address.as_u32 = exp->ipfix_collector.as_u32; + ip->src_address.as_u32 = exp->src_address.ip.ip4.as_u32; + ip->dst_address.as_u32 = exp->ipfix_collector.ip.ip4.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/plugins/flowprobe/node.c b/src/plugins/flowprobe/node.c index 611ce62956b..928d75225d8 100644 --- a/src/plugins/flowprobe/node.c +++ b/src/plugins/flowprobe/node.c @@ -575,8 +575,8 @@ flowprobe_export_send (vlib_main_t * vm, vlib_buffer_t * b0, ip->ttl = 254; ip->protocol = IP_PROTOCOL_UDP; ip->flags_and_fragment_offset = 0; - ip->src_address.as_u32 = exp->src_address.as_u32; - ip->dst_address.as_u32 = exp->ipfix_collector.as_u32; + ip->src_address.as_u32 = exp->src_address.ip.ip4.as_u32; + ip->dst_address.as_u32 = exp->ipfix_collector.ip.ip4.as_u32; udp->src_port = clib_host_to_net_u16 (stream->src_port); udp->dst_port = clib_host_to_net_u16 (exp->collector_port); udp->checksum = 0; @@ -943,7 +943,8 @@ flowprobe_walker_process (vlib_main_t * vm, * $$$$ Remove this check from here and track FRM status and disable * this process if required. */ - if (exp->ipfix_collector.as_u32 == 0 || exp->src_address.as_u32 == 0) + if (ip_address_is_zero (&exp->ipfix_collector) || + ip_address_is_zero (&exp->src_address)) { fm->disabled = true; return 0; diff --git a/src/plugins/ioam/analyse/ioam_summary_export.c b/src/plugins/ioam/analyse/ioam_summary_export.c index 9fbeaa2ac9a..ceec1551bea 100644 --- a/src/plugins/ioam/analyse/ioam_summary_export.c +++ b/src/plugins/ioam/analyse/ioam_summary_export.c @@ -72,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 = exp->src_address.as_u32; - ip->dst_address.as_u32 = exp->ipfix_collector.as_u32; + ip->src_address.as_u32 = exp->src_address.ip.ip4.as_u32; + ip->dst_address.as_u32 = exp->ipfix_collector.ip.ip4.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/nat/lib/ipfix_logging.c b/src/plugins/nat/lib/ipfix_logging.c index 1c39e853084..50dbb2b327a 100644 --- a/src/plugins/nat/lib/ipfix_logging.c +++ b/src/plugins/nat/lib/ipfix_logging.c @@ -238,8 +238,8 @@ nat_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 = exp->src_address.as_u32; - ip->dst_address.as_u32 = exp->ipfix_collector.as_u32; + ip->src_address.as_u32 = exp->src_address.ip.ip4.as_u32; + ip->dst_address.as_u32 = exp->ipfix_collector.ip.ip4.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)); @@ -490,8 +490,8 @@ nat_ipfix_header_create (flow_report_main_t * frm, ip->ttl = 254; ip->protocol = IP_PROTOCOL_UDP; ip->flags_and_fragment_offset = 0; - ip->src_address.as_u32 = exp->src_address.as_u32; - ip->dst_address.as_u32 = exp->ipfix_collector.as_u32; + ip->src_address.as_u32 = exp->src_address.ip.ip4.as_u32; + ip->dst_address.as_u32 = exp->ipfix_collector.ip.ip4.as_u32; udp->src_port = clib_host_to_net_u16 (stream->src_port); udp->dst_port = clib_host_to_net_u16 (exp->collector_port); udp->checksum = 0; |