FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
fib_source.h File Reference
+ Include dependency graph for fib_source.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FIB_SOURCES
 
#define FIB_SOURCE_BH_MAX   (FIB_SOURCE_BH_ADJ+1)
 
#define FIB_SOURCE_BEHAVIOURS
 
#define foreach_fib_source
 The fixed source to priority mappings. More...
 
#define FIB_SOURCE_PRIORITY_HI   0x10
 Some priority values that plugins might use when they are not to concerned where in the list they'll go. More...
 
#define FIB_SOURCE_PRIORITY_LOW   0xd0
 

Typedefs

typedef enum fib_source_t_ fib_source_t
 The different sources that can create a route. More...
 
typedef u8 fib_source_priority_t
 Each source is assigned a priority. More...
 
typedef enum fib_source_priority_cmp_t_ fib_source_priority_cmp_t
 source comparison More...
 
typedef enum fib_source_behaviour_t_ fib_source_behaviour_t
 Each source has a defined behaviour that controls how entries behave that have that source. More...
 
typedef walk_rc_t(* fib_source_walk_t) (fib_source_t id, const char *name, fib_source_priority_t prio, fib_source_behaviour_t bh, void *ctx)
 

Enumerations

enum  fib_source_t_ {
  FIB_SOURCE_INVALID = 0, FIB_SOURCE_FIRST, FIB_SOURCE_SPECIAL = FIB_SOURCE_FIRST, FIB_SOURCE_CLASSIFY,
  FIB_SOURCE_PROXY, FIB_SOURCE_INTERFACE, FIB_SOURCE_SR, FIB_SOURCE_BIER,
  FIB_SOURCE_6RD, FIB_SOURCE_API, FIB_SOURCE_CLI, FIB_SOURCE_LISP,
  FIB_SOURCE_MAP, FIB_SOURCE_DHCP, FIB_SOURCE_IP6_ND_PROXY, FIB_SOURCE_IP6_ND,
  FIB_SOURCE_ADJ, FIB_SOURCE_MPLS, FIB_SOURCE_AE, FIB_SOURCE_RR,
  FIB_SOURCE_URPF_EXEMPT, FIB_SOURCE_DEFAULT_ROUTE, FIB_SOURCE_INTERPOSE, FIB_SOURCE_LAST = FIB_SOURCE_INTERPOSE
}
 The different sources that can create a route. More...
 
enum  fib_source_priority_cmp_t_ { FIB_SOURCE_CMP_BETTER, FIB_SOURCE_CMP_WORSE, FIB_SOURCE_CMP_EQUAL }
 source comparison More...
 
enum  fib_source_behaviour_t_ {
  FIB_SOURCE_BH_DROP, FIB_SOURCE_BH_API, FIB_SOURCE_BH_SIMPLE, FIB_SOURCE_BH_RR,
  FIB_SOURCE_BH_MPLS, FIB_SOURCE_BH_INTERFACE, FIB_SOURCE_BH_INTERPOSE, FIB_SOURCE_BH_LISP,
  FIB_SOURCE_BH_ADJ
}
 Each source has a defined behaviour that controls how entries behave that have that source. More...
 

Functions

 STATIC_ASSERT (sizeof(fib_source_t)==1, "FIB too many sources")
 
u16 fib_source_get_prio (fib_source_t src)
 
fib_source_behaviour_t fib_source_get_behaviour (fib_source_t src)
 
fib_source_priority_cmp_t fib_source_cmp (fib_source_t s1, fib_source_t s2)
 
u8format_fib_source (u8 *s, va_list *a)
 
fib_source_t fib_source_allocate (const char *name, fib_source_priority_t prio, fib_source_behaviour_t bh)
 
void fib_source_register (fib_source_t src, fib_source_priority_t prio, fib_source_behaviour_t bh)
 
void fib_source_walk (fib_source_walk_t fn, void *ctx)
 
void fib_source_module_init (void)
 

Macro Definition Documentation

◆ FIB_SOURCE_BEHAVIOURS

#define FIB_SOURCE_BEHAVIOURS
Value:
{ \
[FIB_SOURCE_BH_DROP] = "drop", \
[FIB_SOURCE_BH_RR] = "rr", \
[FIB_SOURCE_BH_MPLS] = "mpls", \
[FIB_SOURCE_BH_INTERFACE] = "interface", \
[FIB_SOURCE_BH_INTERPOSE] = "interpose", \
[FIB_SOURCE_BH_LISP] = "lisp", \
[FIB_SOURCE_BH_ADJ] = "adjacency", \
[FIB_SOURCE_BH_API] = "api", \
[FIB_SOURCE_BH_SIMPLE] = "simple", \
}

Definition at line 238 of file fib_source.h.

