61 .ip4.data_u32 = 0xf0000000,
77 .ip4.data_u32 = 0xe0000000,
92 .ip4.data_u32 = 0xffffffff,
109 memset(fib_table, 0,
sizeof(*fib_table));
136 for (ii = 0; ii <
ARRAY_LEN(ip4_specials); ii++)
141 clib_host_to_net_u32(prefix.
fp_addr.ip4.data_u32);
161 for (ii = 0; ii <
ARRAY_LEN(ip4_specials); ii++)
166 clib_host_to_net_u32(prefix.
fp_addr.ip4.data_u32);
240 uword * hash, * result;
248 if (
NULL != result) {
288 uword * hash, * result;
292 for (mask_len = len; mask_len >= 0; mask_len--)
299 if (
NULL != result) {
312 uword * hash, * result;
319 if (
NULL == result) {
327 hash =
hash_set(hash, key, fib_entry_index);
341 uword * hash, * result;
397 fn(p->
value[0], ctx);
465 int verbose, matching, mtrie;
467 u32 matching_mask = 32;
468 int i, table_id = -1, fib_index = ~0;
489 else if (
unformat (input,
"table %d", &table_id))
491 else if (
unformat (input,
"index %d", &fib_index))
499 ip4_fib_t *fib = &fib_table->v4;
501 if (table_id >= 0 && table_id != (int)fib->table_id)
503 if (fib_index != ~0 && fib_index != (int)fib->index)
506 vlib_cli_output (vm,
"%U, fib_index %d, flow hash: %U",
507 format_fib_table_name, fib->index, FIB_PROTOCOL_IP4,
509 format_ip_flow_hash_config, fib->flow_hash_config);
514 vlib_cli_output (vm,
"%=20s%=16s",
"Prefix length",
"Count");
515 for (i = 0; i < ARRAY_LEN (fib->fib_entry_by_dst_address); i++)
517 uword * hash = fib->fib_entry_by_dst_address[i];
518 uword n_elts = hash_elts (hash);
520 vlib_cli_output (vm,
"%20d%16d", i, n_elts);
687 .path =
"show ip fib",
688 .short_help =
"show ip fib [summary] [table <table-id>] [index <fib-id>] [<ip4-addr>[/<mask>]] [mtrie]",
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)
void fib_table_lock(u32 fib_index, fib_protocol_t proto)
Release a reference counting lock on the table.
#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.
const dpo_id_t * fib_entry_contribute_ip_forwarding(fib_node_index_t fib_entry_index)
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).
static clib_error_t * ip4_show_fib(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
static void ip4_fib_table_show_all(ip4_fib_t *fib, vlib_main_t *vm)
static u32 ip4_create_fib_with_table_id(u32 table_id)
u32 fwd_classify_table_index
fib_entry_flag_t ift_flag
u32 ip4_fib_table_get_index_for_sw_if_index(u32 sw_if_index)
#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.
void ip4_fib_mtrie_add_del_route(ip4_fib_t *fib, ip4_address_t dst_address, u32 dst_address_length, u32 adj_index, u32 is_del)
Aggregrate type for a prefix.
static void hash_set_flags(void *v, uword flags)
u32 ip4_fib_table_find_or_create_and_lock(u32 table_id)
Get or create an IPv4 fib.
static int ip4_fib_show_walk_cb(fib_node_index_t fib_entry_index, void *arg)
u32 rev_classify_table_index
void ip4_fib_table_destroy(ip4_fib_t *fib)
void ip4_fib_table_entry_remove(ip4_fib_t *fib, const ip4_address_t *addr, u32 len)
int fib_entry_cmp_for_sort(void *i1, void *i2)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
uword * fib_entry_by_dst_address[33]
uword * fib_index_by_table_id
Hash table mapping table id to fib index.
enum fib_source_t_ fib_source_t
The different sources that can create a route.
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
flow_hash_config_t ip4_fib_table_get_flow_hash_config(u32 fib_index)
#define pool_put(P, E)
Free an object E in pool P.
u32 ft_total_route_counts
Total route counters.
void ip4_fib_table_fwding_dpo_update(ip4_fib_t *fib, const ip4_address_t *addr, u32 len, const dpo_id_t *dpo)
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P (general version).
fib_node_index_t ip4_fib_table_lookup(const ip4_fib_t *fib, const ip4_address_t *addr, u32 len)
The IPv4 FIB.
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 ip4_fib_table_entry_insert(ip4_fib_t *fib, const ip4_address_t *addr, u32 len, fib_node_index_t fib_entry_index)
fib_node_index_t ft_index
Index into FIB vector.
void ip4_mtrie_init(ip4_fib_mtrie_t *m)
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)
static ip4_fib_t * ip4_fib_get(u32 index)
Get the FIB at the given index.
fib_node_index_t * ifsw_indicies
u32 fib_node_index_t
A typedef of a node index.
static u32 ip4_fib_index_from_table_id(u32 table_id)
void ip4_fib_table_walk(ip4_fib_t *fib, fib_table_walk_fn_t fn, void *ctx)
Walk all entries in a FIB table N.B: This is NOT safe to deletes.
enum fib_entry_flag_t_ fib_entry_flag_t
#define VLIB_CLI_COMMAND(x,...)
#define hash_create(elts, value_bytes)
The default route source.
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.
#define FIB_ENTRY_FORMAT_BRIEF
format_function_t format_ip4_fib_mtrie
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)
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
#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.
flow_hash_config_t flow_hash_config
static void ip4_fib_table_show_one(ip4_fib_t *fib, vlib_main_t *vm, ip4_address_t *address, u32 mask_len)
struct ip4_fib_table_special_prefix_t_ ip4_fib_table_special_prefix_t
ip4_main_t ip4_main
Global ip4 main structure.
struct fib_table_t_ * fibs
Vector of FIBs.
#define vec_foreach(var, vec)
Vector iterator.
index_t ip4_fib_table_lookup_lb(ip4_fib_t *fib, const ip4_address_t *addr)
void ip4_fib_table_fwding_dpo_remove(ip4_fib_t *fib, const ip4_address_t *addr, u32 len, const dpo_id_t *dpo)
#define CLIB_CACHE_LINE_BYTES
u32 ip4_fib_table_create_and_lock(void)
#define HASH_FLAG_NO_AUTO_SHRINK
fib_node_index_t ip4_fib_table_lookup_exact_match(const ip4_fib_t *fib, const ip4_address_t *addr, u32 len)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
struct ip4_fib_show_walk_ctx_t_ ip4_fib_show_walk_ctx_t
Walk show context.
A protocol Independent FIB table.