summaryrefslogtreecommitdiffstats
path: root/src/vnet/ipfix-export/flow_api.c
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2019-10-10 14:21:22 +0200
committerOle Trøan <otroan@employees.org>2019-10-22 09:09:58 +0000
commit2f71a888993dc9ee958f174d2e456221d7005f60 (patch)
treec72d57d7f5434e39abfdad032f269ee238d094cc /src/vnet/ipfix-export/flow_api.c
parentbd38f7ff8ce7303eae4e8449c3b62a9dd39ed078 (diff)
ip: ipfix-export API update
Use consistent API types. Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I5b03e5de111c3a3b8da4e9f02cba0aa99e3ee9f3
Diffstat (limited to 'src/vnet/ipfix-export/flow_api.c')
-rw-r--r--src/vnet/ipfix-export/flow_api.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/vnet/ipfix-export/flow_api.c b/src/vnet/ipfix-export/flow_api.c
index 959671d3751..ead602499da 100644
--- a/src/vnet/ipfix-export/flow_api.c
+++ b/src/vnet/ipfix-export/flow_api.c
@@ -19,6 +19,7 @@
#include <vnet/vnet.h>
#include <vlibmemory/api.h>
+#include <vnet/ip/ip_types_api.h>
#include <vnet/interface.h>
#include <vnet/api_errno.h>
@@ -74,11 +75,18 @@ vl_api_set_ipfix_exporter_t_handler (vl_api_set_ipfix_exporter_t * mp)
if (!reg)
return;
- memcpy (collector.data, mp->collector_address, sizeof (collector.data));
+ if (mp->src_address.af == ADDRESS_IP6
+ || mp->collector_address.af == ADDRESS_IP6)
+ {
+ rv = VNET_API_ERROR_UNIMPLEMENTED;
+ goto out;
+ }
+
+ ip4_address_decode (mp->collector_address.un.ip4, &collector);
collector_port = ntohs (mp->collector_port);
if (collector_port == (u16) ~ 0)
collector_port = UDP_DST_PORT_ipfix;
- memcpy (src.data, mp->src_address, sizeof (src.data));
+ ip4_address_decode (mp->src_address.un.ip4, &src);
fib_id = ntohl (mp->vrf_id);
ip4_main_t *im = &ip4_main;
@@ -157,6 +165,8 @@ vl_api_ipfix_exporter_dump_t_handler (vl_api_ipfix_exporter_dump_t * mp)
vl_api_registration_t *reg;
vl_api_ipfix_exporter_details_t *rmp;
ip4_main_t *im = &ip4_main;
+ ip46_address_t collector = {.as_u64[0] = 0,.as_u64[1] = 0 };
+ ip46_address_t src = {.as_u64[0] = 0,.as_u64[1] = 0 };
u32 vrf_id;
reg = vl_api_client_index_to_registration (mp->client_index);
@@ -167,11 +177,15 @@ vl_api_ipfix_exporter_dump_t_handler (vl_api_ipfix_exporter_dump_t * mp)
clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_IPFIX_EXPORTER_DETAILS);
rmp->context = mp->context;
- memcpy (rmp->collector_address, frm->ipfix_collector.data,
- sizeof (frm->ipfix_collector.data));
+
+ memcpy (&collector.ip4, &frm->ipfix_collector, sizeof (ip4_address_t));
+ ip_address_encode (&collector, IP46_TYPE_IP4, &rmp->collector_address);
+
rmp->collector_port = htons (frm->collector_port);
- memcpy (rmp->src_address, frm->src_address.data,
- sizeof (frm->src_address.data));
+
+ memcpy (&src.ip4, &frm->src_address, sizeof (ip4_address_t));
+ ip_address_encode (&src, IP46_TYPE_IP4, &rmp->src_address);
+
if (frm->fib_index == ~0)
vrf_id = ~0;
else
@@ -255,8 +269,8 @@ static void
return;
classify_table_index = ntohl (mp->table_id);
- ip_version = mp->ip_version;
- transport_protocol = mp->transport_protocol;
+ ip_version = ntohl (mp->ip_version);
+ transport_protocol = ntohl (mp->transport_protocol);
is_add = mp->is_add;
if (fcm->src_port == 0)
@@ -331,8 +345,8 @@ send_ipfix_classify_table_details (u32 table_index,
mp->_vl_msg_id = ntohs (VL_API_IPFIX_CLASSIFY_TABLE_DETAILS);
mp->context = context;
mp->table_id = htonl (table->classify_table_index);
- mp->ip_version = table->ip_version;
- mp->transport_protocol = table->transport_protocol;
+ mp->ip_version = htonl (table->ip_version);
+ mp->transport_protocol = htonl (table->transport_protocol);
vl_api_send_msg (reg, (u8 *) mp);
}