◆ FIB_SOURCE_BH_MAX

#define FIB_SOURCE_BH_MAX   (FIB_SOURCE_BH_ADJ+1)

Definition at line 236 of file fib_source.h.

◆ FIB_SOURCE_PRIORITY_HI

#define FIB_SOURCE_PRIORITY_HI   0x10

Some priority values that plugins might use when they are not to concerned where in the list they'll go.

Definition at line 284 of file fib_source.h.

◆ FIB_SOURCE_PRIORITY_LOW

#define FIB_SOURCE_PRIORITY_LOW   0xd0

Definition at line 285 of file fib_source.h.

◆ FIB_SOURCES

#define FIB_SOURCES
Value:
{ \
[FIB_SOURCE_INVALID] = "invalid", \
[FIB_SOURCE_SPECIAL] = "special", \
[FIB_SOURCE_INTERFACE] = "interface", \
[FIB_SOURCE_PROXY] = "proxy", \
[FIB_SOURCE_BIER] = "BIER", \
[FIB_SOURCE_6RD] = "6RD", \
[FIB_SOURCE_API] = "API", \
[FIB_SOURCE_CLI] = "CLI", \
[FIB_SOURCE_ADJ] = "adjacency", \
[FIB_SOURCE_MAP] = "MAP", \
[FIB_SOURCE_SR] = "SR", \
[FIB_SOURCE_LISP] = "LISP", \
[FIB_SOURCE_CLASSIFY] = "classify", \
[FIB_SOURCE_DHCP] = "DHCP", \
[FIB_SOURCE_IP6_ND_PROXY] = "IPv6-proxy-nd", \
[FIB_SOURCE_IP6_ND] = "IPv6-nd", \
[FIB_SOURCE_RR] = "recursive-resolution", \
[FIB_SOURCE_AE] = "attached_export", \
[FIB_SOURCE_MPLS] = "mpls", \
[FIB_SOURCE_URPF_EXEMPT] = "urpf-exempt", \
[FIB_SOURCE_DEFAULT_ROUTE] = "default-route", \
[FIB_SOURCE_INTERPOSE] = "interpose", \
}

Definition at line 151 of file fib_source.h.

◆ foreach_fib_source

#define foreach_fib_source
Value:

The fixed source to priority mappings.

Declared here so those adding new sources can better determine their respective priority values.

Definition at line 255 of file fib_source.h.

Typedef Documentation

◆ fib_source_behaviour_t

Each source has a defined behaviour that controls how entries behave that have that source.

Sources with non-default behaviour may have a private data area in the fib_entry_src_t union.

◆ fib_source_priority_cmp_t

source comparison

◆ fib_source_priority_t

Each source is assigned a priority.

lower priority is better. the source with the best source with have its contribution added to forwarding. the lesser sources will be 'remembered' by FIB and added to forwarding should the best source be removed.

Definition at line 182 of file fib_source.h.

◆ fib_source_t

The different sources that can create a route.

A source is a combination of two concepts; priority and behaviour. Priority determines whether the source is contributing forwarding. Behaviour determines how FIB entries with this source interact with other elements of FIB.

◆ fib_source_walk_t

typedef walk_rc_t(* fib_source_walk_t) (fib_source_t id, const char *name, fib_source_priority_t prio, fib_source_behaviour_t bh, void *ctx)

Definition at line 303 of file fib_source.h.

Enumeration Type Documentation

◆ fib_source_behaviour_t_

Each source has a defined behaviour that controls how entries behave that have that source.

Sources with non-default behaviour may have a private data area in the fib_entry_src_t union.

Enumerator
FIB_SOURCE_BH_DROP 

If you're adding a new source from a plugin pick one of these.

Default behaviour - always install a drop

FIB_SOURCE_BH_API 

add paths with [mpls] path extensions

FIB_SOURCE_BH_SIMPLE 

add paths without path extensions

FIB_SOURCE_BH_RR 

If your adding a new source from a plugin these are probably not the behaviour you're lokking for.

recursive resolution w/ cover tracking

FIB_SOURCE_BH_MPLS 

associated label stored in private data

FIB_SOURCE_BH_INTERFACE 

cover tracking w/ glean management

FIB_SOURCE_BH_INTERPOSE 

interpose

FIB_SOURCE_BH_LISP 

simple behaviour, plus the source specific data stores the FIB index that is used for subsequent lookups using the packet's source address.

This doesn't need to be a LISP specific source, it's just 'simple' behaviour with a u32 stored in the source specific data.

FIB_SOURCE_BH_ADJ 

adj w/ cover tracking + refinement

Definition at line 200 of file fib_source.h.

◆ fib_source_priority_cmp_t_

source comparison

