64 return (fib_entry - fib_entry_pool);
115 if ((1<<attr) & flag) {
130 if ((1<<sattr) & flag) {
149 level = va_arg (*args,
int);
165 s =
format(s,
" entry-flags:%U",
169 s =
format(s,
" src-flags:%U",
181 s =
format (s,
"\n forwarding: ");
192 s =
format (s,
" UNRESOLVED\n");
197 s =
format(s,
" %U-chain\n %U",
209 s =
format (s,
" Delegates:\n");
219 s =
format(s,
" Children:");
257 pool_put(fib_entry_pool, fib_entry);
361 u32 n_srcs = 0, n_exts = 0;
529 return (&fib_entry->
fe_lb);
613 pool_get(fib_entry_pool, fib_entry);
662 if (!was_import && is_import)
679 else if (was_import && !is_import)
702 if (!was_attached && is_attached)
760 return (fib_entry_index);
788 return (fib_entry_index);
834 if (new_source < old_source)
842 else if (new_source > old_source)
876 old_flags, new_source));
945 int has_only_inherited_sources = 1;
951 has_only_inherited_sources = 0;
955 if (has_only_inherited_sources)
1042 if (source < best_source)
1050 else if (source > best_source )
1133 if (source < best_source )
1142 else if (source > best_source ) {
1414 int was_looped, is_looped;
1429 if (!!was_looped != !!is_looped)
1569 return ((clib_net_to_host_u32(a1->
data_u32) >
1570 clib_net_to_host_u32(a2->
data_u32) ) ?
1581 int cmp = (clib_net_to_host_u16 (a1->
as_u16[i]) -
1582 clib_net_to_host_u16 (a2->
as_u16[i]));
1631 *fib_entry_index2));
1756 .path =
"show fib entry",
1758 .short_help =
"show fib entry",
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
fib_protocol_t fp_proto
protocol type
Contribute an object that is to be used to forward BIER packets.
u8 * format_fib_entry(u8 *s, va_list *args)
u32 fib_entry_get_fib_index(fib_node_index_t fib_entry_index)
static fib_entry_src_flag_t fib_entry_source_removed(fib_entry_t *fib_entry, fib_entry_flag_t old_flags)
Contribute an object that is to be used to forward IP6 packets.
#define FIB_ENTRY_DBG(_e, _fmt, _args...)
u8 * format_fib_entry_src_flags(u8 *s, va_list *args)
void fib_entry_unlock(fib_node_index_t fib_entry_index)
Contribute an object that is to be used to forward IP6 packets.
A representation of a fib path for fib_path_encode to convey the information to the caller...
static const char * fib_attribute_names[]
fib_node_bw_reason_flag_t bw_reason
int fib_entry_is_resolved(fib_node_index_t fib_entry_index)
Return !0 is the entry is resolved, i.e.
fib_protocol_t fib_entry_get_proto(const fib_entry_t *fib_entry)
fib_entry_flag_t fib_entry_get_flags_i(const fib_entry_t *fib_entry)
A representation of a path as described by a route producer.
void fib_attached_export_cover_change(fib_entry_t *fib_entry)
If this entry is tracking a cover (in another table) then that cover has changed. ...
int dpo_is_adj(const dpo_id_t *dpo)
Return TRUE is the DPO is any type of adjacency.
static clib_error_t * show_fib_entry_command(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void fib_path_list_contribute_urpf(fib_node_index_t path_list_index, index_t urpf)
Contribute (add) this path list's uRPF list.
void fib_entry_set_flow_hash_config(fib_node_index_t fib_entry_index, flow_hash_config_t hash_config)
void fib_node_init(fib_node_t *node, fib_node_type_t type)
u32 fib_path_list_get_resolving_interface(fib_node_index_t path_list_index)
u32 fib_entry_child_add(fib_node_index_t fib_entry_index, fib_node_type_t child_type, fib_node_index_t child_index)
static fib_forward_chain_type_t fib_entry_chain_type_mcast_to_ucast(fib_forward_chain_type_t fct)
fib_entry_src_flag_t fib_entry_path_remove(fib_node_index_t fib_entry_index, fib_source_t source, const fib_route_path_t *rpath)
void fib_entry_path_add(fib_node_index_t fib_entry_index, fib_source_t source, fib_entry_flag_t flags, const fib_route_path_t *rpath)
#define FIB_ENTRY_FORMAT_DETAIL
static int dpo_id_is_valid(const dpo_id_t *dpoi)
Return true if the DPO object is valid, i.e.
static fib_entry_src_t * fib_entry_get_best_src_i(const fib_entry_t *fib_entry)
fib_node_index_t fib_entry_get_path_list(fib_node_index_t fib_entry_index)
Definitions for all things IP (v4|v6) unicast and multicast lookup related.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
Information related to the source of a FIB entry.
u32 fib_table_get_index_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the index of the FIB bound to the interface.
static int fib_ip6_address_compare(const ip6_address_t *a1, const ip6_address_t *a2)
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
void fib_entry_contribute_forwarding(fib_node_index_t fib_entry_index, fib_forward_chain_type_t fct, dpo_id_t *dpo)
void fib_entry_src_action_deactivate(fib_entry_t *fib_entry, fib_source_t source)
flow_hash_config_t lb_hash_config
the hash config to use when selecting a bucket.
const dpo_id_t * fib_entry_contribute_ip_forwarding(fib_node_index_t fib_entry_index)
enum fib_entry_delegate_type_t_ fib_entry_delegate_type_t
Delegate types.
fib_bfd_state_t fd_bfd_state
BFD state.
dpo_proto_t fib_forw_chain_type_to_dpo_proto(fib_forward_chain_type_t fct)
Convert from a chain type to the DPO proto it will install.
void fib_entry_child_remove(fib_node_index_t fib_entry_index, u32 sibling_index)
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
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).
Result from a cover update/change.
Contribute an object that is to be used to forward IP4 packets.
static const char * fib_src_attribute_names[]
void fib_node_deinit(fib_node_t *node)
const fib_prefix_t * fib_entry_get_prefix(fib_node_index_t fib_entry_index)
u32 fib_entry_pool_size(void)
void fib_entry_module_init(void)
u32 fe_fib_index
The index of the FIB table this entry is in.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
fib_entry_src_t * fe_srcs
Vector of source infos.
dpo_id_t fd_dpo
Valid for the forwarding chain delegates.
fib_node_index_t fe_parent
the path-list for which this entry is a child.
int fib_prefix_is_host(const fib_prefix_t *prefix)
Return true is the prefix is a host prefix.
#define pool_len(p)
Number of elements in pool vector.
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
u32 fib_node_child_add(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_type_t type, fib_node_index_t index)
static void fib_entry_post_install_actions(fib_entry_t *fib_entry, fib_source_t source, fib_entry_flag_t old_flags)
void fib_node_register_type(fib_node_type_t type, const fib_node_vft_t *vft)
fib_node_register_type
static fib_entry_src_flag_t fib_entry_src_burn_only_inherited(fib_entry_t *fib_entry)
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
dpo_proto_t fp_payload_proto
This protocol determines the payload protocol of packets that will be forwarded by this entry once th...
void fib_attached_export_purge(fib_entry_t *fib_entry)
All the imported entries need to be purged.
enum fib_entry_src_attribute_t_ fib_entry_src_attribute_t
Flags for the source data.
#define FIB_ENTRY_ATTRIBUTES
void fib_entry_special_update(fib_node_index_t fib_entry_index, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
fib_entry_src_flag_t fib_entry_src_action_path_remove(fib_entry_t *fib_entry, fib_source_t source, const fib_route_path_t *rpath)
fib_entry_t * fib_entry_src_action_path_add(fib_entry_t *fib_entry, fib_source_t source, fib_entry_flag_t flags, const fib_route_path_t *rpath)
void fib_entry_delegate_remove(fib_entry_t *fib_entry, fib_entry_delegate_type_t type)
void fib_walk_sync(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_back_walk_ctx_t *ctx)
Back walk all the children of a FIB node.
int fib_entry_is_host(fib_node_index_t fib_entry_index)
Return !0 is the entry represents a host prefix.
u8 * format_fib_prefix(u8 *s, va_list *args)
#define MPLS_IS_REPLICATE
The top bit of the index, which is the result of the MPLS lookup is used to determine if the DPO is a...
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Aggregrate type for a prefix.
fib_node_index_t fib_entry_get_index(const fib_entry_t *fib_entry)
void fib_entry_contribute_urpf(fib_node_index_t entry_index, index_t urpf)
Contribute the set of Adjacencies that this entry forwards with to build the uRPF list of its childre...
void fib_show_memory_usage(const char *name, u32 in_use_elts, u32 allocd_elts, size_t size_elt)
Show the memory usage for a type.
Contribute an object that is to be used to forward Ethernet packets.
static fib_node_back_walk_rc_t fib_entry_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
u16 fp_len
The mask length.
fib_entry_delegate_t * fib_entry_delegate_get(const fib_entry_t *fib_entry, fib_entry_delegate_type_t type)
int fib_entry_cmp_for_sort(void *i1, void *i2)
adj_index_t fib_entry_get_adj(fib_node_index_t fib_entry_index)
#define FOR_EACH_SRC_ADDED(_entry, _src, _source, action)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Contribute an object that is to be used to forward end-of-stack MPLS packets.
fib_node_bw_reason_flag_t fnbw_reason
The reason/trigger for the backwalk.
void fib_entry_src_mk_lb(fib_entry_t *fib_entry, const fib_entry_src_t *esrc, fib_forward_chain_type_t fct, dpo_id_t *dpo_lb)
static fib_source_t fib_entry_src_get_source(const fib_entry_src_t *esrc)
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
u8 * format_fib_node_bw_reason(u8 *s, va_list *args)
static int fib_ip4_address_compare(const ip4_address_t *a1, const ip4_address_t *a2)
fib_entry_t * fib_entry_src_action_add(fib_entry_t *fib_entry, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
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.
#define FOR_EACH_DELEGATE_CHAIN(_entry, _fdt, _fed, _body)
dpo_type_t dpoi_type
the type
void fib_node_lock(fib_node_t *node)
load-balancing over a choice of [un]equal cost paths
#define FOR_EACH_FIB_SRC_ATTRIBUTE(_item)
#define pool_put(P, E)
Free an object E in pool P.
fib_node_bw_flags_t fnbw_flags
additional flags for the walk
fib_entry_src_flag_t fib_entry_delete(fib_node_index_t fib_entry_index, fib_source_t source)
fib_entry_delete
u8 * format_fib_entry_deletegate(u8 *s, va_list *args)
fib_node_index_t fib_entry_create_special(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
A list of path-extensions.
enum fib_entry_attribute_t_ fib_entry_attribute_t
The different sources that can create a route.
fib_node_type_t fn_type
The node's type.
An node in the FIB graph.
void fib_node_unlock(fib_node_t *node)
const dpo_id_t * load_balance_get_bucket(index_t lbi, u32 bucket)
#define FIB_SOURCE_MAX
The maximum number of sources.
fib_entry_src_flag_t fib_entry_src_action_remove_or_update_inherit(fib_entry_t *fib_entry, fib_source_t source)
void fib_entry_inherit(fib_node_index_t cover, fib_node_index_t covered)
fib_entry_inherit
static void fib_entry_source_change_w_flags(fib_entry_t *fib_entry, fib_source_t old_source, fib_entry_flag_t old_flags, fib_source_t new_source)
#define FOR_EACH_FIB_ATTRIBUTE(_item)
u32 fib_entry_get_resolving_interface(fib_node_index_t entry_index)
fib_entry_src_flag_t fib_entry_src_action_remove(fib_entry_t *fib_entry, fib_source_t source)
static fib_node_t * fib_entry_get_node(fib_node_index_t index)
static void fib_entry_last_lock_gone(fib_node_t *node)
fib_node_list_t fn_children
Vector of nodes that depend upon/use/share this node.
fib_entry_delegate_type_t fib_entry_chain_type_to_delegate_type(fib_forward_chain_type_t fct)
u8 * format_fib_source(u8 *s, va_list *args)
void fib_entry_src_action_installed(const fib_entry_t *fib_entry, fib_source_t source)
static fib_entry_t * fib_entry_from_fib_node(fib_node_t *node)
Contribute an object that is to be used to forward NSH packets.
#define vec_free(V)
Free vector's memory (no header).
void fib_entry_src_action_activate(fib_entry_t *fib_entry, fib_source_t source)
void fib_entry_source_change(fib_entry_t *fib_entry, fib_source_t old_source, fib_source_t new_source)
Force the walk to be synchronous.
int fib_entry_recursive_loop_detect(fib_node_index_t entry_index, fib_node_index_t **entry_indicies)
fib_entry_src_cover_res_t fib_entry_src_action_cover_change(fib_entry_t *fib_entry, fib_entry_src_t *esrc)
u32 fib_node_index_t
A typedef of a node index.
static fib_entry_t * fib_entry_post_flag_update_actions(fib_entry_t *fib_entry, fib_entry_flag_t old_flags)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
u32 fib_node_get_n_children(fib_node_type_t parent_type, fib_node_index_t parent_index)
u32 adj_index_t
An index for adjacencies.
fib_forward_chain_type_t fib_entry_delegate_type_to_chain_type(fib_entry_delegate_type_t fdt)
u8 * format_fib_entry_flags(u8 *s, va_list *args)
fib_entry_t * fib_entry_get(fib_node_index_t index)
enum fib_entry_flag_t_ fib_entry_flag_t
Context passed between object during a back walk.
void fib_entry_lock(fib_node_index_t fib_entry_index)
#define VLIB_CLI_COMMAND(x,...)
int fib_path_list_recursive_loop_detect(fib_node_index_t path_list_index, fib_node_index_t **entry_indicies)
fib_entry_flag_t fes_entry_flags
Flags the source contributes to the entry.
int fib_path_list_is_looped(fib_node_index_t path_list_index)
fib_source_t fes_src
Which source this info block is for.
fib_entry_src_flag_t fes_flags
Flags on the source.
fib_entry_t * fib_entry_src_action_path_swap(fib_entry_t *fib_entry, fib_source_t source, fib_entry_flag_t flags, const fib_route_path_t *rpaths)
static void fib_entry_show_memory(void)
static load_balance_t * load_balance_get(index_t lbi)
fib_node_t fe_node
Base class.
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
fib_entry_t * fib_entry_src_action_update(fib_entry_t *fib_entry, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
u8 * format_fib_forw_chain_type(u8 *s, va_list *args)
int fib_path_ext_list_length(const fib_path_ext_list_t *list)
void fib_node_child_remove(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_index_t sibling_index)
static void fib_entry_post_update_actions(fib_entry_t *fib_entry, fib_source_t source, fib_entry_flag_t old_flags)
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
enum fib_entry_src_flag_t_ fib_entry_src_flag_t
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject
u32 flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
static fib_entry_t * fib_entry_pool
void fib_entry_cover_changed(fib_node_index_t fib_entry_index)
void fib_entry_encode(fib_node_index_t fib_entry_index, fib_route_path_encode_t **api_rpaths)
dpo_id_t fe_lb
The load-balance used for forwarding.
void fib_attached_export_cover_update(fib_entry_t *fib_entry)
If this entry is tracking a cover (in another table) then that cover has been updated.
fib_entry_delegate_t * fe_delegates
A vector of delegates.
fib_node_index_t fes_pl
The path-list created by the source.
void fib_entry_src_inherit(const fib_entry_t *cover, fib_entry_t *covered)
void fib_attached_export_import(fib_entry_t *fib_entry, fib_node_index_t export_fib)
FIB attached export.
#define FIB_ENTRY_FORMAT_BRIEF
fib_entry_flag_t fib_entry_get_flags_for_source(fib_node_index_t fib_entry_index, fib_source_t source)
static fib_entry_flag_t fib_entry_src_get_flags(const fib_entry_src_t *esrc)
index_t dpoi_index
the index of objects of that type
fib_node_index_t fib_entry_create(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const fib_route_path_t *paths)
#define FIB_NODE_INDEX_INVALID
void fib_entry_recalculate_forwarding(fib_node_index_t fib_entry_index)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 fn_locks
Number of dependents on this node.
u8 * fib_path_list_format(fib_node_index_t path_list_index, u8 *s)
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
u32 fib_entry_get_stats_index(fib_node_index_t fib_entry_index)
u8 * fib_entry_src_format(fib_entry_t *fib_entry, fib_source_t source, u8 *s)
#define FOR_EACH_DELEGATE(_entry, _fdt, _fed, _body)
void fib_entry_cover_updated(fib_node_index_t fib_entry_index)
A FIB graph nodes virtual function table.
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
void fib_entry_src_action_reactivate(fib_entry_t *fib_entry, fib_source_t source)
void fib_entry_update(fib_node_index_t fib_entry_index, fib_source_t source, fib_entry_flag_t flags, const fib_route_path_t *paths)
fib_entry_update
#define FIB_ENTRY_FORMAT_DETAIL2
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
#define vec_foreach(var, vec)
Vector iterator.
A path extension is a per-entry addition to the forwarding information when packets are sent for that...
fib_path_list_walk_rc_t fib_path_encode(fib_node_index_t path_list_index, fib_node_index_t path_index, const fib_path_ext_t *path_ext, void *ctx)
u8 fes_ref_count
1 bytes ref count.
fib_path_ext_list_t fes_path_exts
A vector of path extensions.
dpo_proto_t fib_entry_get_dpo_proto(const fib_entry_t *fib_entry)
u8 * format_fib_path_ext_list(u8 *s, va_list *args)
void fib_path_list_walk_w_ext(fib_node_index_t path_list_index, const fib_path_ext_list_t *ext_list, fib_path_list_walk_w_ext_fn_t func, void *ctx)
Contribute an object that is to be used to forward non-end-of-stack MPLS packets. ...
void fib_entry_cover_update_notify(fib_entry_t *fib_entry)
static int fib_entry_cmp(fib_node_index_t fib_entry_index1, fib_node_index_t fib_entry_index2)
A Delagate is a means to implmenet the Delagation design pattern; the extension of an objects functio...
#define pool_foreach_index(i, v, body)
Iterate pool by index.
u8 * fib_node_children_format(fib_node_list_t list, u8 *s)
static fib_entry_t * fib_entry_alloc(u32 fib_index, const fib_prefix_t *prefix, fib_node_index_t *fib_entry_index)
fib_source_t fib_entry_get_best_source(fib_node_index_t entry_index)
Contribute an object that is to be used to forward IP4 packets.
fib_entry_delegate_t * fib_entry_delegate_find_or_add(fib_entry_t *fib_entry, fib_entry_delegate_type_t fdt)
#define FIB_ENTRY_SRC_ATTRIBUTES
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
void fib_entry_special_add(fib_node_index_t fib_entry_index, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
vlib_log_class_t fib_entry_logger
the logger
fib_forward_chain_type_t fib_entry_get_default_chain_type(const fib_entry_t *fib_entry)
fib_entry_src_cover_res_t fib_entry_src_action_cover_update(fib_entry_t *fib_entry, fib_entry_src_t *esrc)
const fib_prefix_t fe_prefix
The prefix of the route.
fib_entry_src_flag_t fib_entry_special_remove(fib_node_index_t fib_entry_index, fib_source_t source)
static const char * fib_source_names[]
void fib_entry_src_action_uninstall(fib_entry_t *fib_entry)
fib_entry_flag_t fib_entry_get_flags(fib_node_index_t fib_entry_index)
static uword pool_elts(void *v)
Number of active elements in a pool.