41 memset(mfib_table, 0,
sizeof(*mfib_table));
63 for (ii = 0; ii <
ARRAY_LEN(ip4_specials); ii++)
68 clib_host_to_net_u32(prefix.
fp_src_addr.ip4.data_u32);
70 clib_host_to_net_u32(prefix.
fp_grp_addr.ip4.data_u32);
91 for (ii = 0; ii <
ARRAY_LEN(ip4_specials); ii++)
97 clib_host_to_net_u32(prefix.
fp_src_addr.ip4.data_u32);
99 clib_host_to_net_u32(prefix.
fp_grp_addr.ip4.data_u32);
142 #define IPV4_MFIB_GRP_LEN(_len)\ 143 (_len > 32 ? 32 : _len) 145 #define IP4_MFIB_MK_KEY(_grp, _src, _len, _key) \ 147 _key = ((u64)(_grp->data_u32 & \ 148 ip4_main.fib_masks[IPV4_MFIB_GRP_LEN(_len)])) << 32; \ 149 _key |= _src->data_u32; \ 151 #define IP4_MFIB_MK_GRP_KEY(_grp, _len, _key) \ 153 _key = ((u64)(_grp->data_u32 & \ 154 ip4_main.fib_masks[IPV4_MFIB_GRP_LEN(_len)])) << 32; \ 168 uword * hash, * result;
176 if (
NULL != result) {
193 uword * hash, * result;
206 if (
NULL != result) {
211 for (mask_len = 32; mask_len >= 0; mask_len--)
218 if (
NULL != result) {
232 uword * hash, * result;
239 if (
NULL == result) {
247 hash =
hash_set(hash, key, fib_entry_index);
262 uword * hash, * result;
300 fn(p->
value[0], ctx);
314 mfib_entry_indicies =
NULL;
364 int verbose, matching;
367 int i, table_id = -1, fib_index = ~0;
387 memset(&src, 0,
sizeof(src));
392 memset(&src, 0,
sizeof(src));
396 else if (
unformat (input,
"table %d", &table_id))
398 else if (
unformat (input,
"index %d", &fib_index))
406 ip4_mfib_t *mfib = &mfib_table->v4;
408 if (table_id >= 0 && table_id != (int)mfib->table_id)
410 if (fib_index != ~0 && fib_index != (int)mfib->index)
413 vlib_cli_output (vm,
"%U, fib_index %d",
414 format_mfib_table_name, mfib->index, FIB_PROTOCOL_IP4,
420 vlib_cli_output (vm,
"%=20s%=16s",
"Prefix length",
"Count");
421 for (i = 0; i < ARRAY_LEN (mfib->fib_entry_by_dst_address); i++)
423 uword * hash = mfib->fib_entry_by_dst_address[i];
424 uword n_elts = hash_elts (hash);
426 vlib_cli_output (vm,
"%20d%16d", i, n_elts);
488 .path =
"show ip mfib",
489 .short_help =
"show ip mfib [summary] [table <table-id>] [index <fib-id>] [<grp-addr>[/<mask>]] [<grp-addr>] [<src-addr> <grp-addr>]",
#define MFIB_ENTRY_FORMAT_DETAIL
static clib_error_t * ip4_show_mfib(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
ip46_address_t fp_src_addr
#define hash_set(h, key, value)
fib_node_index_t mfib_table_lookup(u32 fib_index, const mfib_prefix_t *prefix)
Perfom a longest prefix match in the non-forwarding table.
sll srl srl sll sra u16x4 i
#define hash_unset(h, key)
u32 ip4_mfib_table_find_or_create_and_lock(u32 table_id)
Get or create an IPv4 fib.
u32 ip4_mfib_table_get_index_for_sw_if_index(u32 sw_if_index)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static void ip4_mfib_table_show_one(ip4_mfib_t *mfib, vlib_main_t *vm, ip4_address_t *src, ip4_address_t *grp, u32 mask_len)
u32 mft_total_route_counts
Total route counters.
fib_node_index_t mfib_table_entry_update(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, fib_rpf_id_t rpf_id, mfib_entry_flags_t entry_flags)
Add a new (with no replication) or lock an existing entry.
#define MFIB_ENTRY_FORMAT_BRIEF
u32 * mfib_index_by_sw_if_index
Table index indexed by software interface.
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
fib_node_index_t mft_index
Index into FIB vector.
void mfib_table_entry_delete_index(fib_node_index_t mfib_entry_index, mfib_source_t source)
Delete a FIB entry.
#define IP4_MFIB_MK_GRP_KEY(_grp, _len, _key)
static void hash_set_flags(void *v, uword flags)
struct mfib_table_t_ * mfibs
Vector of MFIBs.
void ip4_mfib_table_walk(ip4_mfib_t *mfib, mfib_table_walk_fn_t fn, void *ctx)
Walk the IP4 mfib table.
void ip4_mfib_table_entry_remove(ip4_mfib_t *mfib, const ip4_address_t *grp, const ip4_address_t *src, u32 len)
#define IP4_MFIB_MK_KEY(_grp, _src, _len, _key)
#define pool_put(P, E)
Free an object E in pool P.
int mfib_entry_cmp_for_sort(void *i1, void *i2)
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P (general version).
fib_node_index_t ip4_mfib_table_lookup_exact_match(const ip4_mfib_t *mfib, const ip4_address_t *grp, const ip4_address_t *src, u32 len)
u8 * format_mfib_entry(u8 *s, va_list *args)
#define vec_free(V)
Free vector's memory (no header).
u32 fib_node_index_t
A typedef of a node index.
Aggregrate type for a prefix.
#define VLIB_CLI_COMMAND(x,...)
uword * fib_entry_by_dst_address[65]
#define hash_create(elts, value_bytes)
fib_node_index_t ip4_mfib_table_lookup(const ip4_mfib_t *mfib, const ip4_address_t *src, const ip4_address_t *grp, u32 len)
The IPv4 Multicast-FIB.
void ip4_mfib_table_entry_insert(ip4_mfib_t *mfib, const ip4_address_t *grp, const ip4_address_t *src, u32 len, fib_node_index_t fib_entry_index)
fib_protocol_t mft_proto
Which protocol this table serves.
u32 mft_table_id
Table ID (hash key) for this FIB.
static u32 ip4_create_mfib_with_table_id(u32 table_id)
static void ip4_mfib_table_show_all(ip4_mfib_t *mfib, vlib_main_t *vm)
#define FIB_NODE_INDEX_INVALID
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
void mfib_table_lock(u32 fib_index, fib_protocol_t proto)
Release a reference counting lock on the table.
int(* mfib_table_walk_fn_t)(fib_node_index_t fei, void *ctx)
Call back function when walking entries in a FIB table.
A protocol Independent IP multicast FIB table.
ip4_main_t ip4_main
Global ip4 main structure.
#define vec_foreach(var, vec)
Vector iterator.
uword * mfib_index_by_table_id
Hash table mapping table id to multicast fib index.
#define CLIB_CACHE_LINE_BYTES
static u32 ip4_mfib_index_from_table_id(u32 table_id)
#define HASH_FLAG_NO_AUTO_SHRINK
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
void ip4_mfib_table_destroy(ip4_mfib_t *mfib)
ip46_address_t fp_grp_addr
The address type is not deriveable from the fp_addr member.