Enumerator
FIB_SOURCE_CMP_BETTER 
FIB_SOURCE_CMP_WORSE 
FIB_SOURCE_CMP_EQUAL 

Definition at line 187 of file fib_source.h.

◆ fib_source_t_

The different sources that can create a route.

A source is a combination of two concepts; priority and behaviour. Priority determines whether the source is contributing forwarding. Behaviour determines how FIB entries with this source interact with other elements of FIB.

Enumerator
FIB_SOURCE_INVALID 

An invalid source This is not a real source, so don't use it to source a prefix.

It exists here to provide a value for inexistant/uninitialized source

FIB_SOURCE_FIRST 

Marker.

Add new values after this one.

FIB_SOURCE_SPECIAL 

Special sources.

These are for entries that are added to all FIBs by default, and should never be over-ridden (hence they are the highest priority)

FIB_SOURCE_CLASSIFY 

Classify.

A route that links directly to a classify adj

FIB_SOURCE_PROXY 

A route the is being 'proxied' on behalf of another device.

FIB_SOURCE_INTERFACE 

Route added as a result of interface configuration.

this will also come from the API/CLI, but the distinction is that is from confiiguration on an interface, not a 'ip route' command

FIB_SOURCE_SR 

SRv6 and SR-MPLS.

FIB_SOURCE_BIER 

From the BIER subsystem.

FIB_SOURCE_6RD 

From 6RD.

FIB_SOURCE_API 

From the control plane API.

FIB_SOURCE_CLI 

From the CLI.

FIB_SOURCE_LISP 

LISP.

FIB_SOURCE_MAP 

IPv[46] Mapping.

FIB_SOURCE_DHCP 

DHCP.

FIB_SOURCE_IP6_ND_PROXY 

IPv6 Proxy ND.

FIB_SOURCE_IP6_ND 

IPv6 ND (seen in the link-local tables)

FIB_SOURCE_ADJ 

Adjacency source.

routes created as a result of ARP/ND entries. This is lower priority then the API/CLI. This is on purpose. trust me.

FIB_SOURCE_MPLS 

MPLS label.

The prefix has been assigned a local label. This source never provides forwarding information, instead it acts as a place-holder so the association of label to prefix can be maintained

FIB_SOURCE_AE 

Attached Export source.

routes created as a result of attahced export. routes thus sourced will be present in the export tables

FIB_SOURCE_RR 

Recursive resolution source.

Used to install an entry that is the resolution traget of another.

FIB_SOURCE_URPF_EXEMPT 

uRPF bypass/exemption.

Used to install an entry that is exempt from the loose uRPF check

FIB_SOURCE_DEFAULT_ROUTE 

The default route source.

The default route is always added to the FIB table (like the special sources) but we need to be able to over-ride it with 'ip route' sources when provided

FIB_SOURCE_INTERPOSE 

The interpose source.

This is not a real source, so don't use it to source a prefix. It exists here to provide a value against which to register to the VFT for providing the interpose actions to a real source.

FIB_SOURCE_LAST 

Marker.

add new entries before this one.

Definition at line 29 of file fib_source.h.

Function Documentation

◆ fib_source_allocate()

fib_source_t fib_source_allocate ( const char *  name,
fib_source_priority_t  prio,
fib_source_behaviour_t  bh 
)

Definition at line 118 of file fib_source.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fib_source_cmp()

fib_source_priority_cmp_t fib_source_cmp ( fib_source_t  s1,
fib_source_t  s2 
)

Definition at line 76 of file fib_source.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fib_source_get_behaviour()

fib_source_behaviour_t fib_source_get_behaviour ( fib_source_t  src)

Definition at line 58 of file fib_source.c.

+ Here is the caller graph for this function:

◆ fib_source_get_prio()

u16 fib_source_get_prio ( fib_source_t  src)

Definition at line 49 of file fib_source.c.

+ Here is the caller graph for this function:

◆ fib_source_module_init()

void fib_source_module_init ( void  )

Definition at line 217 of file fib_source.c.

+ Here is the caller graph for this function:

◆ fib_source_register()

void fib_source_register ( fib_source_t  src,
fib_source_priority_t  prio,
fib_source_behaviour_t  bh 
)

Definition at line 137 of file fib_source.c.

+ Here is the call graph for this function:

◆ fib_source_walk()

void fib_source_walk ( fib_source_walk_t  fn,
void *  ctx 
)

Definition at line 169 of file fib_source.c.

+ Here is the caller graph for this function:

◆ format_fib_source()

u8* format_fib_source ( u8 s,
va_list *  a 
)

Definition at line 66 of file fib_source.c.

+ Here is the caller graph for this function:

◆ STATIC_ASSERT()

