FD.io VPP  v18.07.1-19-g511ce25
Vector Packet Processing
ip4_fib.h File Reference
+ Include dependency graph for ip4_fib.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ip4_fib_t_
 The IPv4 FIB. More...
 

Typedefs

typedef struct ip4_fib_t_ ip4_fib_t
 The IPv4 FIB. More...
 

Functions

fib_node_index_t ip4_fib_table_lookup (const ip4_fib_t *fib, const ip4_address_t *addr, u32 len)
 
fib_node_index_t ip4_fib_table_lookup_exact_match (const ip4_fib_t *fib, const ip4_address_t *addr, u32 len)
 
void ip4_fib_table_entry_remove (ip4_fib_t *fib, const ip4_address_t *addr, u32 len)
 
void ip4_fib_table_entry_insert (ip4_fib_t *fib, const ip4_address_t *addr, u32 len, fib_node_index_t fib_entry_index)
 
void ip4_fib_table_destroy (u32 fib_index)
 
void ip4_fib_table_fwding_dpo_update (ip4_fib_t *fib, const ip4_address_t *addr, u32 len, const dpo_id_t *dpo)
 
void ip4_fib_table_fwding_dpo_remove (ip4_fib_t *fib, const ip4_address_t *addr, u32 len, const dpo_id_t *dpo, fib_node_index_t cover_index)
 
u32 ip4_fib_table_lookup_lb (ip4_fib_t *fib, const ip4_address_t *dst)
 
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. More...
 
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. More...
 
static ip4_fib_tip4_fib_get (u32 index)
 Get the FIB at the given index. More...
 
static u32 ip4_fib_lookup (ip4_main_t *im, u32 sw_if_index, ip4_address_t *dst)
 
u32 ip4_fib_table_find_or_create_and_lock (u32 table_id, fib_source_t src)
 Get or create an IPv4 fib. More...
 
u32 ip4_fib_table_create_and_lock (fib_source_t src)
 
u8format_ip4_fib_table_memory (u8 *s, va_list *args)
 
static u32 ip4_fib_index_from_table_id (u32 table_id)
 
u32 ip4_fib_table_get_index_for_sw_if_index (u32 sw_if_index)
 
static index_t ip4_fib_forwarding_lookup (u32 fib_index, const ip4_address_t *addr)
 

Typedef Documentation

typedef struct ip4_fib_t_ ip4_fib_t

The IPv4 FIB.

FIBs are composed of two prefix data-bases (akak tables). The non-forwarding table contains all the routes that the control plane has programmed, the forwarding table contains the sub-set of those routes that can be used to forward packets. In the IPv4 FIB the non-forwarding table is an array of hash tables indexed by mask length, the forwarding table is an mtrie

This IPv4 FIB is used by the protocol independent FIB. So directly using this APIs in client code is not encouraged. However, this IPv4 FIB can be used if all the client wants is an IPv4 prefix data-base

Function Documentation

u8* format_ip4_fib_table_memory ( u8 s,
va_list *  args 
)

Definition at line 568 of file ip4_fib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static index_t ip4_fib_forwarding_lookup ( u32  fib_index,
const ip4_address_t addr 
)
inlinestatic

Definition at line 160 of file ip4_fib.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ip4_fib_t* ip4_fib_get ( u32  index)
inlinestatic

Get the FIB at the given index.

Definition at line 113 of file ip4_fib.h.

+ Here is the caller graph for this function:

static u32 ip4_fib_index_from_table_id ( u32  table_id)
inlinestatic

Definition at line 145 of file ip4_fib.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 ip4_fib_lookup ( ip4_main_t im,
u32  sw_if_index,
ip4_address_t dst 
)
inlinestatic

Definition at line 119 of file ip4_fib.h.

+ Here is the call graph for this function:

u32 ip4_fib_table_create_and_lock ( fib_source_t  src)

Definition at line 218 of file ip4_fib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ip4_fib_table_destroy ( u32  fib_index)

Definition at line 159 of file ip4_fib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ip4_fib_table_entry_insert ( ip4_fib_t fib,
const ip4_address_t addr,
u32  len,
fib_node_index_t  fib_entry_index 
)

Definition at line 314 of file ip4_fib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ip4_fib_table_entry_remove ( ip4_fib_t fib,
const ip4_address_t addr,
u32  len 
)

Definition at line 349 of file ip4_fib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 ip4_fib_table_find_or_create_and_lock ( u32  table_id,
fib_source_t  src 
)

Get or create an IPv4 fib.

Get or create an IPv4 fib with the provided table ID.

Parameters
table_idWhen set to ~0, an arbitrary and unused fib ID is picked and can be retrieved with ret->table_id. Otherwise, the fib ID to be used to retrieve or create the desired fib.
Returns
A pointer to the retrieved or created fib.

Definition at line 203 of file ip4_fib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ip4_fib_table_fwding_dpo_remove ( ip4_fib_t fib,
const ip4_address_t addr,
u32  len,
const dpo_id_t dpo,
fib_node_index_t  cover_index 
)

Definition at line 388 of file ip4_fib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ip4_fib_table_fwding_dpo_update ( ip4_fib_t fib,
const ip4_address_t addr,
u32  len,
const dpo_id_t dpo 
)

Definition at line 379 of file ip4_fib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 ip4_fib_table_get_index_for_sw_if_index ( u32  sw_if_index)

Definition at line 224 of file ip4_fib.c.

+ Here is the caller graph for this function:

fib_node_index_t ip4_fib_table_lookup ( const ip4_fib_t fib,
const ip4_address_t addr,
u32  len 
)

Definition at line 291 of file ip4_fib.c.

+ Here is the caller graph for this function:

fib_node_index_t ip4_fib_table_lookup_exact_match ( const ip4_fib_t fib,
const ip4_address_t addr,
u32  len 
)

Definition at line 243 of file ip4_fib.c.

+ Here is the caller graph for this function:

u32 ip4_fib_table_lookup_lb ( ip4_fib_t fib,
const ip4_address_t dst 
)

Definition at line 267 of file ip4_fib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

If you need to delete walk the whole table and store elements in a vector, then delete the elements

Definition at line 431 of file ip4_fib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

If you need to delete walk the whole table and store elements in a vector, then delete the elements

Definition at line 414 of file ip4_fib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function: