FD.io VPP  v16.09
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:261
#define PREDICT_FALSE(x)
Definition: cnat_db_v2.c:67

Definition at line 266 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:379
#define CNAT_DEBUG_ERR_ICMP
Definition: cnat_cli.h:92

Definition at line 241 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:66
#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:226
cnat_icmp_msg_t icmp_msg_gen_allowed()
Definition: cnat_syslog.c:448

Definition at line 234 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:398
#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 251 of file cnat_db_v2.c.

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

Definition at line 70 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 261 of file cnat_db_v2.c.

#define PREDICT_FALSE (   x)    (x)

Definition at line 67 of file cnat_db_v2.c.

#define PREDICT_TRUE (   x)    (x)

Definition at line 66 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 73 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 1083 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 653 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 2643 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 1669 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 379 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 417 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 433 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 482 of file cnat_db_v2.c.

+ Here is the caller graph for this function:

void cnat_db_v2_init ( void  )

Definition at line 3675 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_main_db_entry_v2 ( cnat_main_db_entry_t ep)

Definition at line 763 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 2869 of file cnat_db_v2.c.

+ 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 2743 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 2771 of file cnat_db_v2.c.

+ Here is the call 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 1647 of file cnat_db_v2.c.

+ 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 1027 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 515 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 996 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 2583 of file cnat_db_v2.c.

void cnat_session_db_hash_delete ( cnat_session_entry_t ep)

Definition at line 2545 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 2612 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 87 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 2450 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 2496 of file cnat_db_v2.c.

static void cnat_timeout_db_hash_add ( cnat_timeout_db_entry_t t_entry)
static

Definition at line 2425 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 2289 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 628 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 541 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 603 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 2989 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 398 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 3109 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 2877 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 2953 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 2919 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 3090 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 341 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 320 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 719 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 743 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 2325 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 206 of file cnat_db_v2.c.

cgse_nat_session_db_entry_t* cgse_session_db

Definition at line 208 of file cnat_db_v2.c.

cgse_nat_user_db_entry_t* cgse_user_db

Definition at line 207 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:70

Definition at line 80 of file cnat_db_v2.c.

cnat_db_v2_main_t cnat_db_v2_main

Definition at line 60 of file cnat_db_v2.c.

cnat_global_counters_t cnat_global_counters

Definition at line 190 of file cnat_db_v2.c.

index_slist_t* cnat_in2out_hash

Definition at line 196 of file cnat_db_v2.c.

cnat_main_db_entry_t* cnat_main_db

Definition at line 201 of file cnat_db_v2.c.

cnat_vrfmap_t* cnat_map_by_vrf

Definition at line 218 of file cnat_db_v2.c.

index_slist_t* cnat_out2in_hash

Definition at line 195 of file cnat_db_v2.c.

cnat_session_entry_t* cnat_session_db

Definition at line 203 of file cnat_db_v2.c.

index_slist_t* cnat_session_hash

Definition at line 199 of file cnat_db_v2.c.

cnat_timeout_db_entry_t* cnat_timeout_db

Definition at line 204 of file cnat_db_v2.c.

index_slist_t* cnat_timeout_hash

Definition at line 198 of file cnat_db_v2.c.

cnat_user_db_entry_t* cnat_user_db

Definition at line 202 of file cnat_db_v2.c.

index_slist_t* cnat_user_hash

Definition at line 197 of file cnat_db_v2.c.

u64 in2out_drops_port_limit_exceeded

Definition at line 228 of file cnat_db_v2.c.

u64 in2out_drops_resource_depletion

Definition at line 230 of file cnat_db_v2.c.

u64 in2out_drops_system_limit_reached

Definition at line 229 of file cnat_db_v2.c.

u32 last_log_timestamp = 0

Definition at line 191 of file cnat_db_v2.c.

u32 last_user_dyn_port_exc_timestamp = 0

Definition at line 192 of file cnat_db_v2.c.

u32 last_user_stat_port_exc_timestamp = 0

Definition at line 193 of file cnat_db_v2.c.

Definition at line 212 of file cnat_db_v2.c.

nat44_dslite_common_stats_t nat44_dslite_common_stats[255]

Definition at line 210 of file cnat_db_v2.c.

nat44_dslite_global_stats_t nat44_dslite_global_stats[2]

Definition at line 211 of file cnat_db_v2.c.

u32 no_sessions

Definition at line 232 of file cnat_db_v2.c.

u64 no_translation_entry_drops

Definition at line 231 of file cnat_db_v2.c.

f64 port_log_timestamps[HASH_TABLE_SIZE]

Definition at line 318 of file cnat_db_v2.c.

Definition at line 226 of file cnat_db_v2.c.

u16 vrf_map_array[CNAT_MAX_VRFMAP_ENTRIES]

Definition at line 225 of file cnat_db_v2.c.

cnat_ingress_vrfid_name_entry vrfid_name_map[MAX_VRFID] = {{0}}

Definition at line 227 of file cnat_db_v2.c.