FD.io VPP  v16.06
Vector Packet Processing
cnat_db_v2.c File Reference
+ Include dependency graph for cnat_db_v2.c:

Go to the source code of this file.

Data Structures

struct  cnat_db_v2_main_t
 

Macros

#define HASH_TABLE_SIZE   8192
 
#define THROTTLE_TIME   180
 
#define PREDICT_TRUE(x)   (x)
 
#define PREDICT_FALSE(x)   (x)
 
#define foreach_cnat_db_v2_error   _(DROP, "error-drop packets")
 
#define CNAT_SET_ICMP_MSG_INFO
 
#define CNAT_DEBUG_INSIDE_ERR(err)
 
#define DSLITE_DEBUG_INSIDE_ERR(err)
 
#define PORT_LIMIT_LOW_THRESHOLD_FOR_SYSLOG   7
 
#define CHECK_CLEAR_PORT_LIMIT_EXCEED_FLAG(udb, max_limit)
 

Enumerations

enum  cnat_db_v2_error_t { CNAT_DB_V2_N_ERROR }
 

Functions

void cnat_table_entry_fill_map (u32 start_addr, u32 end_addr, cnat_portmap_v2_t **port_map_holder)
 
void cnat_delete_session_db_entry (cnat_session_entry_t *ep, u8 log)
 
void handle_cnat_port_exceeded_logging (cnat_user_db_entry_t *udb, cnat_key_t *key, cnat_vrfmap_t *vrfmap)
 
void port_exceeded_msg_log (u32 src_addr, u16 i_vrf)
 
static void log_port_alloc_error (cnat_errno_t error, cnat_key_t *k)
 
void cnat_db_debug_error (cnat_db_key_bucket_t *u_ki, cnat_errno_t error)
 
void dslite_db_debug_error (dslite_db_key_bucket_t *u_ki, cnat_errno_t error)
 
void cnat_db_debug_i2o_drop (cnat_db_key_bucket_t *ki)
 
void cnat_db_in2out_hash_delete (cnat_main_db_entry_t *ep, cnat_user_db_entry_t *up)
 
void cnat_db_out2in_hash_delete (cnat_main_db_entry_t *ep)
 
cnat_main_db_entry_tcnat_main_db_lookup_entry (cnat_db_key_bucket_t *ki)
 
void cnat_user_db_delete (cnat_user_db_entry_t *up)
 
cnat_user_db_entry_tcnat_user_db_lookup_entry (cnat_db_key_bucket_t *uki)
 
cnat_user_db_entry_tcnat_user_db_create_entry (cnat_db_key_bucket_t *uki, u32 portmap_index)
 
cnat_main_db_entry_tcnat_create_main_db_entry_and_hash (cnat_db_key_bucket_t *ki, cnat_db_key_bucket_t *ko, cnat_user_db_entry_t *udb)
 
static void pptp_clear_all_channels (cnat_main_db_entry_t *db)
 
void pptp_remove_channel_from_tunnel (cnat_main_db_entry_t *db)
 
void cnat_delete_main_db_entry_v2 (cnat_main_db_entry_t *ep)
 
cnat_main_db_entry_tcnat_main_db_lookup_entry_out2in (cnat_db_key_bucket_t *ko)
 
cnat_session_entry_tcnat_handle_1to2_session (cnat_main_db_entry_t *mdb, cnat_key_t *dest_info)
 
void cnat_add_dest_n_log (cnat_main_db_entry_t *mdb, cnat_key_t *dest_info)
 
cnat_main_db_entry_tcnat_get_main_db_entry_v2 (cnat_db_key_bucket_t *ki, port_pair_t port_pair_type, port_type_t port_type, cnat_gen_icmp_info *info, cnat_key_t *dest_info)
 
cnat_main_db_entry_tcnat_create_static_main_db_entry_v2 (cnat_db_key_bucket_t *ki, cnat_db_key_bucket_t *ko, cnat_vrfmap_t *my_vrfmap, cnat_gen_icmp_info *info)
 
cnat_main_db_entry_tdslite_main_db_lookup_entry (dslite_db_key_bucket_t *ki)
 
cnat_user_db_entry_tdslite_user_db_lookup_entry (dslite_db_key_bucket_t *uki)
 
cnat_user_db_entry_tdslite_user_db_create_entry (dslite_db_key_bucket_t *uki, u32 portmap_index)
 
cnat_main_db_entry_tdslite_create_main_db_entry_and_hash (dslite_db_key_bucket_t *ki, cnat_db_key_bucket_t *ko, cnat_user_db_entry_t *udb)
 
