26 #define IP6_MFIB_KEY_LEN 33 102 .ims_scope = IP6_MULTICAST_SCOPE_link_local,
103 .ims_byte = IP6_MULTICAST_GROUP_ID_all_routers,
111 .ims_scope = IP6_MULTICAST_SCOPE_link_local,
112 .ims_byte = IP6_MULTICAST_GROUP_ID_all_hosts,
121 .ims_scope = IP6_MULTICAST_SCOPE_link_local,
122 .ims_byte = IP6_MULTICAST_GROUP_ID_mldv2_routers,
126 #define FOR_EACH_IP6_SPECIAL(_pfx, _body) \ 128 const ip6_mfib_special_t *_spec; \ 131 _ii < ARRAY_LEN(ip6_mfib_specials); \ 134 _spec = &ip6_mfib_specials[_ii]; \ 135 if (IP6_MFIB_SPECIAL_TYPE_SOLICITED == _spec->ims_type) \ 137 ip6_set_solicited_node_multicast_address( \ 138 &(_pfx)->fp_grp_addr.ip6, 0); \ 142 ip6_set_reserved_multicast_address ( \ 143 &(_pfx)->fp_grp_addr.ip6, \ 147 (_pfx)->fp_len = _spec->ims_len; \ 148 do { _body; } while (0); \ 164 .frp_sw_if_index = 0xffffffff,
171 memset(mfib_table, 0,
sizeof(*mfib_table));
228 .frp_sw_if_index = 0xffffffff,
328 #define IP6_MFIB_MK_KEY(_grp, _src, _key) \ 330 (_key)->key[0] = 33; \ 331 memcpy((_key)->key+1, _grp, 16); \ 332 memcpy((_key)->key+17, _src, 16); \ 335 #define IP6_MFIB_MK_KEY_MASK(_grp, _src, _len, _key) \ 337 IP6_MFIB_MK_KEY(_grp, _src, _key); \ 339 (_key)->mask[0] = 33; \ 342 memcpy((_key)->mask+1, &ip6_main.fib_masks[_len], 16); \ 343 memset((_key)->mask+17, 0, 16); \ 347 ASSERT(_len == 256); \ 348 memcpy((_key)->mask+1, &ip6_main.fib_masks[128], 16); \ 349 memcpy((_key)->mask+17, &ip6_main.fib_masks[128], 16); \ 478 s =
format(s,
"%=30s %=6d %=8s\n",
581 int verbose, matching;
584 int table_id = -1, fib_index = ~0;
604 memset(&src, 0,
sizeof(src));
609 memset(&src, 0,
sizeof(src));
613 else if (
unformat (input,
"table %d", &table_id))
615 else if (
unformat (input,
"index %d", &fib_index))
623 ip6_mfib_t *mfib = &mfib_table->v6;
625 if (table_id >= 0 && table_id != (int)mfib->table_id)
627 if (fib_index != ~0 && fib_index != (int)mfib->index)
630 vlib_cli_output (vm,
"%U, fib_index %d",
631 format_mfib_table_name, mfib->index, FIB_PROTOCOL_IP6,
705 .path =
"show ip6 mfib",
706 .short_help =
"show ip mfib [summary] [table <table-id>] [index <fib-id>] [<grp-addr>[/<mask>]] [<grp-addr>] [<src-addr> <grp-addr>]",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
#define MFIB_ENTRY_FORMAT_DETAIL
ip6_mfib_special_type_t ims_type
solicited or not
ip46_address_t fp_src_addr
#define hash_set(h, key, value)
enum ip6_mfib_special_type_t_ ip6_mfib_special_type_t
#define hash_unset(h, key)
u32 * mfib_index_by_sw_if_index
Table index indexed by software interface.
A representation of a path as described by a route producer.
fib_node_index_t * entries
struct ip6_mfib_key_t_ ip6_mfib_key_t
Key and mask for radix.
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
fib_node_index_t ip6_mfib_table_lookup(const ip6_mfib_t *mfib, const ip6_address_t *src, const ip6_address_t *grp, u32 len)
The IPv4 Multicast-FIB.
#define IP6_MFIB_MK_KEY_MASK(_grp, _src, _len, _key)
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.
fib_node_index_t ip6_mfib_table_lookup2(const ip6_mfib_t *mfib, const ip6_address_t *src, const ip6_address_t *grp)
Data-plane lookup function.
dpo_proto_t frp_proto
The protocol of the address below.
void ip6_mfib_table_destroy(ip6_mfib_t *mfib)
#define MFIB_ENTRY_FORMAT_BRIEF
struct radix_node * rn_search_m(const void *v_arg, struct radix_node *head, const void *m_arg)
u32 ip6_mfib_table_find_or_create_and_lock(u32 table_id, mfib_source_t src)
Get or create an IPv4 fib.
enum mfib_source_t_ mfib_source_t
Possible [control plane] sources of MFIB entries.
u8 ims_len
the Prefix length
memset(h->entries, 0, sizeof(h->entries[0])*entries)
static clib_error_t * ip6_show_mfib(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
#define IP6_MFIB_MK_KEY(_grp, _src, _key)
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.
fib_node_index_t mfib_table_entry_path_update(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, const fib_route_path_t *rpath, mfib_itf_flags_t itf_flags)
Add n paths to an entry (aka route) in the FIB.
void ip6_mfib_table_entry_insert(ip6_mfib_t *mfib, const ip6_address_t *grp, const ip6_address_t *src, u32 len, fib_node_index_t mfib_entry_index)
void ip6_mfib_table_walk(ip6_mfib_t *mfib, mfib_table_walk_fn_t fn, void *ctx)
Walk the IP6 mfib table.
struct ip6_mfib_show_ctx_t_ ip6_mfib_show_ctx_t
mfib_table_walk_fn_t user_fn
uword * mfib_index_by_table_id
Hash table mapping table id to multicast fib index.
u8 * format_ip6_mfib_table_memory(u8 *s, va_list *args)
format (display) ipv6 MFIB mempry usage
struct radix_node * rn_lookup(const void *v_arg, const void *m_arg, struct radix_node_head *head)
u8 mask[IP6_MFIB_KEY_LEN]
fib_node_index_t mfib_table_lookup_exact_match(u32 fib_index, const mfib_prefix_t *prefix)
Perfom an exact match in the non-forwarding table.
struct radix_node * rnh_treetop
#define pool_put(P, E)
Free an object E in pool P.
int mfib_entry_cmp_for_sort(void *i1, void *i2)
void mfib_table_lock(u32 fib_index, fib_protocol_t proto, mfib_source_t source)
Release a reference counting lock on the table.
u8 ims_byte
The last byte of the mcast address.
struct radix_node i6mn_nodes[2]
static void ip6_mfib_table_show_one(ip6_mfib_t *mfib, vlib_main_t *vm, ip6_address_t *src, ip6_address_t *grp, u32 mask_len)
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P (general version).
void ip6_mfib_interface_enable_disable(u32 sw_if_index, int is_enable)
Add/remove the interface from the accepting list of the special MFIB entries.
u32 ip6_mfib_table_get_index_for_sw_if_index(u32 sw_if_index)
int rn_walktree(struct radix_node_head *h, int(*f)(struct radix_node *, void *), void *w)
static void ip6_mfib_table_show_all(ip6_mfib_t *mfib, vlib_main_t *vm)
u8 * format_mfib_entry(u8 *s, va_list *args)
#define vec_free(V)
Free vector's memory (no header).
static int ip6_mfib_table_collect_entries(fib_node_index_t mfei, void *arg)
struct radix_node_head * rhead
static u32 ip6_create_mfib_with_table_id(u32 table_id, mfib_source_t src)
u32 fib_node_index_t
A typedef of a node index.
Aggregrate type for a prefix.
#define VLIB_CLI_COMMAND(x,...)
static clib_error_t * ip6_mfib_module_init(vlib_main_t *vm)
struct ip6_mfib_node_t_ ip6_mfib_node_t
An object that is inserted into the radix tree.
u8 ims_scope
The scope of the address.
static void clib_mem_free(void *p)
static u32 ip6_mfib_index_from_table_id(u32 table_id)
struct mfib_table_t_ * mfibs
Vector of MFIBs.
fib_protocol_t mft_proto
Which protocol this table serves.
struct ip6_mfib_special_t_ ip6_mfib_special_t
u32 mft_table_id
Table ID (hash key) for this FIB.
struct radix_node * rn_delete(const void *v_arg, const void *netmask_arg, struct radix_node_head *head)
static void * clib_mem_alloc(uword size)
fib_protocol_t fp_proto
protocol type
struct ip6_mfib_radix_walk_ctx_t_ ip6_mfib_radix_walk_ctx_t
fib_node_index_t ip6_mfib_table_lookup_exact_match(const ip6_mfib_t *mfib, const ip6_address_t *grp, const ip6_address_t *src, u32 len)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
int rn_inithead0(struct radix_node_head *rnh, int off)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
void ip6_mfib_table_entry_remove(ip6_mfib_t *mfib, const ip6_address_t *grp, const ip6_address_t *src, u32 len)
int(* mfib_table_walk_fn_t)(fib_node_index_t fei, void *ctx)
Call back function when walking entries in a FIB table.
static void * clib_mem_alloc_aligned(uword size, uword align)
A protocol Independent IP multicast FIB table.
#define IP6_MFIB_KEY_LEN
The number of bytes in an address/ask key in the radix tree First byte is the length in bytes...
#define vec_foreach(var, vec)
Vector iterator.
An object that is inserted into the radix tree.
void mfib_table_entry_path_remove(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, const fib_route_path_t *rpath)
Remove n paths to an entry (aka route) in the FIB.
#define CLIB_CACHE_LINE_BYTES
struct radix_node * rn_addroute(const void *v_arg, const void *n_arg, struct radix_node_head *head, struct radix_node treenodes[2])
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
struct radix_node * rn_match(const void *v_arg, struct radix_node_head *head)
#define FOR_EACH_IP6_SPECIAL(_pfx, _body)
const ip46_address_t zero_addr
static int ip6_mfib_table_radix_walk(struct radix_node *rn, void *arg)
static uword pool_elts(void *v)
Number of active elements in a pool.