FD.io VPP  v21.01.1
Vector Packet Processing
cnat_client.h File Reference
+ Include dependency graph for cnat_client.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  cnat_client_t_
 A client is a representation of an IP address behind the NAT. More...
 
struct  cnat_learn_arg_t_
 
struct  cnat_client_db_t_
 DB of clients. More...
 

Macros

#define CC_INDEX_INVALID   ((u32)(~0))
 

Typedefs

typedef struct cnat_client_t_ cnat_client_t
 A client is a representation of an IP address behind the NAT. More...
 
typedef struct cnat_learn_arg_t_ cnat_learn_arg_t
 
typedef struct cnat_client_db_t_ cnat_client_db_t
 DB of clients. More...
 

Enumerations

enum  cnat_entry_flag_t { CNAT_FLAG_EXCLUSIVE = (1 << 1), CNAT_FLAG_EXPIRES = (1 << 2) }
 CNat Client (dpo) flags. More...
 

Functions

u8format_cnat_client (u8 *s, va_list *args)
 
void cnat_client_free_by_ip (ip46_address_t *addr, u8 af)
 
static_always_inline cnat_client_tcnat_client_get (index_t i)
 
void cnat_client_translation_deleted (index_t cci)
 A translation that references this VIP was deleted. More...
 
void cnat_client_translation_added (index_t cci)
 A translation that references this VIP was added. More...
 
void cnat_client_learn (const cnat_learn_arg_t *l)
 Called in the main thread by RPC from the workers to learn a new client. More...
 
index_t cnat_client_add (const ip_address_t *ip, u8 flags)
 
int cnat_client_purge (void)
 Check all the clients were purged by translation & session purge. More...
 
void cnat_client_throttle_pool_process ()
 
static_always_inline cnat_client_tcnat_client_ip4_find (const ip4_address_t *ip)
 Find a client from an IP4 address. More...
 
static_always_inline u32 cnat_client_ip4_find_index (const ip4_address_t *ip)
 
static_always_inline cnat_client_tcnat_client_ip6_find (const ip6_address_t *ip)
 Find a client from an IP6 address. More...
 
static_always_inline u32 cnat_client_cnt_session (cnat_client_t *cc)
 Add a session refcnt to this client. More...
 
static_always_inline u32 cnat_client_uncnt_session (cnat_client_t *cc)
 Del a session refcnt to this client. More...
 

Variables

cnat_client_tcnat_client_pool
 
dpo_type_t cnat_client_dpo
 
cnat_client_db_t cnat_client_db
 

Macro Definition Documentation

◆ CC_INDEX_INVALID

#define CC_INDEX_INVALID   ((u32)(~0))

Definition at line 88 of file cnat_client.h.

Typedef Documentation

◆ cnat_client_db_t

DB of clients.

◆ cnat_client_t

typedef struct cnat_client_t_ cnat_client_t

A client is a representation of an IP address behind the NAT.

A client thus sends packet to a VIP. Clients are learned in the Data-plane when they send packets, but, since they make additions to the FIB they must be programmed in the main thread. They are aged out when they become idle.

A client interposes in the FIB graph for the prefix corresponding to the client (e.g. client's-IP/32). As a result this client object is cloned as the interpose DPO. The clones are removed when the lock count drops to zero. The originals are removed when the client ages. At forwarding time the client preforms the reverse translation and then ships the packet to where the FIB would send it.

◆ cnat_learn_arg_t

Enumeration Type Documentation

◆ cnat_entry_flag_t

CNat Client (dpo) flags.

Enumerator
CNAT_FLAG_EXCLUSIVE 
CNAT_FLAG_EXPIRES 

Definition at line 126 of file cnat_client.h.

Function Documentation

◆ cnat_client_add()

index_t cnat_client_add ( const ip_address_t ip,
u8  flags 
)

Definition at line 151 of file cnat_client.c.

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

◆ cnat_client_cnt_session()

static_always_inline u32 cnat_client_cnt_session ( cnat_client_t cc)

Add a session refcnt to this client.

Definition at line 202 of file cnat_client.h.

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

◆ cnat_client_free_by_ip()

void cnat_client_free_by_ip ( ip46_address_t *  addr,
u8  af 
)

Definition at line 58 of file cnat_client.c.

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

◆ cnat_client_get()

static_always_inline cnat_client_t* cnat_client_get ( index_t  i)

Definition at line 91 of file cnat_client.h.

+ Here is the caller graph for this function:

◆ cnat_client_ip4_find()

static_always_inline cnat_client_t* cnat_client_ip4_find ( const ip4_address_t ip)

Find a client from an IP4 address.

Definition at line 157 of file cnat_client.h.

+ Here is the caller graph for this function:

◆ cnat_client_ip4_find_index()

static_always_inline u32 cnat_client_ip4_find_index ( const ip4_address_t ip)

Definition at line 170 of file cnat_client.h.

◆ cnat_client_ip6_find()

static_always_inline cnat_client_t* cnat_client_ip6_find ( const ip6_address_t *  ip)

Find a client from an IP6 address.

Definition at line 186 of file cnat_client.h.

+ Here is the caller graph for this function:

◆ cnat_client_learn()

void cnat_client_learn ( const cnat_learn_arg_t l)

Called in the main thread by RPC from the workers to learn a new client.

Definition at line 202 of file cnat_client.c.

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

◆ cnat_client_purge()

int cnat_client_purge ( void  )

Check all the clients were purged by translation & session purge.

Definition at line 242 of file cnat_client.c.

+ Here is the call graph for this function:

◆ cnat_client_throttle_pool_process()

void cnat_client_throttle_pool_process ( )

Definition at line 71 of file cnat_client.c.

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

◆ cnat_client_translation_added()

void cnat_client_translation_added ( index_t  cci)

A translation that references this VIP was added.

Definition at line 109 of file cnat_client.c.

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

◆ cnat_client_translation_deleted()

void cnat_client_translation_deleted ( index_t  cci)

A translation that references this VIP was deleted.

Definition at line 121 of file cnat_client.c.

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

◆ cnat_client_uncnt_session()

static_always_inline u32 cnat_client_uncnt_session ( cnat_client_t cc)

Del a session refcnt to this client.

Definition at line 212 of file cnat_client.h.

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

◆ format_cnat_client()

u8* format_cnat_client ( u8 s,
va_list *  args 
)

Definition at line 258 of file cnat_client.c.

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

Variable Documentation

◆ cnat_client_db

cnat_client_db_t cnat_client_db

Definition at line 24 of file cnat_client.c.

◆ cnat_client_dpo

dpo_type_t cnat_client_dpo

Definition at line 26 of file cnat_client.c.

◆ cnat_client_pool

cnat_client_t* cnat_client_pool

Definition at line 22 of file cnat_client.c.