aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vat/api_format.c38
-rw-r--r--src/vnet/fib/fib_table.c2
-rw-r--r--src/vnet/ip/ip.api56
-rw-r--r--src/vnet/ip/ip_api.c254
-rw-r--r--src/vnet/mfib/ip4_mfib.c23
-rw-r--r--src/vnet/mfib/ip4_mfib.h11
-rw-r--r--src/vnet/mfib/ip6_mfib.c50
-rw-r--r--src/vnet/mfib/ip6_mfib.h11
-rw-r--r--src/vnet/mfib/mfib_entry.c8
-rw-r--r--src/vnet/mfib/mfib_entry.h3
-rw-r--r--src/vnet/mfib/mfib_table.c19
-rw-r--r--src/vnet/mfib/mfib_table.h16
12 files changed, 476 insertions, 15 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 3a40a55316c..e3d8ab48eb9 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -16161,6 +16161,24 @@ api_ip_fib_dump (vat_main_t * vam)
return ret;
}
+static int
+api_ip_mfib_dump (vat_main_t * vam)
+{
+ vl_api_ip_mfib_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ int ret;
+
+ M (IP_MFIB_DUMP, mp);
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ M (CONTROL_PING, mp_ping);
+ S (mp_ping);
+
+ W (ret);
+ return ret;
+}
+
static void vl_api_ip_neighbor_details_t_handler
(vl_api_ip_neighbor_details_t * mp)
{
@@ -16353,6 +16371,24 @@ api_ip6_fib_dump (vat_main_t * vam)
return ret;
}
+static int
+api_ip6_mfib_dump (vat_main_t * vam)
+{
+ vl_api_ip6_mfib_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ int ret;
+
+ M (IP6_MFIB_DUMP, mp);
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ M (CONTROL_PING, mp_ping);
+ S (mp_ping);
+
+ W (ret);
+ return ret;
+}
+
int
api_classify_table_ids (vat_main_t * vam)
{
@@ -18385,7 +18421,9 @@ _(flow_classify_set_interface, \
"<intfc> | sw_if_index <nn> [ip4-table <nn>] [ip6-table <nn>] [del]") \
_(flow_classify_dump, "type [ip4|ip6]") \
_(ip_fib_dump, "") \
+_(ip_mfib_dump, "") \
_(ip6_fib_dump, "") \
+_(ip6_mfib_dump, "") \
_(feature_enable_disable, "arc_name <arc_name> " \
"feature_name <feature_name> <intfc> | sw_if_index <nn> [disable]") \
_(sw_interface_tag_add_del, "<intfc> | sw_if_index <nn> tag <text>" \
diff --git a/src/vnet/fib/fib_table.c b/src/vnet/fib/fib_table.c
index 57eb0ae8298..f997335a9f2 100644
--- a/src/vnet/fib/fib_table.c
+++ b/src/vnet/fib/fib_table.c
@@ -1043,6 +1043,7 @@ fib_table_destroy (fib_table_t *fib_table)
break;
}
}
+
void
fib_table_walk (u32 fib_index,
fib_protocol_t proto,
@@ -1063,7 +1064,6 @@ fib_table_walk (u32 fib_index,
}
}
-
void
fib_table_unlock (u32 fib_index,
fib_protocol_t proto)
diff --git a/src/vnet/ip/ip.api b/src/vnet/ip/ip.api
index 0a4a9c9773c..d982b04cdfd 100644
--- a/src/vnet/ip/ip.api
+++ b/src/vnet/ip/ip.api
@@ -430,6 +430,62 @@ define ip_mroute_add_del_reply
i32 retval;
};
+/** \brief Dump IP multicast fib table
+ @param client_index - opaque cookie to identify the sender
+*/
+define ip_mfib_dump
+{
+ u32 client_index;
+ u32 context;
+};
+
+/** \brief IP Multicast FIB table response
+ @param table_id - IP fib table id
+ @address_length - mask length
+ @grp_address - Group address/prefix
+ @src_address - Source address
+ @param count - the number of fib_path in path
+ @param path - array of of fib_path structures
+*/
+manual_endian manual_print define ip_mfib_details
+{
+ u32 context;
+ u32 table_id;
+ u8 address_length;
+ u8 grp_address[4];
+ u8 src_address[4];
+ u32 count;
+ vl_api_fib_path_t path[count];
+};
+
+/** \brief Dump IP6 multicast fib table
+ @param client_index - opaque cookie to identify the sender
+*/
+define ip6_mfib_dump
+{
+ u32 client_index;
+ u32 context;
+};
+
+/** \brief IP6 Multicast FIB table response
+ @param table_id - IP fib table id
+ @address_length - mask length
+ @grp_address - Group address/prefix
+ @src_address - Source address
+ @param count - the number of fib_path in path
+ @param path - array of of fib_path structures
+*/
+manual_endian manual_print define ip6_mfib_details
+{
+ u32 context;
+ u32 table_id;
+ u8 address_length;
+ u8 grp_address[16];
+ u8 src_address[16];
+ u32 count;
+ vl_api_fib_path_t path[count];
+};
+
define ip_address_details
{
u32 client_index;
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index 1cc712eb3e7..49d941c2a8a 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -33,9 +33,10 @@
#include <vnet/dpo/classify_dpo.h>
#include <vnet/dpo/ip_null_dpo.h>
#include <vnet/ethernet/arp_packet.h>
-//#include <vnet/mfib/ip6_mfib.h>
+#include <vnet/mfib/ip6_mfib.h>
#include <vnet/mfib/ip4_mfib.h>
#include <vnet/mfib/mfib_signal.h>
+#include <vnet/mfib/mfib_entry.h>
#include <vnet/vnet_msg_enum.h>
@@ -55,14 +56,19 @@
#include <vlibapi/api_helper_macros.h>
+
#define foreach_ip_api_msg \
_(IP_FIB_DUMP, ip_fib_dump) \
_(IP_FIB_DETAILS, ip_fib_details) \
_(IP6_FIB_DUMP, ip6_fib_dump) \
_(IP6_FIB_DETAILS, ip6_fib_details) \
+_(IP_MFIB_DUMP, ip_mfib_dump) \
+_(IP_MFIB_DETAILS, ip_mfib_details) \
+_(IP6_MFIB_DUMP, ip6_mfib_dump) \
+_(IP6_MFIB_DETAILS, ip6_mfib_details) \
_(IP_NEIGHBOR_DUMP, ip_neighbor_dump) \
_(IP_MROUTE_ADD_DEL, ip_mroute_add_del) \
-_(MFIB_SIGNAL_DUMP, mfib_signal_dump) \
+_(MFIB_SIGNAL_DUMP, mfib_signal_dump) \
_(IP_NEIGHBOR_DETAILS, ip_neighbor_details) \
_(IP_ADDRESS_DUMP, ip_address_dump) \
_(IP_DUMP, ip_dump) \
@@ -464,6 +470,250 @@ vl_api_ip6_fib_dump_t_handler (vl_api_ip6_fib_dump_t * mp)
}
static void
+vl_api_ip_mfib_details_t_handler (vl_api_ip_mfib_details_t * mp)
+{
+ clib_warning ("BUG");
+}
+
+static void
+vl_api_ip_mfib_details_t_endian (vl_api_ip_mfib_details_t * mp)
+{
+ clib_warning ("BUG");
+}
+
+static void
+vl_api_ip_mfib_details_t_print (vl_api_ip_mfib_details_t * mp)
+{
+ clib_warning ("BUG");
+}
+
+static void
+send_ip_mfib_details (vpe_api_main_t * am,
+ unix_shared_memory_queue_t * q,
+ u32 table_id,
+ mfib_prefix_t * pfx,
+ fib_route_path_encode_t * api_rpaths, u32 context)
+{
+ vl_api_ip_mfib_details_t *mp;
+ fib_route_path_encode_t *api_rpath;
+ vl_api_fib_path_t *fp;
+ int path_count;
+
+ path_count = vec_len (api_rpaths);
+ mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
+ if (!mp)
+ return;
+ memset (mp, 0, sizeof (*mp));
+ mp->_vl_msg_id = ntohs (VL_API_IP_FIB_DETAILS);
+ mp->context = context;
+
+ mp->table_id = htonl (table_id);
+ mp->address_length = pfx->fp_len;
+ memcpy (mp->grp_address, &pfx->fp_grp_addr.ip4,
+ sizeof (pfx->fp_grp_addr.ip4));
+ memcpy (mp->src_address, &pfx->fp_src_addr.ip4,
+ sizeof (pfx->fp_src_addr.ip4));
+
+ mp->count = htonl (path_count);
+ fp = mp->path;
+ vec_foreach (api_rpath, api_rpaths)
+ {
+ memset (fp, 0, sizeof (*fp));
+
+ fp->weight = 0;
+ fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
+ copy_fib_next_hop (api_rpath, fp);
+ fp++;
+ }
+
+ vl_msg_api_send_shmem (q, (u8 *) & mp);
+}
+
+typedef struct vl_api_ip_mfib_dump_ctc_t_
+{
+ fib_node_index_t *entries;
+} vl_api_ip_mfib_dump_ctc_t;
+
+static int
+vl_api_ip_mfib_table_dump_walk (fib_node_index_t fei, void *arg)
+{
+ vl_api_ip_mfib_dump_ctc_t *ctx = arg;
+
+ vec_add1 (ctx->entries, fei);
+
+ return (0);
+}
+
+static void
+vl_api_ip_mfib_dump_t_handler (vl_api_ip_mfib_dump_t * mp)
+{
+ vpe_api_main_t *am = &vpe_api_main;
+ unix_shared_memory_queue_t *q;
+ ip4_main_t *im = &ip4_main;
+ mfib_table_t *mfib_table;
+ fib_node_index_t *mfeip;
+ mfib_prefix_t pfx;
+ fib_route_path_encode_t *api_rpaths = NULL;
+ vl_api_ip_mfib_dump_ctc_t ctx = {
+ .entries = NULL,
+ };
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (q == 0)
+ return;
+
+
+ /* *INDENT-OFF* */
+ pool_foreach (mfib_table, im->mfibs,
+ ({
+ ip4_mfib_table_walk(&mfib_table->v4,
+ vl_api_ip_mfib_table_dump_walk,
+ &ctx);
+
+ vec_sort_with_function (ctx.entries, mfib_entry_cmp_for_sort);
+
+ vec_foreach (mfeip, ctx.entries)
+ {
+ mfib_entry_get_prefix (*mfeip, &pfx);
+ mfib_entry_encode (*mfeip, &api_rpaths);
+ send_ip_mfib_details (am, q,
+ mfib_table->mft_table_id,
+ &pfx, api_rpaths,
+ mp->context);
+ }
+ vec_reset_length (api_rpaths);
+ vec_reset_length (ctx.entries);
+
+ }));
+ /* *INDENT-ON* */
+
+ vec_free (ctx.entries);
+ vec_free (api_rpaths);
+}
+
+static void
+vl_api_ip6_mfib_details_t_handler (vl_api_ip6_mfib_details_t * mp)
+{
+ clib_warning ("BUG");
+}
+
+static void
+vl_api_ip6_mfib_details_t_endian (vl_api_ip6_mfib_details_t * mp)
+{
+ clib_warning ("BUG");
+}
+
+static void
+vl_api_ip6_mfib_details_t_print (vl_api_ip6_mfib_details_t * mp)
+{
+ clib_warning ("BUG");
+}
+
+static void
+send_ip6_mfib_details (vpe_api_main_t * am,
+ unix_shared_memory_queue_t * q,
+ u32 table_id,
+ mfib_prefix_t * pfx,
+ fib_route_path_encode_t * api_rpaths, u32 context)
+{
+ vl_api_ip6_mfib_details_t *mp;
+ fib_route_path_encode_t *api_rpath;
+ vl_api_fib_path_t *fp;
+ int path_count;
+
+ path_count = vec_len (api_rpaths);
+ mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
+ if (!mp)
+ return;
+ memset (mp, 0, sizeof (*mp));
+ mp->_vl_msg_id = ntohs (VL_API_IP6_FIB_DETAILS);
+ mp->context = context;
+
+ mp->table_id = htonl (table_id);
+ mp->address_length = pfx->fp_len;
+ memcpy (mp->grp_address, &pfx->fp_grp_addr.ip6,
+ sizeof (pfx->fp_grp_addr.ip6));
+ memcpy (mp->src_address, &pfx->fp_src_addr.ip6,
+ sizeof (pfx->fp_src_addr.ip6));
+
+ mp->count = htonl (path_count);
+ fp = mp->path;
+ vec_foreach (api_rpath, api_rpaths)
+ {
+ memset (fp, 0, sizeof (*fp));
+
+ fp->weight = 0;
+ fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
+ copy_fib_next_hop (api_rpath, fp);
+ fp++;
+ }
+
+ vl_msg_api_send_shmem (q, (u8 *) & mp);
+}
+
+typedef struct vl_api_ip6_mfib_dump_ctc_t_
+{
+ fib_node_index_t *entries;
+} vl_api_ip6_mfib_dump_ctc_t;
+
+static int
+vl_api_ip6_mfib_table_dump_walk (fib_node_index_t fei, void *arg)
+{
+ vl_api_ip6_mfib_dump_ctc_t *ctx = arg;
+
+ vec_add1 (ctx->entries, fei);
+
+ return (0);
+}
+
+static void
+vl_api_ip6_mfib_dump_t_handler (vl_api_ip6_mfib_dump_t * mp)
+{
+ vpe_api_main_t *am = &vpe_api_main;
+ unix_shared_memory_queue_t *q;
+ ip6_main_t *im = &ip6_main;
+ mfib_table_t *mfib_table;
+ fib_node_index_t *mfeip;
+ mfib_prefix_t pfx;
+ fib_route_path_encode_t *api_rpaths = NULL;
+ vl_api_ip6_mfib_dump_ctc_t ctx = {
+ .entries = NULL,
+ };
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (q == 0)
+ return;
+
+
+ /* *INDENT-OFF* */
+ pool_foreach (mfib_table, im->mfibs,
+ ({
+ ip6_mfib_table_walk(&mfib_table->v6,
+ vl_api_ip6_mfib_table_dump_walk,
+ &ctx);
+
+ vec_sort_with_function (ctx.entries, mfib_entry_cmp_for_sort);
+
+ vec_foreach(mfeip, ctx.entries)
+ {
+ mfib_entry_get_prefix (*mfeip, &pfx);
+ mfib_entry_encode (*mfeip, &api_rpaths);
+ send_ip6_mfib_details (am, q,
+ mfib_table->mft_table_id,
+ &pfx, api_rpaths,
+ mp->context);
+ }
+ vec_reset_length (api_rpaths);
+ vec_reset_length (ctx.entries);
+
+ }));
+ /* *INDENT-ON* */
+
+ vec_free (ctx.entries);
+ vec_free (api_rpaths);
+}
+
+static void
vl_api_ip_neighbor_add_del_t_handler (vl_api_ip_neighbor_add_del_t * mp,
vlib_main_t * vm)
{
diff --git a/src/vnet/mfib/ip4_mfib.c b/src/vnet/mfib/ip4_mfib.c
index 3e7bdd81bbf..164cafa118b 100644
--- a/src/vnet/mfib/ip4_mfib.c
+++ b/src/vnet/mfib/ip4_mfib.c
@@ -279,6 +279,29 @@ ip4_mfib_table_entry_remove (ip4_mfib_t *mfib,
mfib->fib_entry_by_dst_address[len] = hash;
}
+void
+ip4_mfib_table_walk (ip4_mfib_t *mfib,
+ mfib_table_walk_fn_t fn,
+ void *ctx)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_LEN (mfib->fib_entry_by_dst_address); i++)
+ {
+ uword * hash = mfib->fib_entry_by_dst_address[i];
+
+ if (NULL != hash)
+ {
+ hash_pair_t * p;
+
+ hash_foreach_pair (p, hash,
+ ({
+ fn(p->value[0], ctx);
+ }));
+ }
+ }
+}
+
static void
ip4_mfib_table_show_all (ip4_mfib_t *mfib,
vlib_main_t * vm)
diff --git a/src/vnet/mfib/ip4_mfib.h b/src/vnet/mfib/ip4_mfib.h
index 6fc74a368bd..ea682651767 100644
--- a/src/vnet/mfib/ip4_mfib.h
+++ b/src/vnet/mfib/ip4_mfib.h
@@ -90,6 +90,15 @@ u32 ip4_mfib_index_from_table_id (u32 table_id)
extern u32 ip4_mfib_table_get_index_for_sw_if_index(u32 sw_if_index);
+/**
+ * @brief Walk the IP4 mfib table.
+ *
+ * @param mfib the table to walk
+ * @param fn The function to invoke on each entry visited
+ * @param ctx A context passed in the visit function
+ */
+extern void ip4_mfib_table_walk (ip4_mfib_t *mfib,
+ mfib_table_walk_fn_t fn,
+ void *ctx);
#endif
-
diff --git a/src/vnet/mfib/ip6_mfib.c b/src/vnet/mfib/ip6_mfib.c
index 0c2e4c7b796..8f3dae8d7b5 100644
--- a/src/vnet/mfib/ip6_mfib.c
+++ b/src/vnet/mfib/ip6_mfib.c
@@ -483,20 +483,16 @@ ip6_mfib_table_show_one (ip6_mfib_t *mfib,
}
typedef struct ip6_mfib_show_ctx_t_ {
- u32 fib_index;
fib_node_index_t *entries;
} ip6_mfib_show_ctx_t;
static int
-ip6_mfib_table_collect_entries (struct radix_node *rn, void *arg)
+ip6_mfib_table_collect_entries (fib_node_index_t mfei, void *arg)
{
ip6_mfib_show_ctx_t *ctx = arg;
- ip6_mfib_node_t *i6mn;
-
- i6mn = (ip6_mfib_node_t*) rn;
- vec_add1(ctx->entries, i6mn->i6mn_entry);
+ vec_add1(ctx->entries, mfei);
return (0);
}
@@ -507,13 +503,12 @@ ip6_mfib_table_show_all (ip6_mfib_t *mfib,
{
fib_node_index_t *mfib_entry_index;
ip6_mfib_show_ctx_t ctx = {
- .fib_index = mfib->index,
.entries = NULL,
};
- rn_walktree(mfib->rhead,
- ip6_mfib_table_collect_entries,
- &ctx);
+ ip6_mfib_table_walk(mfib,
+ ip6_mfib_table_collect_entries,
+ &ctx);
vec_sort_with_function(ctx.entries, mfib_entry_cmp_for_sort);
@@ -528,6 +523,41 @@ ip6_mfib_table_show_all (ip6_mfib_t *mfib,
vec_free(ctx.entries);
}
+typedef struct ip6_mfib_radix_walk_ctx_t_
+{
+ mfib_table_walk_fn_t user_fn;
+ void *user_ctx;
+} ip6_mfib_radix_walk_ctx_t;
+
+static int
+ip6_mfib_table_radix_walk (struct radix_node *rn,
+ void *arg)
+{
+ ip6_mfib_radix_walk_ctx_t *ctx = arg;
+ ip6_mfib_node_t *i6mn;
+
+ i6mn = (ip6_mfib_node_t*) rn;
+
+ ctx->user_fn(i6mn->i6mn_entry, ctx->user_ctx);
+
+ return (0);
+}
+
+void
+ip6_mfib_table_walk (ip6_mfib_t *mfib,
+ mfib_table_walk_fn_t fn,
+ void *ctx)
+{
+ ip6_mfib_radix_walk_ctx_t rn_ctx = {
+ .user_fn = fn,
+ .user_ctx = ctx,
+ };
+
+ rn_walktree(mfib->rhead,
+ ip6_mfib_table_radix_walk,
+ &rn_ctx);
+}
+
static clib_error_t *
ip6_show_mfib (vlib_main_t * vm,
unformat_input_t * input,
diff --git a/src/vnet/mfib/ip6_mfib.h b/src/vnet/mfib/ip6_mfib.h
index d91af46dc93..adaa7ec24fe 100644
--- a/src/vnet/mfib/ip6_mfib.h
+++ b/src/vnet/mfib/ip6_mfib.h
@@ -105,5 +105,16 @@ extern fib_node_index_t ip6_mfib_table_lookup2(const ip6_mfib_t *mfib,
const ip6_address_t *src,
const ip6_address_t *grp);
+/**
+ * @brief Walk the IP6 mfib table.
+ *
+ * @param mfib the table to walk
+ * @param fn The function to invoke on each entry visited
+ * @param ctx A context passed in the visit function
+ */
+extern void ip6_mfib_table_walk (ip6_mfib_t *mfib,
+ mfib_table_walk_fn_t fn,
+ void *ctx);
+
#endif
diff --git a/src/vnet/mfib/mfib_entry.c b/src/vnet/mfib/mfib_entry.c
index acbe90bb109..1947360ad14 100644
--- a/src/vnet/mfib/mfib_entry.c
+++ b/src/vnet/mfib/mfib_entry.c
@@ -1050,9 +1050,15 @@ mfib_entry_encode (fib_node_index_t mfib_entry_index,
mfib_entry_t *mfib_entry;
mfib_entry = mfib_entry_get(mfib_entry_index);
- fib_path_list_walk(mfib_entry->mfe_parent, fib_path_encode, api_rpaths);
+ if (FIB_NODE_INDEX_INVALID != mfib_entry->mfe_parent)
+ {
+ fib_path_list_walk(mfib_entry->mfe_parent,
+ fib_path_encode,
+ api_rpaths);
+ }
}
+
void
mfib_entry_get_prefix (fib_node_index_t mfib_entry_index,
mfib_prefix_t *pfx)
diff --git a/src/vnet/mfib/mfib_entry.h b/src/vnet/mfib/mfib_entry.h
index 36fc73e1670..dc8f49aad1a 100644
--- a/src/vnet/mfib/mfib_entry.h
+++ b/src/vnet/mfib/mfib_entry.h
@@ -130,6 +130,9 @@ extern void mfib_entry_contribute_forwarding(
fib_forward_chain_type_t type,
dpo_id_t *dpo);
+extern void mfib_entry_encode(fib_node_index_t fib_entry_index,
+ fib_route_path_encode_t **api_rpaths);
+
extern void mfib_entry_module_init(void);
diff --git a/src/vnet/mfib/mfib_table.c b/src/vnet/mfib/mfib_table.c
index b4e855ff071..3b4bd985893 100644
--- a/src/vnet/mfib/mfib_table.c
+++ b/src/vnet/mfib/mfib_table.c
@@ -489,6 +489,25 @@ mfib_table_lock (u32 fib_index,
mfib_table->mft_locks++;
}
+void
+mfib_table_walk (u32 fib_index,
+ fib_protocol_t proto,
+ mfib_table_walk_fn_t fn,
+ void *ctx)
+{
+ switch (proto)
+ {
+ case FIB_PROTOCOL_IP4:
+ ip4_mfib_table_walk(ip4_mfib_get(fib_index), fn, ctx);
+ break;
+ case FIB_PROTOCOL_IP6:
+ ip6_mfib_table_walk(ip6_mfib_get(fib_index), fn, ctx);
+ break;
+ case FIB_PROTOCOL_MPLS:
+ break;
+ }
+}
+
u8*
format_mfib_table_name (u8* s, va_list ap)
{
diff --git a/src/vnet/mfib/mfib_table.h b/src/vnet/mfib/mfib_table.h
index 4c51b70fd72..95239f7cb17 100644
--- a/src/vnet/mfib/mfib_table.h
+++ b/src/vnet/mfib/mfib_table.h
@@ -360,4 +360,20 @@ extern u32 mfib_table_get_num_entries(u32 fib_index,
extern mfib_table_t *mfib_table_get(fib_node_index_t index,
fib_protocol_t proto);
+/**
+ * @brief Call back function when walking entries in a FIB table
+ */
+typedef int (*mfib_table_walk_fn_t)(fib_node_index_t fei,
+ void *ctx);
+
+/**
+ * @brief Walk all entries in a FIB table
+ * N.B: This is NOT safe to deletes. If you need to delete, walk the whole
+ * table and store elements in a vector, then delete the elements
+ */
+extern void mfib_table_walk(u32 fib_index,
+ fib_protocol_t proto,
+ mfib_table_walk_fn_t fn,
+ void *ctx);
+
#endif