76 } __attribute__ ((packed)) fib_path_type_t;
81 #define FIB_PATH_TYPE_MAX (FIB_PATH_TYPE_LAST + 1) 83 #define FIB_PATH_TYPES { \ 84 [FIB_PATH_TYPE_ATTACHED_NEXT_HOP] = "attached-nexthop", \ 85 [FIB_PATH_TYPE_ATTACHED] = "attached", \ 86 [FIB_PATH_TYPE_RECURSIVE] = "recursive", \ 87 [FIB_PATH_TYPE_SPECIAL] = "special", \ 88 [FIB_PATH_TYPE_EXCLUSIVE] = "exclusive", \ 89 [FIB_PATH_TYPE_DEAG] = "deag", \ 90 [FIB_PATH_TYPE_RECEIVE] = "receive", \ 93 #define FOR_EACH_FIB_PATH_TYPE(_item) \ 94 for (_item = FIB_PATH_TYPE_FIRST; _item <= FIB_PATH_TYPE_LAST; _item++) 124 } __attribute__ ((packed)) fib_path_oper_attribute_t;
129 #define FIB_PATH_OPER_ATTRIBUTE_MAX (FIB_PATH_OPER_ATTRIBUTE_LAST + 1) 131 #define FIB_PATH_OPER_ATTRIBUTES { \ 132 [FIB_PATH_OPER_ATTRIBUTE_RECURSIVE_LOOP] = "recursive-loop", \ 133 [FIB_PATH_OPER_ATTRIBUTE_RESOLVED] = "resolved", \ 134 [FIB_PATH_OPER_ATTRIBUTE_DROP] = "drop", \ 137 #define FOR_EACH_FIB_PATH_OPER_ATTRIBUTE(_item) \ 138 for (_item = FIB_PATH_OPER_ATTRIBUTE_FIRST; \ 139 _item <= FIB_PATH_OPER_ATTRIBUTE_LAST; \ 322 #define FIB_PATH_DBG(_p, _fmt, _args...) \ 325 _tmp = fib_path_format(fib_path_get_index(_p), _tmp); \ 326 clib_warning("path:[%d:%s]:" _fmt, \ 327 fib_path_get_index(_p), _tmp, \ 332 #define FIB_PATH_DBG(_p, _fmt, _args...) 344 return (path - fib_path_pool);
367 fib_path_oper_attribute_t oattr;
376 s =
format(s,
" oper-flags:");
379 s =
format (s,
"%s,", fib_path_oper_attribute_names[oattr]);
384 s =
format(s,
" cfg-flags:");
387 s =
format (s,
"%s,", fib_path_cfg_attribute_names[cattr]);
419 s =
format(s,
"\n unresolved");
457 s =
format (s,
" in fib:%d",
461 s =
format (s,
" via-dpo:[%U:%d]",
503 s =
format(s,
" unresolved");
992 memset(path, 0,
sizeof(*path));
1085 memset(path, 0,
sizeof(*path));
1132 memcpy(path, orig_path,
sizeof(*path));
1247 res = (path1->
deag.fp_tbl_id - path2->
deag.fp_tbl_id);
1405 entries = *entry_indicies;
1633 return (path->
attached.fp_interface);
1635 return (path->
receive.fp_interface);
1966 vec_add2(*api_rpaths, api_rpath, 1);
2030 s =
format(s,
"children:");
2053 .path =
"show fib paths",
2055 .short_help =
"show fib paths",
int fib_path_is_resolved(fib_node_index_t path_index)
fib_protocol_t frp_proto
The protocol of the address below.
int fib_path_resolve(fib_node_index_t path_index)
Contribute an object that is to be used to forward IP6 packets.
ip46_address_t frp_addr
The next-hop address.
Recursive resolution source.
Contribute an object that is to be used to forward IP6 packets.
void receive_dpo_add_or_lock(dpo_proto_t proto, u32 sw_if_index, const ip46_address_t *nh_addr, dpo_id_t *dpo)
static fib_path_t * fib_path_from_fib_node(fib_node_t *node)
uword fib_path_hash(fib_node_index_t path_index)
fib_node_index_t path_index
The index of the FIB path.
A representation of a fib path for fib_path_encode to convey the information to the caller...
void fib_path_contribute_forwarding(fib_node_index_t path_index, fib_forward_chain_type_t fct, dpo_id_t *dpo)
fib_protocol_t fib_path_get_proto(fib_node_index_t path_index)
fib_path_oper_attribute_t_
Enurmeration of path operational (i.e.
void fib_path_contribute_urpf(fib_node_index_t path_index, index_t urpf)
Contribute the path's adjacency to the list passed.
A representation of a path as described by a route producer.
u8 * format_dpo_type(u8 *s, va_list *args)
format a DPO type
dpo_id_t path_dpo
ID of the Data-path object.
int dpo_is_adj(const dpo_id_t *dpo)
Return TRUE is the DPO is any type of adjacency.
vnet_main_t * vnet_get_main(void)
adj_index_t adj_glean_add_or_lock(fib_protocol_t proto, u32 sw_if_index, const ip46_address_t *nh_addr)
Glean Adjacency.
#define FIB_PATH_OPER_ATTRIBUTES
#define STRUCT_MARK_PTR(v, f)
int fib_path_cmp(fib_node_index_t pi1, fib_node_index_t pi2)
void fib_node_init(fib_node_t *node, fib_node_type_t type)
void lookup_dpo_add_or_lock_w_table_id(u32 table_id, dpo_proto_t proto, lookup_input_t input, lookup_table_t table_config, dpo_id_t *dpo)
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 int dpo_id_is_valid(const dpo_id_t *dpoi)
Return true if the DPO object is valid, i.e.
void fib_entry_get_prefix(fib_node_index_t fib_entry_index, fib_prefix_t *pfx)
void fib_path_module_init(void)
int fib_path_is_exclusive(fib_node_index_t path_index)
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)
u32 mpls_label_t
A label value only, i.e.
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 load_balance_map_path_state_change(fib_node_index_t path_index)
the state of a path has changed (it has no doubt gone down).
void fib_entry_child_remove(fib_node_index_t fib_entry_index, u32 sibling_index)
fib_node_index_t fp_tbl_id
The FIB table index in which to find the next-hop.
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...
word vnet_sw_interface_compare(vnet_main_t *vnm, uword sw_if_index0, uword sw_if_index1)
void lookup_dpo_add_or_lock_w_fib_index(fib_node_index_t fib_index, dpo_proto_t proto, lookup_input_t input, lookup_table_t table_config, dpo_id_t *dpo)
#define STRUCT_MARK(mark)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
Contribute an object that is to be used to forward IP4 packets.
#define STRUCT_OFFSET_OF(t, f)
void fib_node_deinit(fib_node_t *node)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
u8 * fib_path_adj_format(fib_node_index_t pi, u32 indent, u8 *s)
dpo_id_t fp_ex_dpo
The user provided 'exclusive' DPO.
int fib_path_is_looped(fib_node_index_t path_index)
void adj_child_remove(adj_index_t adj_index, u32 sibling_index)
Remove a child dependent.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
The path has become a permanent drop.
int fib_path_cmp_for_sort(void *v1, void *v2)
#define ip46_address_cmp(ip46_1, ip46_2)
#define pool_len(p)
Number of elements in pool vector.
ip46_address_t fp_ip
The next-hop.
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
load_balance_path_t * fib_path_append_nh_for_multipath_hash(fib_node_index_t path_index, fib_forward_chain_type_t fct, load_balance_path_t *hash_key)
void fib_node_register_type(fib_node_type_t type, const fib_node_vft_t *vft)
fib_node_register_type
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
fib_node_index_t fib_path_create(fib_node_index_t pl_index, fib_protocol_t nh_proto, fib_path_cfg_flags_t flags, const fib_route_path_t *rpath)
fib_path_type_t fp_type
The type of the path.
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
u32 frp_sw_if_index
The interface.
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 const adj_index_t fib_path_attached_next_hop_get_adj(fib_path_t *path, vnet_link_t link)
Recursion constraint of via a host prefix.
fib_node_index_t fib_path_create_special(fib_node_index_t pl_index, fib_protocol_t nh_proto, fib_path_cfg_flags_t flags, const dpo_id_t *dpo)
fib_node_index_t fib_path_copy(fib_node_index_t path_index, fib_node_index_t path_list_index)
Aggregrate type for a prefix.
fib_path_cfg_flags_t fp_cfg_flags
Configuration Flags.
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.
fib_node_t fp_node
A path is a node in the FIB graph.
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
dpo_id_t fp_dpo
The Data-path objects through which this path resolves for IP.
#define FIB_PATH_CFG_ATTRIBUTES
Contribute an object that is to be used to forward Ethernet packets.
void fib_urpf_list_append(index_t ui, u32 sw_if_index)
Append another interface to the list.
void fib_prefix_from_mpls_label(mpls_label_t label, fib_prefix_t *prf)
Big train switch; FIB debugs on or off.
static void fib_path_attached_next_hop_set(fib_path_t *path)
u8 * format_fib_path(u8 *s, va_list *args)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
u32 fp_sibling
the index of this path in the parent's child list.
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.
format_function_t format_vnet_sw_interface_name
#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.
struct fib_path_t_ fib_path_t
A FIB path.
dpo_type_t dpoi_type
the type
int vnet_sw_interface_is_p2p(vnet_main_t *vnm, u32 sw_if_index)
struct fib_path_t_::@97::@105 receive
fib_protocol_t fp_nh_proto
The protocol of the next-hop, i.e.
adj_index_t fib_path_get_adj(fib_node_index_t path_index)
#define pool_put(P, E)
Free an object E in pool P.
Recursion constraint of via an attahced prefix.
u32 fp_weight
UCMP [unnormalised] weigt.
fib_node_type_t fn_type
The node's type.
enum fib_path_cfg_attribute_t_ fib_path_cfg_attribute_t
Given a route of the form; q.r.s.t/Y via <interface> <next-hop>
An node in the FIB graph.
static fib_path_t * fib_path_pool
static fib_path_t * fib_path_get(fib_node_index_t index)
ip46_address_t fp_nh
The next-hop.
u32 fib_entry_get_resolving_interface(fib_node_index_t entry_index)
fib_path_oper_flags_t_
Path flags from the attributes.
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.
#define FOR_EACH_FIB_PATH_OPER_ATTRIBUTE(_item)
The path forms part of a recursive loop.
vnet_link_t fib_forw_chain_type_to_link_type(fib_forward_chain_type_t fct)
Convert from a chain type to the adjacencies link type.
fib_node_list_t fn_children
Vector of nodes that depend upon/use/share this node.
int fib_path_is_recursive(fib_node_index_t path_index)
u8 * fib_path_format(fib_node_index_t pi, u8 *s)
Contribute an object that is to be used to forward NSH packets.
#define vec_free(V)
Free vector's memory (no header).
#define MPLS_FIB_DEFAULT_TABLE_ID
u32 frp_weight
[un]equal cost path weight
static void fib_path_last_lock_gone(fib_node_t *node)
static fib_node_index_t fib_path_get_index(fib_path_t *path)
struct fib_path_t_::@97::@102 deag
int fib_entry_recursive_loop_detect(fib_node_index_t entry_index, fib_node_index_t **entry_indicies)
enum fib_path_oper_flags_t_ fib_path_oper_flags_t
Path flags from the attributes.
int fib_path_encode(fib_node_index_t path_list_index, fib_node_index_t path_index, void *ctx)
u32 fib_node_index_t
A typedef of a node index.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
u32 adj_index_t
An index for adjacencies.
void fib_prefix_from_ip46_addr(const ip46_address_t *addr, fib_prefix_t *pfx)
Host prefix from ip.
static void fib_path_memory_show(void)
The path is attached, despite what the next-hop may say.
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
struct fib_path_t_::@97::@104 exclusive
static fib_node_back_walk_rc_t fib_path_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Context passed between object during a back walk.
#define VLIB_CLI_COMMAND(x,...)
u32 fp_pl_index
The index of the path-list to which this path belongs.
static void fib_path_recursive_adj_update(fib_path_t *path, fib_forward_chain_type_t fct, dpo_id_t *dpo)
static fib_forward_chain_type_t fib_path_proto_to_chain_type(fib_protocol_t proto)
int fib_path_is_deag(fib_node_index_t path_index)
fib_node_index_t fp_via_fib
the resolving via fib.
static int fib_path_is_permanent_drop(fib_path_t *path)
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
ip46_address_t fp_addr
The next-hop.
uword hash_memory(void *p, word n_bytes, uword state)
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
fib_route_path_flags_t frp_flags
flags on the path
u32 fp_interface
The interface.
static clib_error_t * show_fib_path_command(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
int fib_path_get_weight(fib_node_index_t path_index)
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject
u8 * format_fib_protocol(u8 *s, va_list ap)
struct fib_path_t_::@97::@101 recursive
static uword vnet_sw_interface_is_admin_up(vnet_main_t *vnm, u32 sw_if_index)
format_function_t format_mpls_unicast_label
static void fib_path_unresolve(fib_path_t *path)
mpls_label_t frp_local_label
The MPLS local Label to reursively resolve through.
fib_path_oper_flags_t fp_oper_flags
Memebers in this last section represent information that is dervied during resolution.
void fib_path_list_back_walk(fib_node_index_t path_list_index, fib_node_back_walk_ctx_t *ctx)
u32 fib_path_get_resolving_interface(fib_node_index_t path_index)
index_t dpoi_index
the index of objects of that type
#define FIB_NODE_INDEX_INVALID
u32 path_weight
weight for the path.
u32 adj_child_add(adj_index_t adj_index, fib_node_type_t child_type, fib_node_index_t child_index)
Add a child dependent to an adjacency.
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
#define FIB_PATH_DBG(_p, _fmt, _args...)
One path from an [EU]CMP set that the client wants to add to a load-balance object.
enum fib_path_cfg_flags_t_ fib_path_cfg_flags_t
Path config flags from the attributes.
int fib_path_recursive_loop_detect(fib_node_index_t path_index, fib_node_index_t **entry_indicies)
A FIB graph nodes virtual function table.
struct fib_path_t_::@97::@100 attached
static fib_path_cfg_flags_t fib_path_route_flags_to_cfg_flags(const fib_route_path_t *rpath)
adj_index_t adj_mcast_add_or_lock(fib_protocol_t proto, vnet_link_t link_type, u32 sw_if_index)
Mcast Adjacency.
adj_index_t adj_nbr_add_or_lock(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
Neighbour Adjacency sub-type.
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
mpls_label_t fp_local_label
The local label to resolve through.
#define vec_foreach(var, vec)
Vector iterator.
vnet_link_t fib_proto_to_link(fib_protocol_t proto)
Convert from a protocol to a link type.
fib_path_type_t_
Enurmeration of path types.
Contribute an object that is to be used to forward non-end-of-stack MPLS packets. ...
struct fib_path_t_::@97::@99 attached_next_hop
u8 * fib_node_children_format(fib_node_list_t list, u8 *s)
fib_source_t fib_entry_get_best_source(fib_node_index_t entry_index)
#define ip46_address_is_zero(ip46)
Contribute an object that is to be used to forward IP4 packets.
u32 frp_fib_index
The FIB index to lookup the nexthop Only valid for recursive paths.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
void fib_path_destroy(fib_node_index_t path_index)
#define FOR_EACH_FIB_PATH_CFG_ATTRIBUTE(_item)
static int fib_path_cmp_i(const fib_path_t *path1, const fib_path_t *path2)
const ip46_address_t zero_addr
int fib_path_cmp_w_route_path(fib_node_index_t path_index, const fib_route_path_t *rpath)
static fib_node_t * fib_path_get_node(fib_node_index_t index)
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.