static u32 cnat_timeout_db_hash_lookup (cnat_key_t t_key)
 
u16 query_and_update_db_timeout (void *db, u8 db_type)
 
static void cnat_timeout_db_hash_add (cnat_timeout_db_entry_t *t_entry)
 
u16 cnat_timeout_db_create (cnat_timeout_t t_entry)
 
void cnat_timeout_db_delete (cnat_key_t t_key)
 
void cnat_session_db_hash_delete (cnat_session_entry_t *ep)
 
cnat_session_entry_tcnat_session_db_edm_lookup_entry (cnat_key_t *ko, u32 session_head_index, u32 main_db_index)
 
cnat_session_entry_tcnat_session_db_lookup_entry (cnat_key_t *ko, u32 main_db_index)
 
cnat_session_entry_tcnat_create_session_db_entry (cnat_key_t *ko, cnat_main_db_entry_t *bdb, u8 log)
 
void cnat_dest_update_main2session (cnat_main_db_entry_t *mdb, cnat_session_entry_t *sdb)
 
void cnat_dest_update_session2main (cnat_main_db_entry_t *mdb, cnat_session_entry_t *sdb)
 
cnat_main_db_entry_tdslite_get_main_db_entry_v2 (dslite_db_key_bucket_t *ki, port_pair_t port_pair_type, port_type_t port_type, cnat_gen_icmp_info *info, dslite_table_entry_t *dslite_entry_ptr, cnat_key_t *dest_info)
 
void cnat_db_v2_init (void)
 

Variables

u8 cnat_db_init_done = 0
 
cnat_db_v2_main_t cnat_db_v2_main
 
static char * cnat_db_v2_error_strings []
 
cnat_global_counters_t cnat_global_counters
 
u32 last_log_timestamp = 0
 
u32 last_user_dyn_port_exc_timestamp = 0
 
u32 last_user_stat_port_exc_timestamp = 0
 
index_slist_tcnat_out2in_hash
 
index_slist_tcnat_in2out_hash
 
index_slist_tcnat_user_hash
 
index_slist_tcnat_timeout_hash
 
index_slist_tcnat_session_hash
 
cnat_main_db_entry_tcnat_main_db
 
cnat_user_db_entry_tcnat_user_db
 
cnat_session_entry_tcnat_session_db
 
cnat_timeout_db_entry_tcnat_timeout_db
 
cgse_nat_db_entry_tcgse_nat_db
 
cgse_nat_user_db_entry_tcgse_user_db
 
cgse_nat_session_db_entry_tcgse_session_db
 
nat44_dslite_common_stats_t nat44_dslite_common_stats [255]
 
nat44_dslite_global_stats_t nat44_dslite_global_stats [2]
 
nat44_counters_stats_t nat44_counters_stats [CNAT_MAX_VRFMAP_ENTRIES]
 
cnat_vrfmap_tcnat_map_by_vrf
 
u16 vrf_map_array [CNAT_MAX_VRFMAP_ENTRIES]
 
cnat_svi_params_entry svi_params_array [CNAT_MAX_VRFMAP_ENTRIES]
 
cnat_ingress_vrfid_name_entry vrfid_name_map [MAX_VRFID] = {{0}}
 
u64 in2out_drops_port_limit_exceeded
 
u64 in2out_drops_system_limit_reached
 
u64 in2out_drops_resource_depletion
 
u64 no_translation_entry_drops
 
u32 no_sessions
 
f64 port_log_timestamps [HASH_TABLE_SIZE]
 

Macro Definition Documentation

#define CHECK_CLEAR_PORT_LIMIT_EXCEED_FLAG (   udb,
  max_limit 
)
Value:
if(udb->ntranslations < \
max_limit >= 10) { \
udb->flags = udb->flags & (~CNAT_USER_DB_PORT_LIMIT_EXCEEDED); \
} \
}
#define CNAT_USER_DB_PORT_LIMIT_EXCEEDED
Definition: cnat_db.h:300
#define PORT_LIMIT_LOW_THRESHOLD_FOR_SYSLOG
Definition: cnat_db_v2.c:255
#define PREDICT_FALSE(x)
Definition: cnat_db_v2.c:61

Definition at line 260 of file cnat_db_v2.c.

