+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);
+ }));
+ }
+ }
+}
+
+u8 *
+format_ip4_mfib_table_memory (u8 * s, va_list * args)
+{
+ mfib_table_t *mfib_table;
+ u64 total_memory;
+
+ total_memory = 0;
+
+ pool_foreach (mfib_table, ip4_main.mfibs,
+ ({
+ ip4_mfib_t *mfib = &mfib_table->v4;
+ uword mfib_size;
+ int i;
+
+ mfib_size = 0;
+
+ 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)
+ {
+ mfib_size += hash_bytes(hash);
+ }
+ }
+
+ total_memory += mfib_size;
+ }));
+
+ s = format(s, "%=30s %=6d %=8ld\n",
+ "IPv4 multicast",
+ pool_elts(ip4_main.mfibs), total_memory);
+
+ return (s);
+}
+