47 pfx.
fp_addr.ip6.as_u64[0] = clib_host_to_net_u64 (0xFE80000000000000ULL);
178 const ip6_address_t *
addr,
189 kv.
key[0] = addr->as_u64[0];
190 kv.
key[1] = addr->as_u64[1];
191 fib = ((
u64)((fib_index))<<32);
198 while (i < n_p && table->prefix_lengths_in_search_order[i] > len)
208 ASSERT(dst_address_length >= 0 && dst_address_length <= 128);
210 kv.
key[0] &= mask->as_u64[0];
211 kv.
key[1] &= mask->as_u64[1];
212 kv.
key[2] = fib | dst_address_length;
214 rv = clib_bihash_search_inline_2_24_8(&table->
ip6_hash, &kv, &value);
224 const ip6_address_t *
addr,
235 fib = ((
u64)((fib_index))<<32);
237 kv.
key[0] = addr->as_u64[0] & mask->as_u64[0];
238 kv.
key[1] = addr->as_u64[1] & mask->as_u64[1];
241 rv = clib_bihash_search_inline_2_24_8(&table->
ip6_hash, &kv, &value);
251 u8 *old, *prefix_lengths_in_search_order = NULL;
263 int dst_address_length = 128 - i;
264 vec_add1(prefix_lengths_in_search_order, dst_address_length);
278 const ip6_address_t *
addr,
288 fib = ((
u64)((fib_index))<<32);
290 kv.
key[0] = addr->as_u64[0] & mask->as_u64[0];
291 kv.
key[1] = addr->as_u64[1] & mask->as_u64[1];
294 clib_bihash_add_del_24_8(&table->
ip6_hash, &kv, 0);
309 const ip6_address_t *
addr,
320 fib = ((
u64)((fib_index))<<32);
322 kv.
key[0] = addr->as_u64[0] & mask->as_u64[0];
323 kv.
key[1] = addr->as_u64[1] & mask->as_u64[1];
325 kv.
value = fib_entry_index;
327 clib_bihash_add_del_24_8(&table->
ip6_hash, &kv, 1);
340 const ip6_address_t *
dst)
362 const ip6_address_t *
addr,
373 fib = ((
u64)((fib_index))<<32);
375 kv.
key[0] = addr->as_u64[0] & mask->as_u64[0];
376 kv.
key[1] = addr->as_u64[1] & mask->as_u64[1];
380 clib_bihash_add_del_24_8(&table->
ip6_hash, &kv, 1);
393 const ip6_address_t *
addr,
404 fib = ((
u64)((fib_index))<<32);
406 kv.
key[0] = addr->as_u64[0] & mask->as_u64[0];
407 kv.
key[1] = addr->as_u64[1] & mask->as_u64[1];
411 clib_bihash_add_del_24_8(&table->
ip6_hash, &kv, 0);
446 key.as_u64[0] = kvp->
key[0];
447 key.as_u64[1] = kvp->
key[1];
481 .fp_len = kvp->
key[2] & 0xffffffff,
504 .i6w_fib_index = fib_index,
510 .i6w_sub_trees = NULL,
513 clib_bihash_foreach_key_value_pair_24_8(
528 .i6w_fib_index = fib_index,
534 clib_bihash_foreach_key_value_pair_24_8(
601 s =
format(s,
"%=30s %=6d %=12ld\n",
610 u64 count_by_prefix_length[129];
621 return (BIHASH_WALK_CONTINUE);
623 mask_width = kvp->
key[2] & 0xFF;
627 return (BIHASH_WALK_CONTINUE);
639 int verbose, matching;
640 ip6_address_t matching_address;
656 else if (
unformat (input,
"detail") ||
660 else if (
unformat (input,
"hash") ||
672 else if (
unformat (input,
"table %d", &table_id))
674 else if (
unformat (input,
"index %d", &fib_index))
698 fib = pool_elt_at_index(im6->v6_fibs, fib_table->ft_index);
699 if (table_id >= 0 && table_id != (int)fib->table_id)
701 if (fib_index != ~0 && fib_index != (int)fib->index)
703 if (fib_table->ft_flags & FIB_TABLE_FLAG_IP6_LL)
706 s = format(s,
"%U, fib_index:%d, flow hash:[%U] epoch:%d flags:%U locks:[",
707 format_fib_table_name, fib->index,
710 format_ip_flow_hash_config,
711 fib_table->ft_flow_hash_config,
713 format_fib_table_flags, fib_table->ft_flags);
715 vec_foreach_index(source, fib_table->ft_locks)
717 if (0 != fib_table->ft_locks[source])
719 s = format(s,
"%U:%d, ",
720 format_fib_source, source,
721 fib_table->ft_locks[source]);
739 clib_bihash_foreach_key_value_pair_24_8
742 for (len = 128; len >= 0; len--)
860 .path =
"show ip6 fib",
861 .short_help =
"show ip6 fib [summary] [table <table-id>] [index <fib-id>] [<ip6-addr>[/<width>]] [detail]",
fib_protocol_t fp_proto
protocol type
u8 * format_fib_entry(u8 *s, va_list *args)
enum fib_source_t_ fib_source_t
The different sources that can create a route.
#define vec_foreach_index(var, v)
Iterate over vector indices.
Continue on to the next entry.
#define hash_set(h, key, value)
void vlib_worker_wait_one_loop(void)
Wait until each of the workers has been once around the track.
fib_protocol_t ft_proto
Which protocol this table serves.
static u32 ip6_fib_table_fwding_lookup(u32 fib_index, const ip6_address_t *dst)
#define hash_unset(h, key)
vl_api_wireguard_peer_flags_t flags
The table that stores ALL routes learned by the DP.
#define FIB_ENTRY_FORMAT_DETAIL
static fib_table_walk_rc_t ip6_fib_table_show_walk(fib_node_index_t fib_entry_index, void *arg)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
u8 * format_ip6_fib_table_memory(u8 *s, va_list *args)
enum fib_table_flags_t_ fib_table_flags_t
#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. ...
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static void ip6_fib_table_show_all(ip6_fib_t *fib, vlib_main_t *vm)
u64 count_by_prefix_length[129]
u8 * prefix_lengths_in_search_order
static void vnet_ip6_fib_init(u32 fib_index)
fib_node_index_t ip6_fib_table_lookup_exact_match(u32 fib_index, const ip6_address_t *addr, u32 len)
clib_bihash_24_8_t ip6_hash
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
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.
static uword ip6_destination_matches_route(const ip6_main_t *im, const ip6_address_t *key, const ip6_address_t *dest, uword dest_length)
fib_prefix_t * i6w_sub_trees
Aggregate type for a prefix.
A representation of a single IP6 table.
u16 fp_len
The mask length.
static u32 create_fib_with_table_id(u32 table_id, fib_source_t src, fib_table_flags_t flags, u8 *desc)
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.
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.
u32 ip6_fib_table_find_or_create_and_lock(u32 table_id, fib_source_t src)
Get or create an IPv6 fib.
Stop the walk completely.
void ip6_fib_table_entry_remove(u32 fib_index, const ip6_address_t *addr, u32 len)
Context when walking the IPv6 table.
uword * fib_index_by_table_id
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
ip6_address_t fib_masks[129]
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.
fib_node_index_t ft_index
Index into FIB vector.
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
sll srl srl sll sra u16x4 i
enum fib_table_walk_rc_t_ fib_table_walk_rc_t
return code controlling how a table walk proceeds
#define vec_free(V)
Free vector's memory (no header).
void fib_table_entry_delete(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Delete a FIB entry.
u32 ip6_fib_table_create_and_lock(fib_source_t src, fib_table_flags_t flags, u8 *desc)
u8 * ft_desc
Table description.
fib_table_flags_t ft_flags
Table flags.
const dpo_id_t * ip6_ll_dpo_get(void)
The IP6 link-local DPO represents the lookup of a packet in the link-local IPv6 FIB.
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
fib_table_walk_rc_t(* fib_table_walk_fn_t)(fib_node_index_t fei, void *ctx)
Call back function when walking entries in a FIB table.
static int ip6_fib_walk_cb(clib_bihash_kv_24_8_t *kvp, void *arg)
void fib_table_lock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Release a reference counting lock on the table.
#define VLIB_CLI_COMMAND(x,...)
fib_node_index_t fib_table_entry_special_dpo_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Add a 'special' entry to the FIB that links to the DPO passed A special entry is an entry that the FI...
#define pool_put_index(p, i)
Free pool element with given index.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
manual_print typedef address
i32 dst_address_length_refcounts[129]
static void ip6_fib_table_show_one(ip6_fib_t *fib, vlib_main_t *vm, ip6_address_t *address, u32 mask_len, int detail)
static int count_routes_in_fib_at_prefix_length(clib_bihash_kv_24_8_t *kvp, void *arg)
#define IP_FLOW_HASH_DEFAULT
Default: 5-tuple without the "reverse" bit.
ip6_fib_table_instance_t ip6_table[IP6_FIB_NUM_TABLES]
The two FIB tables; fwding and non-fwding.
Do no traverse down this sub-tree.
#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
#define FIB_NODE_INDEX_INVALID
#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)
The default route source.
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.
u32 * ft_src_route_counts
Per-source route counters.
#define FIB_ENTRY_FORMAT_DETAIL2
#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)
void fib_table_assert_empty(const fib_table_t *fib_table)
Debug function.
#define CLIB_CACHE_LINE_BYTES
void ip6_fib_table_sub_tree_walk(u32 fib_index, const fib_prefix_t *root, fib_table_walk_fn_t fn, void *arg)
Walk all entries in a sub-tree of the FIB table N.B: This is NOT safe to deletes. ...
struct fib_table_t_ * fibs
u32 * fib_index_by_sw_if_index
vl_api_interface_index_t sw_if_index
A protocol Independent FIB table.
static uword pool_elts(void *v)
Number of active elements in a pool.