aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip4_punt_drop.c
diff options
context:
space:
mode:
authorPavel Kotucek <pavel.kotucek@pantheon.tech>2018-11-27 09:59:44 +0100
committerNeale Ranns <nranns@cisco.com>2018-11-29 08:49:17 +0000
commit609e1210c6339376dd6cdd0f79195b436d5614d2 (patch)
tree5483c93c35261230750e67e5277108b8b081f65b /src/vnet/ip/ip4_punt_drop.c
parentdfe4cf48ae344b882f0fd53d08b6917ef4391530 (diff)
VPP-1507: Added binary api to dump configured ip_punt_redirect
Change-Id: I790f7785e183cc9aaffd5b593617c4e12a32e20d Signed-off-by: Pavel Kotucek <pavel.kotucek@pantheon.tech>
Diffstat (limited to 'src/vnet/ip/ip4_punt_drop.c')
-rw-r--r--src/vnet/ip/ip4_punt_drop.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/vnet/ip/ip4_punt_drop.c b/src/vnet/ip/ip4_punt_drop.c
index cec2c5aed9b..e36980ce9ed 100644
--- a/src/vnet/ip/ip4_punt_drop.c
+++ b/src/vnet/ip/ip4_punt_drop.c
@@ -521,6 +521,42 @@ format_ip_punt_redirect (u8 * s, va_list * args)
return (s);
}
+ip_punt_redirect_detail_t *
+ip4_punt_redirect_entries (u32 sw_if_index)
+{
+ ip_punt_redirect_rx_t *pr;
+ ip_punt_redirect_detail_t *prs = 0;
+ u32 rx_sw_if_index;
+
+ vec_foreach_index (rx_sw_if_index,
+ ip4_punt_redirect_cfg.redirect_by_rx_sw_if_index)
+ {
+ if (sw_if_index == ~0 || sw_if_index == rx_sw_if_index)
+ {
+ pr =
+ &ip4_punt_redirect_cfg.redirect_by_rx_sw_if_index[rx_sw_if_index];
+ if (~0 != pr->tx_sw_if_index)
+ {
+ ip_punt_redirect_detail_t detail = {.rx_sw_if_index =
+ rx_sw_if_index,
+ .punt_redirect = *pr
+ };
+ vec_add1 (prs, detail);
+ }
+ }
+ }
+ if (~0 != ip4_punt_redirect_cfg.any_rx_sw_if_index.tx_sw_if_index)
+ {
+ pr = &ip4_punt_redirect_cfg.any_rx_sw_if_index;
+ ip_punt_redirect_detail_t detail = {.rx_sw_if_index = ~0,
+ .punt_redirect = *pr
+ };
+ vec_add1 (prs, detail);
+ }
+
+ return prs;
+}
+
static clib_error_t *
ip4_punt_redirect_show_cmd (vlib_main_t * vm,
unformat_input_t * main_input,