27 #define VRF_NAME_LEN_STORED 12 29 typedef struct _cnat_svi_params_entry {
46 typedef struct _cnat_ingress_vrfid_name_entry {
52 #define HASH_ENHANCE 4 54 #define CNAT_DB_SIZE (PLATFORM_MAX_NAT_ENTRIES / PLATFORM_CNAT_INSTS) 55 #define CNAT_MAIN_HASH_SIZE (HASH_ENHANCE * PLATFORM_CNAT_MAIN_PRELIM_HASH_SIZE) 56 #define CNAT_MAIN_HASH_MASK (CNAT_MAIN_HASH_SIZE-1) 58 #define CNAT_USER_DB_SIZE (PLATFORM_MAX_USER_ENTRIES / PLATFORM_CNAT_INSTS) 59 #define CNAT_USER_HASH_SIZE (HASH_ENHANCE * PLATFORM_CNAT_USER_PRELIM_HASH_SIZE) 60 #define CNAT_USER_HASH_MASK (CNAT_USER_HASH_SIZE-1) 62 #define CNAT_SESSION_DB_SIZE (PLATFORM_MAX_NAT_ENTRIES / PLATFORM_CNAT_INSTS) 63 #define CNAT_SESSION_HASH_SIZE (HASH_ENHANCE * PLATFORM_CNAT_MAIN_PRELIM_HASH_SIZE) 64 #define CNAT_SESSION_HASH_MASK (CNAT_SESSION_HASH_SIZE-1) 67 #define CNAT_MAX_SESSIONS_PER_BIB 0xFFFF 69 #define NUM_BITS_IN_UWORD (8*sizeof(uword)) 72 #define CNAT_TIMEOUT_HASH_SIZE 1024 73 #define CNAT_TIMEOUT_HASH_MASK (CNAT_TIMEOUT_HASH_SIZE - 1) 74 #define CNAT_TIMEOUT_FULL_MASK 0xFFFFFFFFFFFFFFFF 75 #define CNAT_TIMEOUT_IPPROT_MASK PLATFORM_CNAT_TIMEOUT_IPPROT_MASK 76 #define CNAT_TIMEOUT_PORTPROT_MASK PLATFORM_CNAT_TIMEOUT_PORTPROT_MASK 91 #define CNAT_INVALID_PROTO 0x0000 92 #define CNAT_PPTP 0x0000 93 #define CNAT_UDP 0x4000 94 #define CNAT_TCP 0x8000 95 #define CNAT_ICMP 0xc000 96 #define CNAT_VRF_MASK 0x3fff 97 #define CNAT_PRO_MASK 0xc000 98 #define CNAT_PRO_SHIFT 14 103 #define CNAT_MAX_VRFMAP_ENTRIES (CNAT_VRF_MASK + 1) 160 #define CNAT_DB_FLAG_PORT_PAIR (1<<0) 161 #define CNAT_DB_FLAG_TCP_ACTIVE (1<<1) 162 #define CNAT_DB_FLAG_ENTRY_FREE (1<<2) 163 #define CNAT_DB_FLAG_UDP_ACTIVE (1<<3) 164 #define CNAT_DB_FLAG_STATIC_PORT (1<<4) 166 #define CNAT_DB_FLAG_ALG_ENTRY (1<<5) 170 #define CNAT_DB_FLAG_PPTP_TUNNEL_INIT (1<<6) 171 #define CNAT_DB_FLAG_PPTP_TUNNEL_ACTIVE (1<<7) 174 #define CNAT_DB_FLAG_PPTP_GRE_ENTRY (1<<8) 177 #define CNAT_DB_FLAG_PCPI (1<<9) 178 #define CNAT_DB_FLAG_PCPE (1<<10) 179 #define CNAT_PCP_FLAG (CNAT_DB_FLAG_PCPI | CNAT_DB_FLAG_PCPE) 181 #define CNAT_TAC_SEQ_MISMATCH (1<<11) 183 #define CNAT_DB_FLAG_ALG_CTRL_FLOW (1<<12) 186 #define CNAT_DB_FLAG_TCP_CLOSING (1<<13) 188 #define CNAT_DB_DSLITE_FLAG (1<<14) 189 #define CNAT_DB_NAT64_FLAG (1<<15) 234 struct tcp_seq_chk_t {
297 #define CNAT_USER_DB_NAT44_FLAG 0 298 #define CNAT_USER_DB_NAT64_FLAG 1 299 #define CNAT_USER_DB_DSLITE_FLAG 2 300 #define CNAT_USER_DB_PORT_LIMIT_EXCEEDED 0X80 318 #ifndef NO_BULK_LOGGING 419 #define INVALID_UIDX 0xffff 420 #define INVALID_VRFID 0xffffffff 434 #ifndef NO_BULK_LOGGING 456 #define CNAT_SET_VRFMAP_NFV9_LOGGING_INDEX(logging_index, i_vrf) \ 458 cnat_nfv9_logging_info_t *my_nfv9_logging_info = 0; \ 459 pool_foreach (my_nfv9_logging_info, cnat_nfv9_logging_info, ({ \ 460 if (my_nfv9_logging_info->i_vrf == i_vrf) { \ 461 logging_index = my_nfv9_logging_info - cnat_nfv9_logging_info; \ 506 #define VRF_MAP_ENTRY_EMPTY 0xffff 536 #define CNAT_V4_GET_HASH(key64, hash, mask) \ 538 b = c = 0x9e3779b97f4a7c13LL; \ 540 hash_mix64(a, b, c); \ 543 #define CNAT_V4_GET_SESSION_HASH(main_index, in_addr, port, vrf, hash, mask) \ 544 a = main_index ^ in_addr ^ port ^ vrf; \ 545 b = c = 0x9e3779b9; \ 547 hash_mix32(a, b, c); \ 550 #define CNAT_V4_GET_FRAG_HASH(key64, key32, hash, mask) \ 553 c = 0x9e3779b97f4a7c13LL; \ 554 hash_mix64(a, b, c); \ 557 #define CNAT_DB_UPDATE_IN2OUT_TIMER \ 558 db->entry_expires = cnat_current_time; \ 561 #define CNAT_DB_TIMEOUT_RST(db) \ 562 if(PREDICT_TRUE(db->entry_expires != 0 )) \ 563 db->entry_expires = cnat_current_time; 565 #define DEBUG_I2O_DROP(debug_flag) \ 566 if (debug_i_flag & debug_flag) { \ 567 cnat_db_debug_i2o_drop(&ki); \ 626 #define MAIN_DB_TYPE 0 627 #define SESSION_DB_TYPE 1 653 u32 session_head_index,
684 #define NAT44_STATS 0 685 #define DSLITE_STATS 1 690 #define NAT44_COMMON_STATS nat44_dslite_common_stats[NAT44_RESERVED_INST_ID] 691 #define NAT44_GLOBAL_STATS nat44_dslite_global_stats[NAT44_STATS] 692 #define DSLITE_GLOBAL_STATS nat44_dslite_global_stats[DSLITE_STATS] 693 #define SESSION_LOG_ENABLE 1 694 #define ALG_ENABLED_DB(db) \ 695 ((db->flags & CNAT_PCP_FLAG) || \ 696 (db->flags & CNAT_DB_FLAG_ALG_CTRL_FLOW) || \ 697 (db->flags & (CNAT_DB_FLAG_PPTP_TUNNEL_INIT | \ 698 CNAT_DB_FLAG_PPTP_TUNNEL_ACTIVE)))
u64 in2out_drops_port_limit_exceeded
u32 num_dynamic_translations
cnat_main_db_entry_t * cnat_main_db
u8 pad[3]
log2 (size of the packing page block)
u16 query_and_update_db_timeout(void *db, u8 db_type)
cnat_session_entry_t * cnat_create_session_db_entry(cnat_key_t *ko, cnat_main_db_entry_t *bdb, u8 log)
u64 v4_to_v6_out2in_session_create_count
u64 v4_to_v6_tcp_seq_mismatch_drop_count
u32 num_static_translations
u64 no_translation_entry_drops
u64 nfv9_logging_context_buffer_allocation_fail_count
cnat_vrfmap_t * cnat_portmap_by_vrf
cnat_session_entry_t * cnat_session_db
u64 v4_to_v6_end_point_filter_drop_count
void cnat_delete_main_db_entry(cnat_main_db_entry_t *ep)
u64 nfv9_logging_context_creation_fail_count
u64 drops_sessiondb_limit_exceeded
index_slist_t in2out_hash
cnat_db_create_policy_t policy
cnat_session_entry_t * cnat_handle_1to2_session(cnat_main_db_entry_t *mdb, cnat_key_t *dest_info)
cnat_portmap_v2_t * portmap_list
u16 cnat_timeout_db_create(cnat_timeout_t t_entry)
index_slist_t out2in_hash
index_slist_t * cnat_in2out_hash
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)
#define BULK_RANGE_CACHE_SIZE
void cnat_if_num_hash_table_dump(void)
cnat_global_counters_t cnat_global_counters
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)
u16 * cnat_portmap_indices_by_vrf
#define CNAT_MAX_VRFMAP_ENTRIES
index_slist_t * cnat_user_hash
u16 ** cnat_portmaps_inuse
cnat_svi_params_entry svi_params_array[CNAT_MAX_VRFMAP_ENTRIES]
void cnat_user_db_delete(cnat_user_db_entry_t *up)
u16 vrf_map_array[CNAT_MAX_VRFMAP_ENTRIES]
index_slist_t cnat_session_hash
u32 translation_delete_count
void cnat_db_in2out_hash_delete(cnat_main_db_entry_t *ep, cnat_user_db_entry_t *up)
cnat_user_db_entry_t * cnat_user_db
u64 nfv9_downstream_constipation_count
cnat_portmap_v2_t nat64_portmap_v2_t
void cnat_timeout_db_delete(cnat_key_t t_key)
cnat_timeout_db_entry_t * cnat_timeout_db
u32 translation_list_head_index
void cnat_main_db_entry_dump(cnat_main_db_entry_t *db)
void cnat_main_db_entry_delete(cnat_main_db_entry_t *ep)
void cnat_db_debug_i2o_drop(cnat_db_key_bucket_t *ki)
bulk_alloc_size_t bulk_size
#define VRF_NAME_LEN_STORED
u32 out2in_forwarding_count
u32 translation_create_count
cnat_ingress_vrfid_name_entry vrfid_name_map[MAX_VRFID]
cnat_main_db_entry_t * cnat_main_db_lookup_entry_out2in(cnat_db_key_bucket_t *ko)
void cnat_add_dest_n_log(cnat_main_db_entry_t *mdb, cnat_key_t *dest_info)
index_slist_t * cnat_session_hash
cnat_main_db_entry_t * cnat_get_main_db_entry(cnat_db_key_bucket_t *ki, port_pair_t port_type, cnat_errno_t *error, cnat_user_db_entry_t **user_db_entry)
u64 v4_to_v6_tcp_seq_mismatch_count
cnat_vrfmap_t nat64_vrfmap_t
index_slist_t * cnat_out2in_hash
cnat_session_entry_t * cnat_session_db_lookup_entry(cnat_key_t *ko, u32 main_db_index)
u64 in2out_drops_system_limit_reached
cnat_portmap_t ** cnat_portmaps
void cnat_delete_main_db_entry_v2(cnat_main_db_entry_t *ep)
cnat_vrfmap_t * cnat_map_by_vrf
struct _cnat_svi_params_entry cnat_svi_params_entry
void cnat_dest_update_main2session(cnat_main_db_entry_t *mdb, cnat_session_entry_t *sdb)
cnat_user_db_entry_t * cnat_user_db_lookup_entry(cnat_db_key_bucket_t *uki)
cnat_main_db_entry_t * db
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)
void cnat_db_out2in_hash_delete(cnat_main_db_entry_t *ep)
cnat_session_entry_t * cnat_session_db_edm_lookup_entry(cnat_key_t *ko, u32 session_head_index, u32 main_db_index)
cnat_user_db_entry_t * cnat_user_db_create_entry(cnat_db_key_bucket_t *uki, u32 portmap_index)
u64 nfv9_logging_context_creation_deferred_count
struct _cnat_ingress_vrfid_name_entry cnat_ingress_vrfid_name_entry
index_slist_t * cnat_timeout_hash
cnat_main_db_entry_t * cnat_main_db_lookup_entry(cnat_db_key_bucket_t *ki)
port_pair_t pair_of_ports
cnat_main_db_entry_t * cnat_main_db_create(cnat_db_create_args_t *a)
u64 in2out_drops_resource_depletion
cnat_icmp_msg_t gen_icmp_msg