From b2962715e6b22a5c0e8e9ced0759ad61124c2f42 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Fri, 25 Jan 2019 00:51:09 -0800 Subject: IP6 FIB: walk table for dump (VPP-1553) Change-Id: Iaa57ace6df96bfacd1235c80ec7bb08e5f335530 Signed-off-by: Neale Ranns (cherry picked from commit 5c1f559b1bf32acd528664e7674a2d46f2aed947) --- src/vnet/ip/ip_api.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/vnet') diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c index f58ca079b04..42ce883c234 100644 --- a/src/vnet/ip/ip_api.c +++ b/src/vnet/ip/ip_api.c @@ -331,19 +331,17 @@ send_ip6_fib_details (vpe_api_main_t * am, typedef struct apt_ip6_fib_show_ctx_t_ { - u32 fib_index; fib_node_index_t *entries; } api_ip6_fib_show_ctx_t; -static void -api_ip6_fib_table_put_entries (clib_bihash_kv_24_8_t * kvp, void *arg) +static fib_table_walk_rc_t +api_ip6_fib_table_put_entries (fib_node_index_t fei, void *arg) { api_ip6_fib_show_ctx_t *ctx = arg; - if ((kvp->key[2] >> 32) == ctx->fib_index) - { - vec_add1 (ctx->entries, kvp->value); - } + vec_add1 (ctx->entries, fei); + + return (FIB_TABLE_WALK_CONTINUE); } static void @@ -352,18 +350,15 @@ api_ip6_fib_table_get_all (vl_api_registration_t * reg, fib_table_t * fib_table) { vpe_api_main_t *am = &vpe_api_main; - ip6_main_t *im6 = &ip6_main; fib_node_index_t *fib_entry_index; api_ip6_fib_show_ctx_t ctx = { - .fib_index = fib_table->ft_index, .entries = NULL, }; fib_route_path_encode_t *api_rpaths; const fib_prefix_t *pfx; - BV (clib_bihash_foreach_key_value_pair) - ((BVT (clib_bihash) *) & im6->ip6_table[IP6_FIB_TABLE_NON_FWDING]. - ip6_hash, api_ip6_fib_table_put_entries, &ctx); + ip6_fib_table_walk (fib_table->ft_index, + api_ip6_fib_table_put_entries, &ctx); vec_sort_with_function (ctx.entries, fib_entry_cmp_for_sort); -- cgit 1.2.3-korg