X-Git-Url: https://gerrit.fd.io/r/gitweb?p=vpp.git;a=blobdiff_plain;f=src%2Fvnet%2Fip%2Fip_api.c;h=4355d11e792ac0661c115ca2e37239dcfb460fbb;hp=91832a07e098051de2877f5c8fc8d3525692f0c8;hb=75b9f45;hpb=6ca6ac6c887eb38797027169f5a2f84e45b3436d 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 #include #include +#include #include @@ -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) {