#define CNAT_DEBUG_INSIDE_ERR (   err)
Value:
if (((protocol == CNAT_UDP) && \
((protocol == CNAT_TCP) && \
((protocol == CNAT_ICMP) && \
cnat_db_debug_error(&u_ki, err); \
}
#define CNAT_DEBUG_ERR_TCP
Definition: cnat_cli.h:90
#define CNAT_DEBUG_ERR_UDP
Definition: cnat_cli.h:91
#define CNAT_UDP
Definition: cnat_db.h:93
#define CNAT_ICMP
Definition: cnat_db.h:95
#define CNAT_TCP
Definition: cnat_db.h:94
u32 debug_i_flag
void cnat_db_debug_error(cnat_db_key_bucket_t *u_ki, cnat_errno_t error)
Definition: cnat_db_v2.c:373
#define CNAT_DEBUG_ERR_ICMP
Definition: cnat_cli.h:92

Definition at line 235 of file cnat_db_v2.c.

#define CNAT_SET_ICMP_MSG_INFO
Value:
if (PREDICT_TRUE((my_vrfmap->i_vrf < CNAT_MAX_VRFMAP_ENTRIES) && \
(svi_params_array[my_vrfmap->i_vrf].ipv4_addr))) { \
info->gen_icmp_msg = icmp_msg_gen_allowed(); \
info->svi_addr = svi_params_array[my_vrfmap->i_vrf].ipv4_addr; \
}
#define PREDICT_TRUE(x)
Definition: cnat_db_v2.c:60
#define CNAT_MAX_VRFMAP_ENTRIES
Definition: cnat_db.h:103
cnat_svi_params_entry svi_params_array[CNAT_MAX_VRFMAP_ENTRIES]
Definition: cnat_db_v2.c:220
cnat_icmp_msg_t icmp_msg_gen_allowed()
Definition: cnat_syslog.c:448

Definition at line 228 of file cnat_db_v2.c.

#define DSLITE_DEBUG_INSIDE_ERR (   err)
Value:
if (((protocol == CNAT_UDP) && \
((protocol == CNAT_TCP) && \
((protocol == CNAT_ICMP) && \
dslite_db_debug_error(&u_ki, err); \
}
#define CNAT_DEBUG_ERR_TCP
Definition: cnat_cli.h:90
void dslite_db_debug_error(dslite_db_key_bucket_t *u_ki, cnat_errno_t error)
Definition: cnat_db_v2.c:392
#define CNAT_DEBUG_ERR_UDP
Definition: cnat_cli.h:91
#define CNAT_UDP
Definition: cnat_db.h:93
#define CNAT_ICMP
Definition: cnat_db.h:95
#define CNAT_TCP
Definition: cnat_db.h:94
u32 debug_i_flag
#define CNAT_DEBUG_ERR_ICMP
Definition: cnat_cli.h:92

Definition at line 245 of file cnat_db_v2.c.

#define foreach_cnat_db_v2_error   _(DROP, "error-drop packets")

Definition at line 64 of file cnat_db_v2.c.

#define HASH_TABLE_SIZE   8192

Definition at line 40 of file cnat_db_v2.c.

#define PORT_LIMIT_LOW_THRESHOLD_FOR_SYSLOG   7

Definition at line 255 of file cnat_db_v2.c.

#define PREDICT_FALSE (   x)    (x)

Definition at line 61 of file cnat_db_v2.c.

#define PREDICT_TRUE (   x)    (x)

Definition at line 60 of file cnat_db_v2.c.

#define THROTTLE_TIME   180

Definition at line 41 of file cnat_db_v2.c.

Enumeration Type Documentation

Enumerator
CNAT_DB_V2_N_ERROR 

Definition at line 67 of file cnat_db_v2.c.

Function Documentation

void cnat_add_dest_n_log ( cnat_main_db_entry_t mdb,
cnat_key_t dest_info 
)

Definition at line 1068 of file cnat_db_v2.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

cnat_main_db_entry_t* cnat_create_main_db_entry_and_hash ( cnat_db_key_bucket_t ki,
cnat_db_key_bucket_t ko,
cnat_user_db_entry_t udb 
)

Definition at line 643 of file cnat_db_v2.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

cnat_session_entry_t* cnat_create_session_db_entry ( cnat_key_t ko,
cnat_main_db_entry_t bdb,
u8  log 
)

Definition at line 2597 of file cnat_db_v2.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

cnat_main_db_entry_t* cnat_create_static_main_db_entry_v2 ( cnat_db_key_bucket_t ki,
cnat_db_key_bucket_t ko,
cnat_vrfmap_t my_vrfmap,
cnat_gen_icmp_info info 
)

Definition at line 1634 of file cnat_db_v2.c.

+ Here is the call graph for this function:

void cnat_db_debug_error ( cnat_db_key_bucket_t u_ki,
cnat_errno_t  error 
)

Definition at line 373 of file cnat_db_v2.c.

+ Here is the call graph for this function:

void cnat_db_debug_i2o_drop ( cnat_db_key_bucket_t ki)

Definition at line 411 of file cnat_db_v2.c.

+ Here is the call graph for this function:

void cnat_db_in2out_hash_delete ( cnat_main_db_entry_t ep,
cnat_user_db_entry_t up 
)

Definition at line 427 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

void cnat_db_out2in_hash_delete ( cnat_main_db_entry_t ep)

Definition at line 476 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

void cnat_db_v2_init ( void  )

Definition at line 3609 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

void cnat_delete_main_db_entry_v2 ( cnat_main_db_entry_t ep)

Definition at line 753 of file cnat_db_v2.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void cnat_delete_session_db_entry ( cnat_session_entry_t ep,
u8  log 
)

Definition at line 2742 of file cnat_db_v2.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void cnat_dest_update_main2session ( cnat_main_db_entry_t mdb,
cnat_session_entry_t sdb 
)

Definition at line 2695 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

void cnat_dest_update_session2main ( cnat_main_db_entry_t mdb,
cnat_session_entry_t sdb 
)

Definition at line 2723 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

cnat_main_db_entry_t* cnat_get_main_db_entry_v2 ( cnat_db_key_bucket_t ki,
port_pair_t  port_pair_type,
port_type_t  port_type,
cnat_gen_icmp_info info,
cnat_key_t dest_info 
)

Definition at line 1102 of file cnat_db_v2.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

cnat_session_entry_t* cnat_handle_1to2_session ( cnat_main_db_entry_t mdb,
cnat_key_t dest_info 
)

Definition at line 1012 of file cnat_db_v2.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

cnat_main_db_entry_t* cnat_main_db_lookup_entry ( cnat_db_key_bucket_t ki)

Definition at line 509 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

cnat_main_db_entry_t* cnat_main_db_lookup_entry_out2in ( cnat_db_key_bucket_t ko)

Definition at line 981 of file cnat_db_v2.c.

cnat_session_entry_t* cnat_session_db_edm_lookup_entry ( cnat_key_t ko,
u32  session_head_index,
u32  main_db_index 
)

Definition at line 2537 of file cnat_db_v2.c.

void cnat_session_db_hash_delete ( cnat_session_entry_t ep)

Definition at line 2499 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

cnat_session_entry_t* cnat_session_db_lookup_entry ( cnat_key_t ko,
u32  main_db_index 
)

Definition at line 2566 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

void cnat_table_entry_fill_map ( u32  start_addr,
u32  end_addr,
cnat_portmap_v2_t **  port_map_holder 
)

Definition at line 81 of file cnat_db_v2.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u16 cnat_timeout_db_create ( cnat_timeout_t  t_entry)

Definition at line 2410 of file cnat_db_v2.c.

+ Here is the call graph for this function:

void cnat_timeout_db_delete ( cnat_key_t  t_key)

Definition at line 2453 of file cnat_db_v2.c.

static void cnat_timeout_db_hash_add ( cnat_timeout_db_entry_t t_entry)
static

Definition at line 2385 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

static u32 cnat_timeout_db_hash_lookup ( cnat_key_t  t_key)
static

Definition at line 2249 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

cnat_user_db_entry_t* cnat_user_db_create_entry ( cnat_db_key_bucket_t uki,
u32  portmap_index 
)

Definition at line 620 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

void cnat_user_db_delete ( cnat_user_db_entry_t up)

Definition at line 535 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

cnat_user_db_entry_t* cnat_user_db_lookup_entry ( cnat_db_key_bucket_t uki)

Definition at line 595 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

cnat_main_db_entry_t * dslite_create_main_db_entry_and_hash ( dslite_db_key_bucket_t ki,
cnat_db_key_bucket_t ko,
cnat_user_db_entry_t udb 
)

Definition at line 2930 of file cnat_db_v2.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void dslite_db_debug_error ( dslite_db_key_bucket_t u_ki,
cnat_errno_t  error 
)

Definition at line 392 of file cnat_db_v2.c.

+ Here is the call graph for this function:

cnat_main_db_entry_t* dslite_get_main_db_entry_v2 ( dslite_db_key_bucket_t ki,
port_pair_t  port_pair_type,
port_type_t  port_type,
cnat_gen_icmp_info info,
dslite_table_entry_t dslite_entry_ptr,
cnat_key_t dest_info 
)

Definition at line 3047 of file cnat_db_v2.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

cnat_main_db_entry_t * dslite_main_db_lookup_entry ( dslite_db_key_bucket_t ki)

Definition at line 2821 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

cnat_user_db_entry_t * dslite_user_db_create_entry ( dslite_db_key_bucket_t uki,
u32  portmap_index 
)

Definition at line 2897 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

cnat_user_db_entry_t * dslite_user_db_lookup_entry ( dslite_db_key_bucket_t uki)

Definition at line 2863 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

void handle_cnat_port_exceeded_logging ( cnat_user_db_entry_t udb,
cnat_key_t key,
cnat_vrfmap_t vrfmap 
)

Definition at line 3028 of file cnat_db_v2.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void log_port_alloc_error ( cnat_errno_t  error,
cnat_key_t k 
)
static

Definition at line 335 of file cnat_db_v2.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void port_exceeded_msg_log ( u32  src_addr,
u16  i_vrf 
)

Definition at line 314 of file cnat_db_v2.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void pptp_clear_all_channels ( cnat_main_db_entry_t db)
inlinestatic

Definition at line 709 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

void pptp_remove_channel_from_tunnel ( cnat_main_db_entry_t db)

Definition at line 733 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

u16 query_and_update_db_timeout ( void db,
u8  db_type 
)

Definition at line 2285 of file cnat_db_v2.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

cgse_nat_db_entry_t* cgse_nat_db

Definition at line 200 of file cnat_db_v2.c.

cgse_nat_session_db_entry_t* cgse_session_db

Definition at line 202 of file cnat_db_v2.c.

cgse_nat_user_db_entry_t* cgse_user_db

Definition at line 201 of file cnat_db_v2.c.

u8 cnat_db_init_done = 0

Definition at line 43 of file cnat_db_v2.c.

char* cnat_db_v2_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}
#define foreach_cnat_db_v2_error
Definition: cnat_db_v2.c:64

Definition at line 74 of file cnat_db_v2.c.

cnat_db_v2_main_t cnat_db_v2_main

Definition at line 54 of file cnat_db_v2.c.

cnat_global_counters_t cnat_global_counters

Definition at line 184 of file cnat_db_v2.c.

index_slist_t* cnat_in2out_hash

Definition at line 190 of file cnat_db_v2.c.

cnat_main_db_entry_t* cnat_main_db

Definition at line 195 of file cnat_db_v2.c.

cnat_vrfmap_t* cnat_map_by_vrf

Definition at line 212 of file cnat_db_v2.c.

index_slist_t* cnat_out2in_hash

Definition at line 189 of file cnat_db_v2.c.

cnat_session_entry_t* cnat_session_db

Definition at line 197 of file cnat_db_v2.c.

index_slist_t* cnat_session_hash

Definition at line 193 of file cnat_db_v2.c.

cnat_timeout_db_entry_t* cnat_timeout_db

Definition at line 198 of file cnat_db_v2.c.

index_slist_t* cnat_timeout_hash

Definition at line 192 of file cnat_db_v2.c.

cnat_user_db_entry_t* cnat_user_db

Definition at line 196 of file cnat_db_v2.c.

index_slist_t* cnat_user_hash

Definition at line 191 of file cnat_db_v2.c.

u64 in2out_drops_port_limit_exceeded

Definition at line 222 of file cnat_db_v2.c.

u64 in2out_drops_resource_depletion

Definition at line 224 of file cnat_db_v2.c.

u64 in2out_drops_system_limit_reached

Definition at line 223 of file cnat_db_v2.c.

u32 last_log_timestamp = 0

Definition at line 185 of file cnat_db_v2.c.

u32 last_user_dyn_port_exc_timestamp = 0

Definition at line 186 of file cnat_db_v2.c.

u32 last_user_stat_port_exc_timestamp = 0

Definition at line 187 of file cnat_db_v2.c.

Definition at line 206 of file cnat_db_v2.c.

nat44_dslite_common_stats_t nat44_dslite_common_stats[255]

Definition at line 204 of file cnat_db_v2.c.

nat44_dslite_global_stats_t nat44_dslite_global_stats[2]

Definition at line 205 of file cnat_db_v2.c.

u32 no_sessions

Definition at line 226 of file cnat_db_v2.c.

u64 no_translation_entry_drops

Definition at line 225 of file cnat_db_v2.c.

f64 port_log_timestamps[HASH_TABLE_SIZE]

Definition at line 312 of file cnat_db_v2.c.

Definition at line 220 of file cnat_db_v2.c.

u16 vrf_map_array[CNAT_MAX_VRFMAP_ENTRIES]

Definition at line 219 of file cnat_db_v2.c.

cnat_ingress_vrfid_name_entry vrfid_name_map[MAX_VRFID] = {{0}}

Definition at line 221 of file cnat_db_v2.c.