192 if (fib_entry_cover_index != fib_entry_index)
359 return (fib_entry_index);
401 return (fib_entry_index);
420 return (fib_entry_index);
554 const ip46_address_t *next_hop,
555 u32 next_hop_sw_if_index,
556 u32 next_hop_fib_index,
562 .frp_proto = next_hop_proto,
564 .frp_sw_if_index = next_hop_sw_if_index,
565 .frp_fib_index = next_hop_fib_index,
566 .frp_weight = next_hop_weight,
567 .frp_flags = path_flags,
569 .frp_label_stack = next_hop_labels,
577 source, flags, paths);
580 return (fib_entry_index);
604 for (ii = 0; ii <
vec_len(rpaths); ii++)
636 return (fib_entry_index);
726 const ip46_address_t *next_hop,
727 u32 next_hop_sw_if_index,
728 u32 next_hop_fib_index,
739 .frp_proto = next_hop_proto,
741 .frp_sw_if_index = next_hop_sw_if_index,
742 .frp_fib_index = next_hop_fib_index,
743 .frp_weight = next_hop_weight,
744 .frp_flags = path_flags,
769 for (ii = 0; ii <
vec_len(paths); ii++)
801 return (fib_entry_index);
810 const ip46_address_t *next_hop,
811 u32 next_hop_sw_if_index,
812 u32 next_hop_fib_index,
819 .frp_proto = next_hop_proto,
821 .frp_sw_if_index = next_hop_sw_if_index,
822 .frp_fib_index = next_hop_fib_index,
823 .frp_weight = next_hop_weight,
824 .frp_flags = path_flags,
825 .frp_label_stack = next_hop_labels,
836 return (fib_entry_index);
918 fib_entry_index, prefix, source);
953 return (fib_entry_index);
1079 proto, sw_if_index),
1140 if (name && name[0])
1177 const char *
const fmt,
1355 return format(s,
"none");
1359 if (1 << attr & flags) {
1404 .ftf_entries =
NULL,
1405 .ftf_source = source,
1439 .ftf_source = source,
1472 .ftf_source = source,
#define FIB_TABLE_ATTRIBUTES
void dpo_unlock(dpo_id_t *dpo)
Release a reference counting lock on the DPO.
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
fib_protocol_t fp_proto
protocol type
enum fib_source_t_ fib_source_t
The different sources that can create a route.
u32 fib_entry_get_fib_index(fib_node_index_t fib_entry_index)
fib_node_index_t fib_table_entry_path_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_mpls_label_t *next_hop_labels, fib_route_path_flags_t path_flags)
Add one path to an entry (aka route) in the FIB.
void mpls_fib_table_entry_remove(mpls_fib_t *mf, mpls_label_t label, mpls_eos_bit_t eos)
void fib_table_sweep(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Signal that the table has converged, i.e.
ip46_address_t frp_addr
The next-hop address.
Continue on to the next entry.
void fib_entry_unlock(fib_node_index_t fib_entry_index)
#define FOR_EACH_FIB_TABLE_ATTRIBUTE(_item)
fib_protocol_t ft_proto
Which protocol this table serves.
void ip4_fib_table_fwding_dpo_remove(ip4_fib_t *fib, const ip4_address_t *addr, u32 len, const dpo_id_t *dpo, u32 cover_index)
fib_node_index_t fib_table_lookup_exact_match(u32 fib_index, const fib_prefix_t *prefix)
Perfom an exact match in the non-forwarding table.
static void fib_table_lock_dec(fib_table_t *fib_table, fib_source_t source)
static const char * fib_table_flags_strings[]
A representation of a path as described by a route producer.
int fib_route_path_cmp(const fib_route_path_t *rpath1, const fib_route_path_t *rpath2)
fib_node_index_t mpls_fib_table_lookup(const mpls_fib_t *mf, mpls_label_t label, mpls_eos_bit_t eos)
fib_source_t ftf_source
The source we are flushing.
A Drop path - resolve the path on the drop DPO.
void mpls_fib_table_destroy(u32 fib_index)
void fib_entry_set_flow_hash_config(fib_node_index_t fib_entry_index, flow_hash_config_t hash_config)
u32 fib_table_find_or_create_and_lock_w_name(fib_protocol_t proto, u32 table_id, fib_source_t src, const u8 *name)
Get the index of the FIB for a Table-ID.
fib_node_index_t fib_table_entry_update(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, fib_route_path_t *paths)
Update an entry to have a new set of paths.
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.
u8 * format_ip6_fib_table_memory(u8 *s, va_list *args)
u32 mpls_label_t
A label value only, i.e.
enum fib_table_flags_t_ fib_table_flags_t
fib_node_index_t fib_table_entry_path_add2(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, fib_route_path_t *rpaths)
Add n paths to an entry (aka route) in the FIB.
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
void ip4_fib_table_destroy(u32 fib_index)
static fib_node_index_t fib_table_get_less_specific_i(fib_table_t *fib_table, const fib_prefix_t *prefix)
const fib_prefix_t * fib_entry_get_prefix(fib_node_index_t fib_entry_index)
dpo_proto_t frp_proto
The protocol of the address below.
void fib_table_fwding_dpo_remove(u32 fib_index, const fib_prefix_t *prefix, const dpo_id_t *dpo)
remove an entry in the FIB's forwarding table
u32 ip4_fib_table_find_or_create_and_lock(u32 table_id, fib_source_t src)
Get or create an IPv4 fib.
void fib_table_entry_local_label_remove(u32 fib_index, const fib_prefix_t *prefix, mpls_label_t label)
remove a MPLS local label for the prefix/route.
int fib_prefix_is_host(const fib_prefix_t *prefix)
Return true is the prefix is a host prefix.
static void vlib_smp_unsafe_warning(void)
u8 * format_fib_protocol(u8 *s, va_list *ap)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
void mpls_fib_table_entry_insert(mpls_fib_t *mf, mpls_label_t label, mpls_eos_bit_t eos, fib_node_index_t lfei)
flow_hash_config_t fib_table_get_flow_hash_config(u32 fib_index, fib_protocol_t proto)
Get the flow hash configured used by the table.
fib_node_index_t fib_table_entry_update_one_path(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_mpls_label_t *next_hop_labels, fib_route_path_flags_t path_flags)
Update the entry to have just one path.
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
u32 ip4_fib_table_create_and_lock(fib_source_t src)
flow_hash_config_t fib_table_get_default_flow_hash_config(fib_protocol_t proto)
Get the flow hash configured used by the protocol.
u32 ip4_fib_table_get_index_for_sw_if_index(u32 sw_if_index)
fib_node_index_t ip6_fib_table_lookup_exact_match(u32 fib_index, const ip6_address_t *addr, u32 len)
static void fib_table_post_insert_actions(fib_table_t *fib_table, const fib_prefix_t *prefix, fib_node_index_t fib_entry_index)
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)
u32 frp_sw_if_index
The interface.
vl_api_interface_index_t sw_if_index
u32 ft_epoch
Epoch - number of resyncs performed.
static fib_node_index_t fib_table_lookup_exact_match_i(const fib_table_t *fib_table, const fib_prefix_t *prefix)
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 int ip46_address_cmp(const ip46_address_t *ip46_1, const ip46_address_t *ip46_2)
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)
void fib_table_flush(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Flush all entries from a table for the source.
Aggregate type for a prefix.
void ip4_fib_table_sub_tree_walk(ip4_fib_t *fib, const fib_prefix_t *root, fib_table_walk_fn_t fn, void *ctx)
Walk all entries in a sub-tree of the FIB table N.B: This is NOT safe to deletes. ...
enum fib_route_path_flags_t_ fib_route_path_flags_t
Path flags from the control plane.
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
u16 fp_len
The mask length.
void ip4_fib_table_entry_remove(ip4_fib_t *fib, const ip4_address_t *addr, u32 len)
fib_node_index_t fib_table_lookup(u32 fib_index, const fib_prefix_t *prefix)
Perfom a longest prefix match in the non-forwarding table.
u32 ip6_fib_table_get_index_for_sw_if_index(u32 sw_if_index)
u32 * ft_locks
per-source number of locks on the table
static u32 mpls_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...
static void fib_table_entry_insert(fib_table_t *fib_table, const fib_prefix_t *prefix, fib_node_index_t fib_entry_index)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void fib_table_source_count_dec(fib_table_t *fib_table, fib_source_t source)
static void fib_table_lock_inc(fib_table_t *fib_table, fib_source_t source)
int fib_entry_is_marked(fib_node_index_t fib_entry_index, fib_source_t source)
static fib_table_walk_rc_t fib_table_mark_cb(fib_node_index_t fib_entry_index, void *arg)
u32 mpls_fib_table_find_or_create_and_lock(u32 table_id, fib_source_t src)
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.
void mpls_fib_table_walk(mpls_fib_t *mpls_fib, fib_table_walk_fn_t fn, void *ctx)
Walk all entries in a FIB table N.B: This is NOT safe to deletes.
u8 * format_fib_table_flags(u8 *s, va_list *args)
static u8 ip46_address_is_zero(const ip46_address_t *ip46)
static u32 ip6_fib_index_from_table_id(u32 table_id)
#define MPLS_FLOW_HASH_DEFAULT
There are no options for controlling the MPLS flow hash.
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.
Configuration for each label value in the output-stack.
u32 fib_table_get_num_entries(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Return the number of entries in the FIB added by a given source.
fib_entry_src_flag_t fib_entry_delete(fib_node_index_t fib_entry_index, fib_source_t source)
fib_entry_delete
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)
void ip4_fib_table_fwding_dpo_update(ip4_fib_t *fib, const ip4_address_t *addr, u32 len, const dpo_id_t *dpo)
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
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.
struct fib_table_t_ * fibs
A pool of all the MPLS FIBs.
u32 ip6_fib_table_find_or_create_and_lock(u32 table_id, fib_source_t src)
Get or create an IPv6 fib.
void fib_entry_inherit(fib_node_index_t cover, fib_node_index_t covered)
fib_entry_inherit
void ip6_fib_table_entry_remove(u32 fib_index, const ip6_address_t *addr, u32 len)
enum fib_table_attribute_t_ fib_table_attribute_t
Flags for the source data.
struct fib_table_set_flow_hash_config_ctx_t_ fib_table_set_flow_hash_config_ctx_t
Table set flow hash config context.
fib_node_index_t ip4_fib_table_lookup(const ip4_fib_t *fib, const ip4_address_t *addr, u32 len)
static void fib_table_entry_delete_i(u32 fib_index, fib_node_index_t fib_entry_index, const fib_prefix_t *prefix, fib_source_t source)
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.
static fib_node_index_t fib_table_lookup_i(fib_table_t *fib_table, const fib_prefix_t *prefix)
int fib_entry_is_sourced(fib_node_index_t fib_entry_index, fib_source_t source)
void fib_table_entry_path_remove2(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_route_path_t *rpaths)
Remove n paths to an entry (aka route) in the FIB.
fib_node_index_t fib_table_entry_special_dpo_update(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Update a 'special' entry to the FIB that links to the DPO passed A special entry is an entry that the...
void ip6_fib_table_destroy(u32 fib_index)
fib_node_index_t fib_table_entry_local_label_add(u32 fib_index, const fib_prefix_t *prefix, mpls_label_t label)
Add a MPLS local label for the prefix/route.
void fib_table_fwding_dpo_update(u32 fib_index, const fib_prefix_t *prefix, const dpo_id_t *dpo)
Add or update an entry in the FIB's forwarding table.
u32 ft_table_id
Table ID (hash key) for this FIB.
void fib_table_entry_delete_index(fib_node_index_t fib_entry_index, fib_source_t source)
Delete a FIB entry.
u32 ft_flow_hash_config
flow hash configuration
static void fib_table_destroy(fib_table_t *fib_table)
enum fib_table_walk_rc_t_ fib_table_walk_rc_t
return code controlling how a table walk proceeds
#define MPLS_LABEL_INVALID
#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)
static ip4_fib_t * ip4_fib_get(u32 index)
Get the FIB at the given index.
void fib_table_set_flow_hash_config(u32 fib_index, fib_protocol_t proto, flow_hash_config_t hash_config)
Set the flow hash configured used by the table.
u8 * ft_desc
Table description.
fib_table_flags_t ft_flags
Table flags.
static void fib_table_entry_remove(fib_table_t *fib_table, const fib_prefix_t *prefix, fib_node_index_t fib_entry_index)
#define clib_warning(format, args...)
void fib_entry_cover_change_notify(fib_node_index_t cover_index, fib_node_index_t covered)
void fib_table_mark(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Resync all entries from a table for the source this is the mark part of the mark and sweep algorithm...
flow_hash_config_t hash_config
the flow hash config to set
u32 fib_node_index_t
A typedef of a node index.
u8 * format_fib_table_memory(u8 *s, va_list *args)
format (display) the memory used by the FIB tables
static int fib_route_path_cmp_for_sort(void *v1, void *v2)
Don't resolve the path, use the DPO the client provides.
static u32 ip4_fib_index_from_table_id(u32 table_id)
u32 mpls_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.
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.
enum fib_entry_flag_t_ fib_entry_flag_t
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 *rpaths)
void fib_table_lock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Release a reference counting lock on the table.
vl_api_fib_path_t paths[n_paths]
void fib_entry_lock(fib_node_index_t fib_entry_index)
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...
u32 fib_table_get_table_id_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the Table-ID of the FIB bound to the interface.
const void * fib_entry_get_source_data(fib_node_index_t fib_entry_index, fib_source_t source)
void mpls_fib_forwarding_table_reset(mpls_fib_t *mf, mpls_label_t label, mpls_eos_bit_t eos)
static mpls_fib_t * mpls_fib_get(fib_node_index_t index)
void fib_table_walk(u32 fib_index, fib_protocol_t proto, fib_table_walk_fn_t fn, void *ctx)
Walk all entries in a FIB table N.B: This is NOT safe to deletes.
u32 fib_table_get_table_id(u32 fib_index, fib_protocol_t proto)
Get the Table-ID of the FIB from protocol and index.
u32 fib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id, fib_source_t src)
Get the index of the FIB for a Table-ID.
fib_route_path_flags_t frp_flags
flags on the path
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
#define IP_FLOW_HASH_DEFAULT
Default: 5-tuple without the "reverse" bit.
void mpls_fib_forwarding_table_update(mpls_fib_t *mf, mpls_label_t label, mpls_eos_bit_t eos, const dpo_id_t *dpo)
u8 * format_ip4_fib_table_memory(u8 *s, va_list *args)
enum fib_entry_src_flag_t_ fib_entry_src_flag_t
void fib_table_entry_path_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_route_path_flags_t path_flags)
remove one path to an entry (aka route) in the FIB.
u32 flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
u32 fib_table_entry_get_stats_index(u32 fib_index, const fib_prefix_t *prefix)
Return the stats index for a FIB entry.
static void fib_table_route_path_fixup(const fib_prefix_t *prefix, fib_entry_flag_t *eflags, fib_route_path_t *path)
fib_table_route_path_fixup
static u32 fib_table_find_or_create_and_lock_i(fib_protocol_t proto, u32 table_id, fib_source_t src, const u8 *name)
fib_entry_flag_t fib_entry_get_flags_for_source(fib_node_index_t fib_entry_index, fib_source_t source)
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
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
fib_node_index_t * ftf_entries
The list of entries to flush.
#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 fib_table_walk_rc_t fib_table_set_flow_hash_config_cb(fib_node_index_t fib_entry_index, void *arg)
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
u32 fib_entry_get_stats_index(fib_node_index_t fib_entry_index)
fib_table_t * fib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
u32 * ft_src_route_counts
Per-source route counters.
static fib_table_walk_rc_t fib_table_sweep_cb(fib_node_index_t fib_entry_index, void *arg)
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
u8 * format_mpls_fib_table_memory(u8 *s, va_list *args)
u8 * format_fib_table_name(u8 *s, va_list *ap)
Format the description/name of the table.
ip4_main_t ip4_main
Global ip4 main structure.
Table set flow hash config context.
struct fib_table_t_ * fibs
Vector of FIBs.
void fib_entry_mark(fib_node_index_t fib_entry_index, fib_source_t source)
#define vec_foreach(var, vec)
Vector iterator.
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 *rpaths)
fib_node_index_t ip6_fib_table_lookup(u32 fib_index, const ip6_address_t *addr, u32 len)
struct fib_table_flush_ctx_t_ fib_table_flush_ctx_t
Table flush context.
static void fib_table_source_count_inc(fib_table_t *fib_table, fib_source_t source)
void fib_table_sub_tree_walk(u32 fib_index, fib_protocol_t proto, const fib_prefix_t *root, fib_table_walk_fn_t fn, void *ctx)
Walk all entries in a sub-tree FIB table.
u32 mpls_fib_table_create_and_lock(fib_source_t src)
fib_node_index_t ip4_fib_table_lookup_exact_match(const ip4_fib_t *fib, const ip4_address_t *addr, u32 len)
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. ...
u32 fib_table_create_and_lock(fib_protocol_t proto, fib_source_t src, const char *const fmt,...)
Create a new table with no table ID.
struct fib_table_t_ * fibs
void fib_entry_set_source_data(fib_node_index_t fib_entry_index, fib_source_t source, const void *data)
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)
const ip46_address_t zero_addr
fib_entry_src_flag_t fib_entry_special_remove(fib_node_index_t fib_entry_index, fib_source_t source)
static fib_table_walk_rc_t fib_table_flush_cb(fib_node_index_t fib_entry_index, void *arg)
A protocol Independent FIB table.
fib_node_index_t fib_table_get_less_specific(u32 fib_index, const fib_prefix_t *prefix)
Get the less specific (covering) prefix.