+/**
+ * @brief Context when walking the IPv6 table. Since all VRFs are in the
+ * same hash table, we need to filter only those we need as we walk
+ */
+typedef struct ip6_mfib_walk_ctx_t_
+{
+ u32 i6w_mfib_index;
+ mfib_table_walk_fn_t i6w_fn;
+ void *i6w_ctx;
+} ip6_mfib_walk_ctx_t;
+
+static int
+ip6_mfib_walk_cb (clib_bihash_kv_40_8_t * kvp,
+ void *arg)
+{
+ ip6_mfib_walk_ctx_t *ctx = arg;
+
+ if ((kvp->key[4] >> 32) == ctx->i6w_mfib_index)
+ {
+ return (ctx->i6w_fn(kvp->value, ctx->i6w_ctx));
+ }
+ return (FIB_TABLE_WALK_CONTINUE);
+}
+
+void
+ip6_mfib_table_walk (ip6_mfib_t *mfib,
+ mfib_table_walk_fn_t fn,
+ void *arg)
+{
+ ip6_mfib_walk_ctx_t ctx = {
+ .i6w_mfib_index = mfib->index,
+ .i6w_fn = fn,
+ .i6w_ctx = arg,
+ };
+
+ clib_bihash_foreach_key_value_pair_40_8(
+ &ip6_main.ip6_mtable.ip6_mhash,
+ ip6_mfib_walk_cb,
+ &ctx);
+}
+