STATIC_ASSERT ( sizeof(fib_source_t = =1,
"FIB too many sources"   
)
FIB_SOURCE_IP6_ND
@ FIB_SOURCE_IP6_ND
IPv6 ND (seen in the link-local tables)
Definition: fib_source.h:99
FIB_SOURCE_BIER
@ FIB_SOURCE_BIER
From the BIER subsystem.
Definition: fib_source.h:67
FIB_SOURCE_DHCP
@ FIB_SOURCE_DHCP
DHCP.
Definition: fib_source.h:91
FIB_SOURCE_INTERPOSE
@ FIB_SOURCE_INTERPOSE
The interpose source.
Definition: fib_source.h:141
FIB_SOURCE_BH_MPLS
@ FIB_SOURCE_BH_MPLS
associated label stored in private data
Definition: fib_source.h:219
FIB_SOURCE_BH_INTERFACE
@ FIB_SOURCE_BH_INTERFACE
cover tracking w/ glean management
Definition: fib_source.h:221
FIB_SOURCE_URPF_EXEMPT
@ FIB_SOURCE_URPF_EXEMPT
uRPF bypass/exemption.
Definition: fib_source.h:127
FIB_SOURCE_PROXY
@ FIB_SOURCE_PROXY
A route the is being 'proxied' on behalf of another device.
Definition: fib_source.h:53
FIB_SOURCE_BH_DROP
@ FIB_SOURCE_BH_DROP
If you're adding a new source from a plugin pick one of these.
Definition: fib_source.h:206
FIB_SOURCE_ADJ
@ FIB_SOURCE_ADJ
Adjacency source.
Definition: fib_source.h:105
FIB_SOURCE_INTERFACE
@ FIB_SOURCE_INTERFACE
Route added as a result of interface configuration.
Definition: fib_source.h:59
FIB_SOURCE_INVALID
@ FIB_SOURCE_INVALID
An invalid source This is not a real source, so don't use it to source a prefix.
Definition: fib_source.h:35
FIB_SOURCE_BH_ADJ
@ FIB_SOURCE_BH_ADJ
adj w/ cover tracking + refinement
Definition: fib_source.h:233
FIB_SOURCE_CLASSIFY
@ FIB_SOURCE_CLASSIFY
Classify.
Definition: fib_source.h:49
FIB_SOURCE_BH_INTERPOSE
@ FIB_SOURCE_BH_INTERPOSE
interpose
Definition: fib_source.h:223
FIB_SOURCE_SR
@ FIB_SOURCE_SR
SRv6 and SR-MPLS.
Definition: fib_source.h:63
FIB_SOURCE_BH_API
@ FIB_SOURCE_BH_API
add paths with [mpls] path extensions
Definition: fib_source.h:208
FIB_SOURCE_DEFAULT_ROUTE
@ FIB_SOURCE_DEFAULT_ROUTE
The default route source.
Definition: fib_source.h:134
FIB_SOURCE_IP6_ND_PROXY
@ FIB_SOURCE_IP6_ND_PROXY
IPv6 Proxy ND.
Definition: fib_source.h:95
FIB_SOURCE_CLI
@ FIB_SOURCE_CLI
From the CLI.
Definition: fib_source.h:79
FIB_SOURCE_API
@ FIB_SOURCE_API
From the control plane API.
Definition: fib_source.h:75
FIB_SOURCE_BH_LISP
@ FIB_SOURCE_BH_LISP
simple behaviour, plus the source specific data stores the FIB index that is used for subsequent look...
Definition: fib_source.h:231
FIB_SOURCE_SPECIAL
@ FIB_SOURCE_SPECIAL
Special sources.
Definition: fib_source.h:45
FIB_SOURCE_BH_RR
@ FIB_SOURCE_BH_RR
If your adding a new source from a plugin these are probably not the behaviour you're lokking for.
Definition: fib_source.h:217
FIB_SOURCE_MPLS
@ FIB_SOURCE_MPLS
MPLS label.
Definition: fib_source.h:111
FIB_SOURCE_AE
@ FIB_SOURCE_AE
Attached Export source.
Definition: fib_source.h:117
FIB_SOURCE_BH_SIMPLE
@ FIB_SOURCE_BH_SIMPLE
add paths without path extensions
Definition: fib_source.h:210
FIB_SOURCE_RR
@ FIB_SOURCE_RR
Recursive resolution source.
Definition: fib_source.h:122
FIB_SOURCE_6RD
@ FIB_SOURCE_6RD
From 6RD.
Definition: fib_source.h:71
FIB_SOURCE_LISP
@ FIB_SOURCE_LISP
LISP.
Definition: fib_source.h:83
FIB_SOURCE_MAP
@ FIB_SOURCE_MAP
IPv[46] Mapping.
Definition: fib_source.h:87