aboutsummaryrefslogtreecommitdiffstats
path: root/src/vat/api_format.c
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2019-10-01 12:04:56 +0200
committerOle Trøan <otroan@employees.org>2019-10-10 08:06:25 +0000
commit2d3282e17f4080a838163c4f4ed32e890d79696c (patch)
tree693f61258a9080434e3a304e04dff75b11a7cc7f /src/vat/api_format.c
parent3ae9f5a90ac23ceaa1d5052cfdab417c1ef8dfdc (diff)
geneve: API cleanup
Use consistent API types. Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I1964e4f0afe6f030ae9c8e28fcba5fd81aa1f130
Diffstat (limited to 'src/vat/api_format.c')
-rw-r--r--src/vat/api_format.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 1a2fca1622e..369dcc44641 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -12439,20 +12439,19 @@ api_geneve_add_del_tunnel (vat_main_t * vam)
if (ipv6_set)
{
- clib_memcpy (mp->local_address, &src.ip6, sizeof (src.ip6));
- clib_memcpy (mp->remote_address, &dst.ip6, sizeof (dst.ip6));
+ clib_memcpy (&mp->local_address.un.ip6, &src.ip6, sizeof (src.ip6));
+ clib_memcpy (&mp->remote_address.un.ip6, &dst.ip6, sizeof (dst.ip6));
}
else
{
- clib_memcpy (mp->local_address, &src.ip4, sizeof (src.ip4));
- clib_memcpy (mp->remote_address, &dst.ip4, sizeof (dst.ip4));
+ clib_memcpy (&mp->local_address.un.ip4, &src.ip4, sizeof (src.ip4));
+ clib_memcpy (&mp->remote_address.un.ip4, &dst.ip4, sizeof (dst.ip4));
}
mp->encap_vrf_id = ntohl (encap_vrf_id);
mp->decap_next_index = ntohl (decap_next_index);
mp->mcast_sw_if_index = ntohl (mcast_sw_if_index);
mp->vni = ntohl (vni);
mp->is_add = is_add;
- mp->is_ipv6 = ipv6_set;
S (mp);
W (ret);
@@ -12463,8 +12462,19 @@ static void vl_api_geneve_tunnel_details_t_handler
(vl_api_geneve_tunnel_details_t * mp)
{
vat_main_t *vam = &vat_main;
- ip46_address_t src = to_ip46 (mp->is_ipv6, mp->dst_address);
- ip46_address_t dst = to_ip46 (mp->is_ipv6, mp->src_address);
+ ip46_address_t src = {.as_u64[0] = 0,.as_u64[1] = 0 };
+ ip46_address_t dst = {.as_u64[0] = 0,.as_u64[1] = 0 };
+
+ if (mp->src_address.af == ADDRESS_IP6)
+ {
+ clib_memcpy (&src.ip6, &mp->src_address.un.ip6, sizeof (ip6_address_t));
+ clib_memcpy (&dst.ip6, &mp->dst_address.un.ip6, sizeof (ip6_address_t));
+ }
+ else
+ {
+ clib_memcpy (&src.ip4, &mp->src_address.un.ip4, sizeof (ip4_address_t));
+ clib_memcpy (&dst.ip4, &mp->dst_address.un.ip4, sizeof (ip4_address_t));
+ }
print (vam->ofp, "%11d%24U%24U%14d%18d%13d%19d",
ntohl (mp->sw_if_index),
@@ -12480,6 +12490,7 @@ static void vl_api_geneve_tunnel_details_t_handler_json
{
vat_main_t *vam = &vat_main;
vat_json_node_t *node = NULL;
+ bool is_ipv6;
if (VAT_JSON_ARRAY != vam->json_tree.type)
{
@@ -12490,29 +12501,29 @@ static void vl_api_geneve_tunnel_details_t_handler_json
vat_json_init_object (node);
vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
- if (mp->is_ipv6)
+ is_ipv6 = mp->src_address.af == ADDRESS_IP6;
+ if (is_ipv6)
{
struct in6_addr ip6;
- clib_memcpy (&ip6, mp->src_address, sizeof (ip6));
+ clib_memcpy (&ip6, &mp->src_address.un.ip6, sizeof (ip6));
vat_json_object_add_ip6 (node, "src_address", ip6);
- clib_memcpy (&ip6, mp->dst_address, sizeof (ip6));
+ clib_memcpy (&ip6, &mp->dst_address.un.ip6, sizeof (ip6));
vat_json_object_add_ip6 (node, "dst_address", ip6);
}
else
{
struct in_addr ip4;
- clib_memcpy (&ip4, mp->src_address, sizeof (ip4));
+ clib_memcpy (&ip4, &mp->src_address.un.ip4, sizeof (ip4));
vat_json_object_add_ip4 (node, "src_address", ip4);
- clib_memcpy (&ip4, mp->dst_address, sizeof (ip4));
+ clib_memcpy (&ip4, &mp->dst_address.un.ip4, sizeof (ip4));
vat_json_object_add_ip4 (node, "dst_address", ip4);
}
vat_json_object_add_uint (node, "encap_vrf_id", ntohl (mp->encap_vrf_id));
vat_json_object_add_uint (node, "decap_next_index",
ntohl (mp->decap_next_index));
vat_json_object_add_uint (node, "vni", ntohl (mp->vni));
- vat_json_object_add_uint (node, "is_ipv6", mp->is_ipv6 ? 1 : 0);
vat_json_object_add_uint (node, "mcast_sw_if_index",
ntohl (mp->mcast_sw_if_index));
}