summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip_api.c
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2018-10-02 23:27:21 -0700
committerNeale Ranns <nranns@cisco.com>2018-10-12 07:56:35 +0000
commit75b9f45a15bfae423b114dfcaa6eb114c91527eb (patch)
tree35fe306d89b82d3a040fb859adf5de08fbf94ec7 /src/vnet/ip/ip_api.c
parent6ca6ac6c887eb38797027169f5a2f84e45b3436d (diff)
ip: add container proxy dump API (VPP-1364)
Change-Id: I3cb89dbfb7174b9913a8c4ad9b3b1dc9f6ed6326 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/vnet/ip/ip_api.c')
-rw-r--r--src/vnet/ip/ip_api.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index 91832a07e09..4355d11e792 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -45,6 +45,7 @@
#include <vnet/ip/ip4_reassembly.h>
#include <vnet/ip/ip6_reassembly.h>
#include <vnet/ethernet/arp.h>
+#include <vnet/ip/ip_types_api.h>
#include <vnet/vnet_msg_enum.h>
@@ -102,6 +103,7 @@ _(SW_INTERFACE_IP6_ENABLE_DISABLE, sw_interface_ip6_enable_disable ) \
_(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS, \
sw_interface_ip6_set_link_local_address) \
_(IP_CONTAINER_PROXY_ADD_DEL, ip_container_proxy_add_del) \
+_(IP_CONTAINER_PROXY_DUMP, ip_container_proxy_dump) \
_(IOAM_ENABLE, ioam_enable) \
_(IOAM_DISABLE, ioam_disable) \
_(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL, \
@@ -1944,6 +1946,53 @@ static void
REPLY_MACRO (VL_API_IP_CONTAINER_PROXY_ADD_DEL_REPLY);
}
+typedef struct ip_container_proxy_walk_ctx_t_
+{
+ vl_api_registration_t *reg;
+ u32 context;
+} ip_container_proxy_walk_ctx_t;
+
+static int
+ip_container_proxy_send_details (const fib_prefix_t * pfx, u32 sw_if_index,
+ void *args)
+{
+ vl_api_ip_container_proxy_details_t *mp;
+ ip_container_proxy_walk_ctx_t *ctx = args;
+
+ mp = vl_msg_api_alloc (sizeof (*mp));
+ if (!mp)
+ return 1;
+
+ memset (mp, 0, sizeof (*mp));
+ mp->_vl_msg_id = ntohs (VL_API_IP_CONTAINER_PROXY_DETAILS);
+ mp->context = ctx->context;
+
+ mp->sw_if_index = ntohl (sw_if_index);
+ ip_prefix_encode (pfx, &mp->prefix);
+
+ vl_api_send_msg (ctx->reg, (u8 *) mp);
+
+ return 1;
+}
+
+static void
+vl_api_ip_container_proxy_dump_t_handler (vl_api_ip_container_proxy_dump_t *
+ mp)
+{
+ vl_api_registration_t *reg;
+
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
+
+ ip_container_proxy_walk_ctx_t ctx = {
+ .context = mp->context,
+ .reg = reg,
+ };
+
+ ip_container_proxy_walk (ip_container_proxy_send_details, &ctx);
+}
+
static void
vl_api_ioam_enable_t_handler (vl_api_ioam_enable_t * mp)
{