summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/lookup.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/lookup.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/lookup.c')
-rw-r--r--src/vnet/ip/lookup.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/vnet/ip/lookup.c b/src/vnet/ip/lookup.c
index 42509972a98..017ca0db39b 100644
--- a/src/vnet/ip/lookup.c
+++ b/src/vnet/ip/lookup.c
@@ -1321,6 +1321,61 @@ ip_container_proxy_is_set (fib_prefix_t * pfx, u32 sw_if_index)
return (l3p->l3p_sw_if_index == sw_if_index);
}
+typedef struct ip_container_proxy_walk_ctx_t_
+{
+ ip_container_proxy_cb_t cb;
+ void *ctx;
+} ip_container_proxy_walk_ctx_t;
+
+static fib_table_walk_rc_t
+ip_container_proxy_fib_table_walk (fib_node_index_t fei, void *arg)
+{
+ ip_container_proxy_walk_ctx_t *ctx = arg;
+ const fib_prefix_t *pfx;
+ const dpo_id_t *dpo;
+ load_balance_t *lb;
+ l3_proxy_dpo_t *l3p;
+
+ pfx = fib_entry_get_prefix (fei);
+ if (fib_entry_is_sourced (fei, FIB_SOURCE_PROXY))
+ {
+ dpo = fib_entry_contribute_ip_forwarding (fei);
+ lb = load_balance_get (dpo->dpoi_index);
+ dpo = load_balance_get_bucket_i (lb, 0);
+ l3p = l3_proxy_dpo_get (dpo->dpoi_index);
+ ctx->cb (pfx, l3p->l3p_sw_if_index, ctx->ctx);
+ }
+
+ return FIB_TABLE_WALK_CONTINUE;
+}
+
+void
+ip_container_proxy_walk (ip_container_proxy_cb_t cb, void *ctx)
+{
+ fib_table_t *fib_table;
+ ip_container_proxy_walk_ctx_t wctx = {
+ .cb = cb,
+ .ctx = ctx,
+ };
+
+ /* *INDENT-OFF* */
+ pool_foreach (fib_table, ip4_main.fibs,
+ ({
+ fib_table_walk(fib_table->ft_index,
+ FIB_PROTOCOL_IP4,
+ ip_container_proxy_fib_table_walk,
+ &wctx);
+ }));
+ pool_foreach (fib_table, ip6_main.fibs,
+ ({
+ fib_table_walk(fib_table->ft_index,
+ FIB_PROTOCOL_IP6,
+ ip_container_proxy_fib_table_walk,
+ &wctx);
+ }));
+ /* *INDENT-ON* */
+}
+
clib_error_t *
ip_container_cmd (vlib_main_t * vm,
unformat_input_t * main_input, vlib_cli_command_t * cmd)