43 pfx.
fp_addr.ip6.as_u64[0] = clib_host_to_net_u64 (0xFE80000000000000ULL);
58 memset(fib_table, 0,
sizeof(*fib_table));
134 IP6_MULTICAST_SCOPE_link_local,
135 IP6_MULTICAST_GROUP_ID_all_routers);
145 IP6_MULTICAST_SCOPE_link_local,
146 IP6_MULTICAST_GROUP_ID_all_hosts);
156 IP6_MULTICAST_SCOPE_link_local,
157 IP6_MULTICAST_GROUP_ID_mldv2_routers);
166 pfx.
fp_addr.ip6.as_u64[0] = clib_host_to_net_u64 (0xFE80000000000000ULL);
198 BVT(clib_bihash_kv) kv, value;
205 kv.key[0] = addr->
as_u64[0];
206 kv.key[1] = addr->
as_u64[1];
207 fib = ((
u64)((fib_index))<<32);
214 while (i < n_p && table->prefix_lengths_in_search_order[i] > len)
224 ASSERT(dst_address_length >= 0 && dst_address_length <= 128);
226 kv.key[0] &= mask->
as_u64[0];
227 kv.key[1] &= mask->
as_u64[1];
228 kv.key[2] = fib | dst_address_length;
230 rv = BV(clib_bihash_search_inline_2)(&table->ip6_hash, &kv, &value);
244 BVT(clib_bihash_kv) kv, value;
251 fib = ((
u64)((fib_index))<<32);
255 kv.key[2] = fib | len;
257 rv = BV(clib_bihash_search_inline_2)(&table->ip6_hash, &kv, &value);
272 int dst_address_length = 128 - i;
273 vec_add1(table->prefix_lengths_in_search_order, dst_address_length);
283 BVT(clib_bihash_kv) kv;
289 fib = ((
u64)((fib_index))<<32);
293 kv.key[2] = fib | len;
315 BVT(clib_bihash_kv) kv;
321 fib = ((
u64)((fib_index))<<32);
325 kv.key[2] = fib | len;
326 kv.value = fib_entry_index;
346 BVT(clib_bihash_kv) kv, value;
352 kv.key[0] = dst->
as_u64[0];
353 kv.key[1] = dst->
as_u64[1];
354 fib = ((
u64)((fib_index))<<32);
356 for (i = 0; i < len; i++)
361 ASSERT(dst_address_length >= 0 && dst_address_length <= 128);
363 kv.key[0] &= mask->
as_u64[0];
364 kv.key[1] &= mask->
as_u64[1];
365 kv.key[2] = fib | dst_address_length;
367 rv = BV(clib_bihash_search_inline_2)(&table->ip6_hash, &kv, &value);
412 BVT(clib_bihash_kv) kv;
418 fib = ((
u64)((fib_index))<<32);
422 kv.key[2] = fib | len;
442 BVT(clib_bihash_kv) kv;
448 fib = ((
u64)((fib_index))<<32);
452 kv.key[2] = fib | len;
563 u64 count_by_prefix_length[129];
567 (
BVT(clib_bihash_kv) * kvp,
void *arg)
575 mask_width = kvp->key[2] & 0xFF;
589 int verbose, matching;
592 int table_id = -1, fib_index = ~0;
611 else if (
unformat (input,
"table %d", &table_id))
613 else if (
unformat (input,
"index %d", &fib_index))
621 fib = &(fib_table->v6);
622 if (table_id >= 0 && table_id != (int)fib->table_id)
624 if (fib_index != ~0 && fib_index != (int)fib->index)
627 vlib_cli_output (vm,
"%s, fib_index %d, flow hash: %U",
628 fib_table->ft_desc, fib->index,
629 format_ip_flow_hash_config, fib->flow_hash_config);
634 BVT(clib_bihash) * h = &im6->ip6_table[IP6_FIB_TABLE_NON_FWDING].ip6_hash;
637 vlib_cli_output (vm,
"%=20s%=16s",
"Prefix length",
"Count");
639 memset (ca, 0, sizeof(*ca));
640 ca->fib_index = fib->index;
642 BV(clib_bihash_foreach_key_value_pair)
643 (h, count_routes_in_fib_at_prefix_length, ca);
645 for (len = 128; len >= 0; len--)
647 if (ca->count_by_prefix_length[len])
648 vlib_cli_output (vm,
"%=20d%=16lld",
649 len, ca->count_by_prefix_length[len]);
763 .path =
"show ip6 fib",
764 .short_help =
"show ip6 fib [summary] [table <table-id>] [index <fib-id>] [<ip6-addr>[/<width>]]",
fib_protocol_t fp_proto
protocol type
u8 * format_fib_entry(u8 *s, va_list *args)
#define hash_set(h, key, value)
sll srl srl sll sra u16x4 i
fib_protocol_t ft_proto
Which protocol this table serves.
#define hash_unset(h, key)
static ip6_fib_t * ip6_fib_get(fib_node_index_t index)
void fib_table_lock(u32 fib_index, fib_protocol_t proto)
Release a reference counting lock on the table.
The table that stores ALL routes learned by the DP.
#define FIB_ENTRY_FORMAT_DETAIL
int(* fib_table_walk_fn_t)(fib_node_index_t fei, void *ctx)
Call back function when walking entries in a FIB table.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
static void ip6_fib_table_show_all(ip6_fib_t *fib, vlib_main_t *vm)
u8 * prefix_lengths_in_search_order
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static void vnet_ip6_fib_init(u32 fib_index)
static u32 create_fib_with_table_id(u32 table_id)
flow_hash_config_t flow_hash_config
static int ip6_fib_table_show_walk(fib_node_index_t fib_entry_index, void *arg)
fib_node_index_t ip6_fib_table_lookup_exact_match(u32 fib_index, const ip6_address_t *addr, u32 len)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
int clib_bihash_add_del(clib_bihash *h, clib_bihash_kv *add_v, int is_add)
Add or delete a (key,value) pair from a bi-hash table.
void fib_table_entry_special_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Remove a 'special' entry from the FIB.
flow_hash_config_t ip6_fib_table_get_flow_hash_config(u32 fib_index)
Aggregrate type for a prefix.
A represenation of a single IP6 table.
u16 fp_len
The mask length.
int fib_entry_cmp_for_sort(void *i1, void *i2)
u32 ip6_fib_table_get_index_for_sw_if_index(u32 sw_if_index)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
#define clib_bitmap_foreach(i, ai, body)
Macro to iterate across set bits in a bitmap.
enum fib_source_t_ fib_source_t
The different sources that can create a route.
void ip6_fib_table_fwding_dpo_update(u32 fib_index, const ip6_address_t *addr, u32 len, const dpo_id_t *dpo)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
#define pool_put(P, E)
Free an object E in pool P.
void ip6_fib_table_fwding_dpo_remove(u32 fib_index, const ip6_address_t *addr, u32 len, const dpo_id_t *dpo)
u32 ft_total_route_counts
Total route counters.
void ip6_fib_table_walk(u32 fib_index, fib_table_walk_fn_t fn, void *arg)
Walk all entries in a FIB table N.B: This is NOT safe to deletes.
void ip6_fib_table_entry_remove(u32 fib_index, const ip6_address_t *addr, u32 len)
Context when walking the IPv6 table.
static void ip6_fib_table_show_one(ip6_fib_t *fib, vlib_main_t *vm, ip6_address_t *address, u32 mask_len)
uword * fib_index_by_table_id
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P (general version).
ip6_address_t fib_masks[129]
u32 ip6_fib_table_fwding_lookup(ip6_main_t *im, u32 fib_index, const ip6_address_t *dst)
fib_node_index_t fib_table_entry_special_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags)
Add a 'special' entry to the FIB.
void clib_bihash_foreach_key_value_pair(clib_bihash *h, void *callback, void *arg)
Visit active (key,value) pairs in a bi-hash table.
fib_node_index_t ft_index
Index into FIB vector.
u32 ip6_fib_table_create_and_lock(void)
void ip6_fib_table_destroy(u32 fib_index)
u32 ft_table_id
Table ID (hash key) for this FIB.
u32 ft_flow_hash_config
flow hash configuration
#define vec_free(V)
Free vector's memory (no header).
#define FOR_EACH_FIB_SOURCE(_item)
This table stores the routes that are used to forward traffic.
static void compute_prefix_lengths_in_search_order(ip6_fib_table_instance_t *table)
u32 fib_node_index_t
A typedef of a node index.
fib_node_index_t * entries
fib_table_walk_fn_t i6w_fn
static int ip6_fib_walk_cb(clib_bihash_kv_24_8_t *kvp, void *arg)
#define VLIB_CLI_COMMAND(x,...)
The default route source.
i32 dst_address_length_refcounts[129]
u32 ft_src_route_counts[FIB_SOURCE_MAX]
Per-source route counters.
#define IP_FLOW_HASH_DEFAULT
Default: 5-tuple without the "reverse" bit.
u32 flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
ip6_fib_table_instance_t ip6_table[IP6_FIB_NUM_TABLES]
The two FIB tables; fwding and non-fwding.
#define vec_elt(v, i)
Get vector value at index i.
#define FIB_ENTRY_FORMAT_BRIEF
struct ip6_fib_show_ctx_t_ ip6_fib_show_ctx_t
u32 ip6_fib_table_fwding_lookup_with_if_index(ip6_main_t *im, u32 sw_if_index, const ip6_address_t *dst)
index_t dpoi_index
the index of objects of that type
static void ip6_set_solicited_node_multicast_address(ip6_address_t *a, u32 id)
#define FIB_NODE_INDEX_INVALID
u32 ip6_fib_table_find_or_create_and_lock(u32 table_id)
Get or create an IPv6 fib.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static clib_error_t * ip6_show_fib(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
void ip6_fib_table_entry_insert(u32 fib_index, const ip6_address_t *addr, u32 len, fib_node_index_t fib_entry_index)
static void count_routes_in_fib_at_prefix_length(BVT(clib_bihash_kv)*kvp, void *arg)
uword * non_empty_dst_address_length_bitmap
fib_table_t * fib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
struct ip6_fib_walk_ctx_t_ ip6_fib_walk_ctx_t
Context when walking the IPv6 table.
u64 count_by_prefix_length[129]
#define vec_foreach(var, vec)
Vector iterator.
fib_node_index_t ip6_fib_table_lookup(u32 fib_index, const ip6_address_t *addr, u32 len)
#define CLIB_CACHE_LINE_BYTES
struct fib_table_t_ * fibs
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
u32 * fib_index_by_sw_if_index
static void ip6_set_reserved_multicast_address(ip6_address_t *a, ip6_multicast_address_scope_t scope, u16 id)
A protocol Independent FIB table.