summaryrefslogtreecommitdiffstats
path: root/src/vat
diff options
context:
space:
mode:
Diffstat (limited to 'src/vat')
-rw-r--r--src/vat/api_format.c70
1 files changed, 42 insertions, 28 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index bfc9e3cb644..bdfa8c1b56a 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -5030,8 +5030,8 @@ static void vl_api_policer_classify_details_t_handler_json
vat_json_object_add_uint (node, "table_index", ntohl (mp->table_index));
}
-static void vl_api_ipsec_gre_add_del_tunnel_reply_t_handler
- (vl_api_ipsec_gre_add_del_tunnel_reply_t * mp)
+static void vl_api_ipsec_gre_tunnel_add_del_reply_t_handler
+ (vl_api_ipsec_gre_tunnel_add_del_reply_t * mp)
{
vat_main_t *vam = &vat_main;
i32 retval = ntohl (mp->retval);
@@ -5048,8 +5048,8 @@ static void vl_api_ipsec_gre_add_del_tunnel_reply_t_handler
vam->regenerate_interface_table = 1;
}
-static void vl_api_ipsec_gre_add_del_tunnel_reply_t_handler_json
- (vl_api_ipsec_gre_add_del_tunnel_reply_t * mp)
+static void vl_api_ipsec_gre_tunnel_add_del_reply_t_handler_json
+ (vl_api_ipsec_gre_tunnel_add_del_reply_t * mp)
{
vat_main_t *vam = &vat_main;
vat_json_node_t node;
@@ -5550,7 +5550,7 @@ _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL_REPLY, \
ip_source_and_port_range_check_add_del_reply) \
_(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL_REPLY, \
ip_source_and_port_range_check_interface_add_del_reply) \
-_(IPSEC_GRE_ADD_DEL_TUNNEL_REPLY, ipsec_gre_add_del_tunnel_reply) \
+_(IPSEC_GRE_TUNNEL_ADD_DEL_REPLY, ipsec_gre_tunnel_add_del_reply) \
_(IPSEC_GRE_TUNNEL_DETAILS, ipsec_gre_tunnel_details) \
_(DELETE_SUBIF_REPLY, delete_subif_reply) \
_(L2_INTERFACE_PBB_TAG_REWRITE_REPLY, l2_interface_pbb_tag_rewrite_reply) \
@@ -20346,14 +20346,14 @@ api_ip_source_and_port_range_check_interface_add_del (vat_main_t * vam)
}
static int
-api_ipsec_gre_add_del_tunnel (vat_main_t * vam)
+api_ipsec_gre_tunnel_add_del (vat_main_t * vam)
{
unformat_input_t *i = vam->input;
- vl_api_ipsec_gre_add_del_tunnel_t *mp;
+ vl_api_ipsec_gre_tunnel_add_del_t *mp;
u32 local_sa_id = 0;
u32 remote_sa_id = 0;
- ip4_address_t src_address;
- ip4_address_t dst_address;
+ vl_api_ip4_address_t src_address;
+ vl_api_ip4_address_t dst_address;
u8 is_add = 1;
int ret;
@@ -20363,9 +20363,11 @@ api_ipsec_gre_add_del_tunnel (vat_main_t * vam)
;
else if (unformat (i, "remote_sa %d", &remote_sa_id))
;
- else if (unformat (i, "src %U", unformat_ip4_address, &src_address))
+ else
+ if (unformat (i, "src %U", unformat_vl_api_ip4_address, &src_address))
;
- else if (unformat (i, "dst %U", unformat_ip4_address, &dst_address))
+ else
+ if (unformat (i, "dst %U", unformat_vl_api_ip4_address, &dst_address))
;
else if (unformat (i, "del"))
is_add = 0;
@@ -20376,12 +20378,12 @@ api_ipsec_gre_add_del_tunnel (vat_main_t * vam)
}
}
- M (IPSEC_GRE_ADD_DEL_TUNNEL, mp);
+ M (IPSEC_GRE_TUNNEL_ADD_DEL, mp);
- mp->local_sa_id = ntohl (local_sa_id);
- mp->remote_sa_id = ntohl (remote_sa_id);
- clib_memcpy (mp->src_address, &src_address, sizeof (src_address));
- clib_memcpy (mp->dst_address, &dst_address, sizeof (dst_address));
+ mp->tunnel.local_sa_id = ntohl (local_sa_id);
+ mp->tunnel.remote_sa_id = ntohl (remote_sa_id);
+ clib_memcpy (mp->tunnel.src, &src_address, sizeof (src_address));
+ clib_memcpy (mp->tunnel.dst, &dst_address, sizeof (dst_address));
mp->is_add = is_add;
S (mp);
@@ -20435,10 +20437,21 @@ static void vl_api_ipsec_gre_tunnel_details_t_handler
vat_main_t *vam = &vat_main;
print (vam->ofp, "%11d%15U%15U%14d%14d",
- ntohl (mp->sw_if_index),
- format_ip4_address, &mp->src_address,
- format_ip4_address, &mp->dst_address,
- ntohl (mp->local_sa_id), ntohl (mp->remote_sa_id));
+ ntohl (mp->tunnel.sw_if_index),
+ format_vl_api_ip4_address, mp->tunnel.src,
+ format_vl_api_ip4_address, mp->tunnel.dst,
+ ntohl (mp->tunnel.local_sa_id), ntohl (mp->tunnel.remote_sa_id));
+}
+
+static void
+vat_json_object_add_vl_api_ip4 (vat_json_node_t * node,
+ const char *name,
+ const vl_api_ip4_address_t addr)
+{
+ struct in_addr ip4;
+
+ clib_memcpy (&ip4, addr, sizeof (ip4));
+ vat_json_object_add_ip4 (node, name, ip4);
}
static void vl_api_ipsec_gre_tunnel_details_t_handler_json
@@ -20456,13 +20469,14 @@ static void vl_api_ipsec_gre_tunnel_details_t_handler_json
node = vat_json_array_add (&vam->json_tree);
vat_json_init_object (node);
- vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
- clib_memcpy (&ip4, &mp->src_address, sizeof (ip4));
- vat_json_object_add_ip4 (node, "src_address", ip4);
- clib_memcpy (&ip4, &mp->dst_address, sizeof (ip4));
- vat_json_object_add_ip4 (node, "dst_address", ip4);
- vat_json_object_add_uint (node, "local_sa_id", ntohl (mp->local_sa_id));
- vat_json_object_add_uint (node, "remote_sa_id", ntohl (mp->remote_sa_id));
+ vat_json_object_add_uint (node, "sw_if_index",
+ ntohl (mp->tunnel.sw_if_index));
+ vat_json_object_add_vl_api_ip4 (node, "src", mp->tunnel.src);
+ vat_json_object_add_vl_api_ip4 (node, "src", mp->tunnel.dst);
+ vat_json_object_add_uint (node, "local_sa_id",
+ ntohl (mp->tunnel.local_sa_id));
+ vat_json_object_add_uint (node, "remote_sa_id",
+ ntohl (mp->tunnel.remote_sa_id));
}
static int
@@ -22657,7 +22671,7 @@ _(ip_source_and_port_range_check_add_del, \
_(ip_source_and_port_range_check_interface_add_del, \
"<intf> | sw_if_index <nn> [tcp-out-vrf <id>] [tcp-in-vrf <id>]" \
"[udp-in-vrf <id>] [udp-out-vrf <id>]") \
-_(ipsec_gre_add_del_tunnel, \
+_(ipsec_gre_tunnel_add_del, \
"src <addr> dst <addr> local_sa <sa-id> remote_sa <sa-id> [del]") \
_(ipsec_gre_tunnel_dump, "[sw_if_index <nn>]") \
_(delete_subif,"<intfc> | sw_if_index <nn>") \