40 #define HASH_TABLE_SIZE 8192 // hash table size 41 #define THROTTLE_TIME 180 // throttle time value for out of port msg/user 60 #define PREDICT_TRUE(x) (x) 61 #define PREDICT_FALSE(x) (x) 64 #define foreach_cnat_db_v2_error \ 65 _(DROP, "error-drop packets") 68 #define _(sym,str) CNAT_DB_V2_##sym, 75 #define _(sym,string) string, 84 u32 this_start_addr, this_end_addr, this_addr,
new;
92 this_start_addr = start_addr;
93 this_end_addr = end_addr;
100 new = (this_end_addr - this_start_addr) + 1;
102 pm = *port_map_holder;
104 #if DEBUG_NOT_COMMENTED 105 printf(
"this_start_addr = 0x%08X, this_end_addr = 0x%08X, Num Addr = %d\n",
106 this_start_addr, this_end_addr,
new);
107 printf(
"pm_len = %d\n", pm_len);
111 for(i = 0; i< pm_len; i++) {
113 printf(
"address pool with addr 0x%08X exists\n", this_start_addr);
125 printf(
"address pool size (%d) would cross permissible limit (%u) \n",
134 #if DEBUG_NOT_COMMENTED 135 printf(
"total_address_pool_allocated changed from %d to %d (added %d)",
138 printf(
"vec add is ok\n");
141 memset(my_pm, 0,
new*
sizeof(*my_pm));
142 this_addr = this_start_addr;
145 while (this_addr <= this_end_addr) {
146 #if DEBUG_NOT_COMMENTED 147 printf(
"loop %d: this addr = 0x%08X\n", loop_count+1, this_addr);
153 memset(my_pm->
bm, 0xff,
163 if (loop_count !=
new) {
164 printf(
"Mismatch in loop_count (%d) != new (%d)\n",
168 *port_map_holder = pm;
170 #if DEBUG_NOT_COMMENTED 171 printf(
"revised pm len %d\n",
vec_len(*port_map_holder));
185 u32 last_log_timestamp = 0;
186 u32 last_user_dyn_port_exc_timestamp = 0;
187 u32 last_user_stat_port_exc_timestamp = 0;
228 #define CNAT_SET_ICMP_MSG_INFO \ 229 if (PREDICT_TRUE((my_vrfmap->i_vrf < CNAT_MAX_VRFMAP_ENTRIES) && \ 230 (svi_params_array[my_vrfmap->i_vrf].ipv4_addr))) { \ 231 info->gen_icmp_msg = icmp_msg_gen_allowed(); \ 232 info->svi_addr = svi_params_array[my_vrfmap->i_vrf].ipv4_addr; \ 235 #define CNAT_DEBUG_INSIDE_ERR(err) \ 236 if (((protocol == CNAT_UDP) && \ 237 (debug_i_flag & CNAT_DEBUG_ERR_UDP)) || \ 238 ((protocol == CNAT_TCP) && \ 239 (debug_i_flag & CNAT_DEBUG_ERR_TCP)) || \ 240 ((protocol == CNAT_ICMP) && \ 241 (debug_i_flag & CNAT_DEBUG_ERR_ICMP))) { \ 242 cnat_db_debug_error(&u_ki, err); \ 245 #define DSLITE_DEBUG_INSIDE_ERR(err) \ 246 if (((protocol == CNAT_UDP) && \ 247 (debug_i_flag & CNAT_DEBUG_ERR_UDP)) || \ 248 ((protocol == CNAT_TCP) && \ 249 (debug_i_flag & CNAT_DEBUG_ERR_TCP)) || \ 250 ((protocol == CNAT_ICMP) && \ 251 (debug_i_flag & CNAT_DEBUG_ERR_ICMP))) { \ 252 dslite_db_debug_error(&u_ki, err); \ 255 #define PORT_LIMIT_LOW_THRESHOLD_FOR_SYSLOG 7 260 #define CHECK_CLEAR_PORT_LIMIT_EXCEED_FLAG(udb, max_limit) \ 261 if(PREDICT_FALSE(udb->flags & CNAT_USER_DB_PORT_LIMIT_EXCEEDED)) { \ 262 if(udb->ntranslations < \ 263 ((max_limit/10)*PORT_LIMIT_LOW_THRESHOLD_FOR_SYSLOG) && \ 265 udb->flags = udb->flags & (~CNAT_USER_DB_PORT_LIMIT_EXCEEDED); \ 271 static char *debug_db_error[] = {
277 "bad in use for any",
279 "invalid index for direct",
280 "deleted addr for direct",
281 "bad in use for direct",
282 "not found for direct",
287 "bad static port request",
292 "invalid payload size",
294 "bulk single failure",
296 "xlat v6 prefix invalid",
297 "xlat v4 prefix invalid",
298 "xlat tcp mss invalid",
300 "6rd v4 tunnel src invalid",
301 "6rd v6 prefix invalid",
302 "6rd v6 BR unicast invalid",
303 "6rd v4 prefix masklen invalid",
304 "6rd v4 suffix masklen invalid",
305 "6rd v4 combo masklen invalid",
306 "6rd tunnel mtu invalid",
307 "6rd tunnel ttl invalid",
308 "6rd tunnel tos invalid",
317 f64 current_timestamp;
323 hash_value = ((src_addr >> 16) ^ ((src_addr & 0xffff) ^ i_vrf)) % (1024*8);
326 u32 arg[2] = {i_vrf, src_addr};
328 port_log_timestamps[hash_value] = current_timestamp;
379 #ifdef DEBUG_PRINTF_ENABLED 381 "for i-vrf 0x%x addr 0x%x port 0x%x\n",
382 debug_db_error[error], u_ki->
k.
k.
vrf,
398 #ifdef DEBUG_PRINTF_ENABLED 400 "for i-vrf 0x%x addr 0x%x port 0x%x\n",
416 #ifdef DEBUG_PRINTF_ENABLED 442 DSLITE_PRINTF(1,
"Delete1 DSL main hash bucket ..%u\n", bucket);
446 DSLITE_PRINTF(1,
"Delete1 NAT44 main hash bucket ..%u\n", bucket);
453 index = cnat_in2out_hash[bucket].
next;
459 this = cnat_main_db + index;
470 index = this->in2out_hash.next;
471 }
while (index !=
EMPTY);
485 index = cnat_out2in_hash[bucket].
next;
491 this = cnat_main_db + index;
502 index = this->out2in_hash.next;
503 }
while (index !=
EMPTY);
525 db = cnat_main_db + index;
530 }
while (index !=
EMPTY);
556 DSLITE_PRINTF(1,
"Delete1 DSL user hash bucket ..%u\n", bucket);
560 DSLITE_PRINTF(1,
"Delete1 NAT44 user hash bucket ..%u\n", bucket);
565 DSLITE_PRINTF(1,
"Delete2 NAT44 user hash bucket ..%u\n", bucket);
568 index = cnat_user_hash[bucket].
next;
574 this = cnat_user_db + index;
585 index = this->user_hash.next;
586 }
while (index !=
EMPTY);
609 udb = cnat_user_db + index;
614 }
while (index !=
EMPTY);
626 memset(udb, 0,
sizeof(*udb));
636 #ifndef NO_BULK_LOGGING 652 memset(db, 0,
sizeof(*db));
674 (
u8 *)cnat_main_db,
sizeof(cnat_main_db[0]),
694 printf(
"\nMy_Instance_Number %d: Bucket %d, Db_Index %d",
696 printf(
"\nInside (VRF 0x%x, IP 0x%x, PORT 0x%x)",
698 printf(
"\nOutside (VRF 0x%x, IP 0x%x, PORT 0x%x)",
700 printf(
"\nUser Index %d, IP 0x%x",
712 u32 db_index, current_db_index;
720 while( db_index !=
EMPTY) {
721 temp_db = cnat_main_db + db_index;
725 == current_db_index)) {
756 u32 vrfmap_len, udb_len;
761 u16 static_port_range;
762 #ifndef NO_BULK_LOGGING 804 vrfmap_len =
vec_len(cnat_map_by_vrf);
805 udb_len =
vec_len(cnat_user_db);
813 #ifdef DEBUG_PRINTF_ENABLED 814 printf(
"invalid/unused user index in db %d\n", ep->
user_index);
828 DSLITE_PRINTF(3,
"NULL portmap list for dslite_id %u, state %u\n",
842 #ifdef DEBUG_PRINTF_ENABLED 843 printf(
"invalid vrfmap index in db\n");
860 #ifndef NO_BULK_LOGGING
861 , bulk_size, &nfv9_log_req
868 #ifndef NO_BULK_LOGGING
869 , bulk_size, &nfv9_log_req
882 #ifndef NO_BULK_LOGGING
890 #ifndef NO_BULK_LOGGING
905 #ifndef NO_BULK_LOGGING
911 cnat_syslog_ds_lite_mapping_delete(ep,
913 #ifndef NO_BULK_LOGGING
941 sizeof (cnat_main_db[0]),
951 my_pm = pm + my_index;
954 #ifdef DEBUG_PRINTF_IP_N_TO_1_ENABLED 956 "private_ip_users_count = %d",
997 db = cnat_main_db + index;
1002 }
while (index !=
EMPTY);
1018 u32 free_session = 0;
1111 u32 my_index, free_main, free_user;
1112 u32 current_timestamp;
1113 u16 my_vrfmap_index;
1114 u16 my_vrfmap_entry_found = 0;
1123 #ifndef NO_BULK_LOGGING 1195 my_vrfmap_index = vrf_map_array[u_ki.
k.
k.
vrf];
1196 my_vrfmap = cnat_map_by_vrf + my_vrfmap_index;
1251 in2out_drops_port_limit_exceeded ++;
1270 in2out_drops_system_limit_reached ++;
1274 if (
PREDICT_FALSE((current_timestamp - last_log_timestamp) >
1277 last_log_timestamp = current_timestamp;
1281 printf(
"Limit reached : OLD USER");
1301 #ifndef NO_BULK_LOGGING
1318 #ifndef NO_BULK_LOGGING
1332 free_main = free_main - 1;
1336 in2out_drops_system_limit_reached ++;
1349 #ifndef NO_BULK_LOGGING
1364 in2out_drops_resource_depletion++;
1385 in2out_drops_port_limit_exceeded ++;
1417 in2out_drops_system_limit_reached ++;
1434 #ifndef NO_BULK_LOGGING
1450 #ifndef NO_BULK_LOGGING
1462 free_main = free_main - 1;
1466 in2out_drops_system_limit_reached ++;
1480 #ifndef NO_BULK_LOGGING
1494 in2out_drops_resource_depletion ++;
1505 my_pm = pm + my_index;
1508 #ifdef DEBUG_PRINTF_IP_N_TO_1_ENABLED 1510 "dynamic alloc private_ip_users_count = %d",
1515 "reached MAX PORTS_PER_ADDR");
1517 #ifndef NO_BULK_LOGGING 1561 #ifndef NO_BULK_LOGGING
1569 #ifndef NO_BULK_LOGGING
1608 #ifndef NO_BULK_LOGGING
1616 #ifndef NO_BULK_LOGGING
1643 u32 my_index, free_main, free_user;
1649 #ifndef NO_BULK_LOGGING 1675 #ifdef DEBUG_PRINTF_ENABLED 1676 printf(
"Same Static Port Exists ki 0x%16llx ko 0x%16llx",
1691 #ifdef DEBUG_PRINTF_ENABLED 1692 printf(
"Static Port Existing and Diff ki 0x%16llx ko 0x%16llx",
1703 #ifdef DEBUG_PRINTF_ENABLED 1704 printf(
"Deleting Dynamic entry ki 0x%16llx ko 0x%16llx",
1741 in2out_drops_system_limit_reached ++;
1744 printf(
"Limit reached : OLD USER");
1754 my_pm = pm + my_index;
1762 printf(
"Delete Main db entry and check for" 1763 " ipv4 address sanity pm add = 0x%x ip add = 0x%x\n",
1769 db = cnat_main_db + head;
1780 in2out_drops_resource_depletion ++;
1789 my_pm = pm + my_index;
1792 #ifdef DEBUG_PRINTF_IP_N_TO_1_ENABLED 1794 "static del n alloc private_ip_users_count = " 1799 "reached MAX PORTS_PER_ADDR");
1802 #ifndef NO_BULK_LOGGING 1828 printf (
"Static port alloc any\n");
1858 in2out_drops_system_limit_reached ++;
1872 in2out_drops_resource_depletion ++;
1882 my_pm = pm + my_index;
1885 #ifdef DEBUG_PRINTF_IP_N_TO_1_ENABLED 1887 "static alloc private_ip_users_count = %d",
1892 "reached MAX PORTS_PER_ADDR");
1895 #ifndef NO_BULK_LOGGING 1925 #ifndef NO_BULK_LOGGING
1932 #ifndef NO_BULK_LOGGING
1974 u32 my_index, free_main, free_user;
1981 #ifndef NO_BULK_LOGGING 1985 u16 my_vrfmap_index;
2009 #ifdef DEBUG_PRINTF_ENABLED 2010 printf(
"Same Static Port Exists ki 0x%16llx ko 0x%16llx",
2025 #ifdef DEBUG_PRINTF_ENABLED 2026 printf(
"Static Port Existing and Diff ki 0x%16llx ko 0x%16llx",
2037 #ifdef DEBUG_PRINTF_ENABLED 2038 printf(
"Deleting Dynamic entry ki 0x%16llx ko 0x%16llx",
2062 my_vrfmap = cnat_map_by_vrf + my_vrfmap_index;
2085 printf(
"Limit reached : OLD USER");
2095 my_pm = pm + my_index;
2103 printf(
"Delete Main db entry and check for" 2104 " ipv4 address sanity pm add = 0x%x ip add = 0x%x\n",
2110 db = cnat_main_db + head;
2130 #ifndef NO_BULK_LOGGING 2157 printf (
"Static port alloc any\n");
2210 #ifndef NO_BULK_LOGGING 2264 index = cnat_timeout_hash[index].
next;
2270 db = cnat_timeout_db + index;
2275 }
while (index !=
EMPTY);
2325 if(index ==
EMPTY) {
2327 t_search_key.
k.
ipv4 = 0;
2331 if(index ==
EMPTY) {
2338 t_search_key.
k.
port = 0;
2341 if(index !=
EMPTY) {
2342 #ifdef DEBUG_PRINTF_ENABLED 2343 printf(
"%s: ip only map sucess\n",
"query_and_update_db_timeout");
2347 #ifdef DEBUG_PRINTF_ENABLED 2348 printf(
"%s: port only map sucess\n",
"query_and_update_db_timeout");
2353 #ifdef DEBUG_PRINTF_ENABLED 2354 printf(
"%s: ip port map sucess\n",
"query_and_update_db_timeout");
2359 if(index ==
EMPTY) {
2366 #ifdef DEBUG_PRINTF_ENABLED 2367 printf(
"%s: No match\n",
"query_and_update_db_timeout");
2371 timeout_db_entry = cnat_timeout_db + index;
2400 index = cnat_timeout_hash[bucket].
next;
2421 if(db_index !=
EMPTY) {
2423 db = cnat_timeout_db + db_index;
2439 memset(db, 0,
sizeof(*db));
2469 index = cnat_timeout_hash[bucket].
next;
2471 if(index ==
EMPTY)
return;
2475 this = cnat_timeout_db + index;
2480 cnat_timeout_hash[bucket].
next = this->t_hash.next;
2489 index = this->t_hash.next;
2490 }
while (index !=
EMPTY);
2492 if(index ==
EMPTY)
return;
2510 index = cnat_session_hash[bucket].
next;
2516 this = cnat_session_db + index;
2519 cnat_session_hash[bucket].
next =
2529 index = this->cnat_session_hash.
next;
2530 }
while (index !=
EMPTY);
2544 index = session_head_index;
2550 db = cnat_session_db + index;
2558 }
while (index !=
EMPTY);
2576 index = cnat_session_hash[bucket].
next;
2582 db = cnat_session_db + index;
2591 }
while (index !=
EMPTY);
2601 u32 db_index, bucket_out;
2633 memset(db, 0,
sizeof(*db));
2660 (
u8 *)cnat_session_db,
sizeof(cnat_session_db[0]),
2673 cnat_session_hash[bucket_out].
next;
2674 cnat_session_hash[bucket_out].
next = db_index;
2690 nat44_dslite_common_stats[instance].
sessions++;
2744 u32 session_db_index;
2758 bdb_len =
vec_len(cnat_main_db);
2766 #ifdef DEBUG_PRINTF_ENABLED 2767 printf(
"invalid/unused user index in db %d\n", ep->
main_db_index);
2779 sizeof (cnat_session_db[0]),
2815 nat44_dslite_common_stats[instance].
sessions--;
2845 db = cnat_main_db + index;
2856 }
while (index !=
EMPTY);
2880 udb = cnat_user_db + index;
2890 }
while (index !=
EMPTY);
2903 memset(udb, 0,
sizeof(*udb));
2921 #ifndef NO_BULK_LOGGING 2947 memset(db, 0,
sizeof(*db));
2971 (
u8 *)cnat_main_db,
sizeof(cnat_main_db[0]),
2983 cnat_out2in_hash[ko->
bucket].
next = db_index;
2988 cnat_in2out_hash[ki->
bucket].
next = db_index;
2990 DSLITE_PRINTF(1,
"Create main db and hash..%u %u %u %u %x\n",
2995 printf(
"\nMy_Instance_Number %d: Bucket %d, Db_Index %d",
2997 printf(
"\nInside (VRF 0x%x, IP 0x%x, PORT 0x%x)",
2999 printf(
"\nOutside (VRF 0x%x, IP 0x%x, PORT 0x%x)",
3001 printf(
"\nUser Index %d, IP 0x%x",
3010 static inline void handle_dslite_port_exceeded_logging(
3076 u32 my_index, free_main, free_user;
3077 u32 current_timestamp;
3079 u16 my_vrfmap_index;
3086 #ifndef NO_BULK_LOGGING 3154 #ifdef DSLITE_USER_IPV4 3171 my_vrfmap = cnat_map_by_vrf + my_vrfmap_index;
3175 my_vrfmap_index = vrf_map_array[u_ki.k.k.vrf];
3176 my_vrfmap = cnat_map_by_vrf + my_vrfmap_index;
3179 (my_vrfmap->
i_vrf == u_ki.k.k.vrf));
3182 u32 arr[] = {ki->k.k.vrf, ki->k.k.ipv4, ki->k.k.port};
3184 (my_vrfmap->
i_vrf == u_ki.k.k.vrf)) {
3206 ko.
k.
k.
vrf = dslite_entry_ptr->
o_vrf | protocol;
3235 handle_dslite_port_exceeded_logging(udb, &u_ki.
dk, dslite_entry_ptr);
3255 if (
PREDICT_FALSE((current_timestamp - last_log_timestamp) >
3258 last_log_timestamp = current_timestamp;
3262 printf(
"Limit reached : OLD USER");
3282 #ifndef NO_BULK_LOGGING
3298 #ifndef NO_BULK_LOGGING
3312 free_main = free_main - 1;
3330 #ifndef NO_BULK_LOGGING
3411 #ifndef NO_BULK_LOGGING
3427 #ifndef NO_BULK_LOGGING
3443 free_main = free_main - 1;
3461 #ifndef NO_BULK_LOGGING
3488 #ifndef NO_BULK_LOGGING 3504 DSLITE_PRINTF(1,
"dslite_create_main_db_entry_and_hash done..\n");
3533 dslite_entry_ptr,
NULL);
3537 #ifndef NO_BULK_LOGGING
3545 #ifndef NO_BULK_LOGGING
3558 new_ki.k.k.port += 1;
3571 #ifndef NO_BULK_LOGGING 3593 .function = cnat_db_v2_node_fn,
3594 .name =
"vcgn-db-v2",
3595 .vector_size =
sizeof (
u32),
3601 .n_next_nodes = CNAT_DB_V2_DROP,
3605 [CNAT_DB_V2_DROP] =
"error-drop",
3629 for(i=0; i< n; i++) {
3633 for(i=0; i< n; i++) {
3634 pool_put(cgse_nat_db, cgse_nat_db + i);
3646 printf(
"DBL Support Not exist\n");
3654 if (n % NUM_BITS_IN_UWORD)
3658 for(i=0; i< n; i++) {
3659 pool_get(cgse_session_db, comb_session);
3662 for(i=0; i< n; i++) {
3663 pool_put(cgse_session_db, cgse_session_db + i);
3678 if (n % NUM_BITS_IN_UWORD)
3682 for(i=0; i< n; i++) {
3686 for(i=0; i< n; i++) {
3687 pool_put(cgse_user_db, cgse_user_db + i);
3696 for(i=0; i< n; i++) {
3700 for(i=0; i< n; i++) {
3701 pool_put(cnat_timeout_db, cnat_timeout_db + i);
3712 cnat_db_init_done = 1;
3713 printf(
"CNAT DB init is successful\n");
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
u64 in2out_drops_port_limit_exceeded
u32 num_dynamic_translations
void cnat_nfv9_ds_lite_log_session_delete(cnat_main_db_entry_t *db, dslite_table_entry_t *dslite_entry, cnat_session_entry_t *sdb)
index_slist_t * cnat_out2in_hash
void cnat_add_dest_n_log(cnat_main_db_entry_t *mdb, cnat_key_t *dest_info)
sll srl srl sll sra u16x4 i
u32 total_address_pool_allocated
#define DSLITE_PRINTF(level,...)
u32 num_static_translations
cnat_main_db_entry_t * cnat_main_db_lookup_entry(cnat_db_key_bucket_t *ki)
#define foreach_cnat_db_v2_error
u32 private_ip_users_count
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
union cnat_main_db_entry_t::@164 alg
void dslite_db_debug_error(dslite_db_key_bucket_t *u_ki, cnat_errno_t error)
#define CNAT_USER_DB_NAT64_FLAG
#define CNAT_USER_DB_PORT_LIMIT_EXCEEDED
#define NAT44_RESERVED_INST_ID
cnat_user_db_entry_t * cnat_user_db
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)
cnat_timeout_db_entry_t * cnat_timeout_db
#define CNAT_DB_FLAG_PPTP_TUNNEL_INIT
void cnat_nfv9_ds_lite_mapping_delete(cnat_main_db_entry_t *db, dslite_table_entry_t *dslite_entry, int bulk_alloc)
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)
void cnat_user_db_delete(cnat_user_db_entry_t *up)
u16 cnat_static_port_range
#define NAT64_MAIN_DB_SIZE
#define CNAT_DB_FLAG_ALG_CTRL_FLOW
static void cnat_log_ds_lite_port_limit_exceeded(dslite_key_t *key, dslite_table_entry_t *dslite_entry_ptr)
cnat_session_entry_t * cnat_session_db
#define CNAT_TIMEOUT_HASH_SIZE
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
cnat_errno_t cnat_dynamic_port_alloc_rtsp_bulk(cnat_portmap_v2_t *pm, port_alloc_t atype, port_pair_t pair_type, u16 i_port, u32 *index, u32 *o_ipv4_address, u16 *o_port, u16 static_port_range, cnat_user_db_entry_t *udb, bulk_alloc_size_t bulk_size, int *nfv9_log_req, u32 *rseed_ip)
u64 drops_sessiondb_limit_exceeded
u16 cnat_main_db_max_ports_per_user
#define STRUCT_OFFSET_OF(t, f)
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 CNAT_MAIN_HASH_SIZE
index_slist_t in2out_hash
static void cnat_timeout_db_hash_add(cnat_timeout_db_entry_t *t_entry)
#define CNAT_DB_FLAG_STATIC_PORT
#define pool_is_free(P, E)
static void cnat_log_nat44_port_limit_exceeded(cnat_key_t *key, cnat_vrfmap_t *vrfmap)
void cnat_syslog_ds_lite_mapping_create(cnat_main_db_entry_t *db, dslite_table_entry_t *dslite_entry, cnat_session_entry_t *sdb, int bulk_alloc)
void cnat_nfv9_nat44_log_session_create(cnat_main_db_entry_t *db, cnat_session_entry_t *sdb, cnat_vrfmap_t *vrfmap)
#define CNAT_DB_FLAG_PORT_PAIR
void cnat_timeout_db_delete(cnat_key_t t_key)
cnat_errno_t cnat_static_port_alloc_v2_bulk(cnat_portmap_v2_t *pm, port_alloc_t atype, port_pair_t pair_type, u32 i_ipv4_address, u16 i_port, u32 *index, u32 *o_ipv4_address, u16 *o_port, u16 static_port_range, cnat_user_db_entry_t *udb, bulk_alloc_size_t bulk_size, int *nfv9_log_req, u16 ip_n_to_1)
always_inline vlib_main_t * vlib_get_main(void)
#define CNAT_MAX_SESSIONS_PER_BIB
cnat_portmap_v2_t * portmap_list
void cnat_delete_session_db_entry(cnat_session_entry_t *ep, u8 log)
cnat_session_entry_t * cnat_session_db_lookup_entry(cnat_key_t *ko, u32 main_db_index)
u16 cnat_main_db_max_ports_per_user
static void cnat_session_log_ds_lite_mapping_delete(cnat_main_db_entry_t *db, dslite_table_entry_t *dslite_entry, cnat_session_entry_t *sdb)
index_slist_t out2in_hash
#define CGSE_SVI_TYPE_INFRA
u16 query_and_update_db_timeout(void *db, u8 db_type)
#define CNAT_DB_FLAG_PPTP_GRE_ENTRY
void cnat_session_db_hash_delete(cnat_session_entry_t *ep)
#define CNAT_DB_TIMEOUT_RST(db)
void cnat_syslog_nat44_mapping_delete(cnat_main_db_entry_t *db, cnat_vrfmap_t *vrfmap, cnat_session_entry_t *sdb, int bulk_alloc)
u16 cnat_timeout_db_create(cnat_timeout_t t_entry)
cnat_main_db_entry_t * dslite_main_db_lookup_entry(dslite_db_key_bucket_t *ki)
u64 in2out_drops_system_limit_reached
void cnat_dest_update_session2main(cnat_main_db_entry_t *mdb, cnat_session_entry_t *sdb)
static void cnat_session_log_ds_lite_mapping_create(cnat_main_db_entry_t *db, dslite_table_entry_t *dslite_entry, cnat_session_entry_t *sdb)
int vlib_main(vlib_main_t *vm, unformat_input_t *input)
static void log_port_alloc_error(cnat_errno_t error, cnat_key_t *k)
#define CNAT_DB_NAT64_FLAG
#define CNAT_DEBUG_INSIDE_ERR(err)
union cnat_session_entry_t::@166 alg
u32 dslite_translation_create_count
static u32 cnat_timeout_db_hash_lookup(cnat_key_t t_key)
static char * cnat_db_v2_error_strings[]
u64 in2out_drops_port_limit_exceeded
cgse_nat_user_db_entry_t * cgse_user_db
#define CHECK_CLEAR_PORT_LIMIT_EXCEED_FLAG(udb, max_limit)
void cnat_dest_update_main2session(cnat_main_db_entry_t *mdb, cnat_session_entry_t *sdb)
cnat_errno_t cnat_mapped_static_port_alloc_v2_bulk(cnat_portmap_v2_t *pm, port_alloc_t atype, u32 *index, u32 ipv4_address, u16 port, cnat_user_db_entry_t *udb, bulk_alloc_size_t bulk_size, int *nfv9_log_req, u16 ip_n_to_1)
#define CNAT_DB_FLAG_ALG_ENTRY
#define CNAT_MAX_VRFMAP_ENTRIES
cnat_main_db_entry_t nat44_main_db
#define CNAT_SESSION_DB_SIZE
void cnat_db_in2out_hash_delete(cnat_main_db_entry_t *ep, cnat_user_db_entry_t *up)
dslite_table_entry_t * dslite_table_db_ptr
#define CNAT_TIMEOUT_HASH_MASK
cnat_user_db_entry_t nat44_user_db
void cnat_port_free_v2_bulk(cnat_portmap_v2_t *pm, int index, port_pair_t ptype, u16 base_port, cnat_user_db_entry_t *udb, u16 static_port_range, bulk_alloc_size_t bulk_size, int *nfv9_log_req)
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)
void cnat_nfv9_ds_lite_log_session_create(cnat_main_db_entry_t *db, dslite_table_entry_t *dslite_entry, cnat_session_entry_t *sdb)
void cnat_update_bulk_range_cache(cnat_user_db_entry_t *udb, u16 o_port, bulk_alloc_size_t bulk_size)
struct cnat_main_db_entry_t::@165::seq_pcp_t seq_pcp
void handle_cnat_port_exceeded_logging(cnat_user_db_entry_t *udb, cnat_key_t *key, cnat_vrfmap_t *vrfmap)
cnat_db_v2_main_t cnat_db_v2_main
#define CACHE_ALLOC_NO_LOG_REQUIRED
cnat_user_db_entry_t * dslite_user_db_lookup_entry(dslite_db_key_bucket_t *uki)
void cnat_db_debug_i2o_drop(cnat_db_key_bucket_t *ki)
index_slist_t cnat_session_hash
index_slist_t * cnat_session_hash
void cnat_nfv9_log_mapping_delete(cnat_main_db_entry_t *db, cnat_vrfmap_t *vrfmap, int bulk_alloc)
cnat_errno_t cnat_dynamic_port_alloc_v2_bulk(cnat_portmap_v2_t *pm, port_alloc_t atype, port_pair_t pair_type, u32 *index, u32 *o_ipv4_address, u16 *o_port, u16 static_port_range, cnat_user_db_entry_t *udb, bulk_alloc_size_t bulk_size, int *nfv9_log_req, u16 ip_n_to_1, u32 *rseed_ip)
#define CNAT_SESSION_HASH_MASK
cgse_nat_session_db_entry_t * cgse_session_db
always_inline uword clib_bitmap_get(uword *ai, uword i)
u32 translation_list_head_index
void cnat_nfv9_nat44_log_session_delete(cnat_main_db_entry_t *db, cnat_session_entry_t *sdb, cnat_vrfmap_t *vrfmap)
cnat_global_counters_t cnat_global_counters
cnat_portmap_v2_t * portmap_list
#define CNAT_DB_FLAG_PPTP_TUNNEL_ACTIVE
void cnat_main_db_entry_dump(cnat_main_db_entry_t *db)
void port_exceeded_msg_log(u32 src_addr, u16 i_vrf)
#define SESSION_LOG_ENABLE
cnat_main_db_entry_t * cnat_main_db
void cnat_db_v2_init(void)
void cnat_delete_main_db_entry_v2(cnat_main_db_entry_t *ep)
#define CNAT_DB_DSLITE_FLAG
cnat_main_db_entry_t * cnat_main_db_lookup_entry_out2in(cnat_db_key_bucket_t *ko)
#define BULKSIZE_FROM_VRFMAP(vrfmap)
#define STAT_PORT_RANGE_FROM_INST_PTR(inst)
#define CNAT_DB_FLAG_TCP_ACTIVE
#define BULK_ALLOC_NOT_ATTEMPTED
#define CNAT_DEBUG_GLOBAL_ALL
static void pptp_clear_all_channels(cnat_main_db_entry_t *db)
#define CNAT_SET_ICMP_MSG_INFO
index_slist_t * cnat_in2out_hash
cnat_session_entry_t * cnat_create_session_db_entry(cnat_key_t *ko, cnat_main_db_entry_t *bdb, u8 log)
vhost_vring_state_t state
cnat_session_entry_t * cnat_session_db_edm_lookup_entry(cnat_key_t *ko, u32 session_head_index, u32 main_db_index)
void cnat_nfv9_log_mapping_create(cnat_main_db_entry_t *db, cnat_vrfmap_t *vrfmap, int bulk_alloc)
u64 in2out_drops_system_limit_reached
#define CNAT_USER_DB_DSLITE_FLAG
index_slist_t * cnat_user_hash
#define VRF_MAP_ENTRY_EMPTY
always_inline pool_header_t * pool_header(void *v)
#define CNAT_USER_DB_SIZE
cgse_nat_db_entry_t * cgse_nat_db
void index_dlist_addtail(u32 head_index, u8 *vector, u32 elsize, u32 offset, u32 index_to_add)
#define NAT44_COMMON_STATS
#define DSLITE_DEBUG_INSIDE_ERR(err)
#define CNAT_V4_GET_SESSION_HASH(main_index, in_addr, port, vrf, hash, mask)
cnat_user_db_entry_t * cnat_user_db_lookup_entry(cnat_db_key_bucket_t *uki)
struct _cnat_svi_params_entry cnat_svi_params_entry
uword bm[(BITS_PER_INST+BITS(uword)-1)/BITS(uword)]
#define CNAT_MAIN_HASH_MASK
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define CNAT_TIMEOUT_FULL_MASK
#define CNAT_USER_HASH_SIZE
void cnat_table_entry_fill_map(u32 start_addr, u32 end_addr, cnat_portmap_v2_t **port_map_holder)
#define CNAT_USER_HASH_MASK
#define NUM_BITS_IN_UWORD
cnat_session_entry_t * cnat_handle_1to2_session(cnat_main_db_entry_t *mdb, cnat_key_t *dest_info)
#define DSLITE_V6_GET_HASH(in_key, hash, mask)
static void cnat_session_log_nat44_mapping_create(cnat_main_db_entry_t *db, cnat_session_entry_t *sdb, cnat_vrfmap_t *vrfmap)
u64 no_translation_entry_drops
cnat_user_db_entry_t * cnat_user_db_create_entry(cnat_db_key_bucket_t *uki, u32 portmap_index)
u64 in2out_drops_resource_depletion
cnat_user_db_entry_t * dslite_user_db_create_entry(dslite_db_key_bucket_t *uki, u32 portmap_index)
u32 translation_create_count
#define VLIB_REGISTER_NODE(x,...)
u32 translation_delete_count
void cnat_nfv9_ds_lite_mapping_create(cnat_main_db_entry_t *db, dslite_table_entry_t *dslite_entry, int bulk_alloc)
struct _cnat_ingress_vrfid_name_entry cnat_ingress_vrfid_name_entry
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)
always_inline f64 vlib_time_now(vlib_main_t *vm)
#define CNAT_SESSION_HASH_SIZE
#define CNAT_DB_FLAG_UDP_ACTIVE
#define CNAT_V4_GET_HASH(key64, hash, mask)
void cnat_db_debug_error(cnat_db_key_bucket_t *u_ki, cnat_errno_t error)
union cnat_main_db_entry_t::@165 proto_data
static void cnat_session_log_nat44_mapping_delete(cnat_main_db_entry_t *db, cnat_session_entry_t *sdb, cnat_vrfmap_t *vrfmap)
void cnat_db_out2in_hash_delete(cnat_main_db_entry_t *ep)
void pptp_remove_channel_from_tunnel(cnat_main_db_entry_t *db)
void cnat_syslog_nat44_mapping_create(cnat_main_db_entry_t *db, cnat_vrfmap_t *vrfmap, cnat_session_entry_t *sdb, int bulk_alloc)
#define CNAT_MAX_ADDR_POOL_SIZE_PER_CORE
u64 in2out_drops_resource_depletion
cnat_vrfmap_t * cnat_map_by_vrf
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".
index_slist_t * cnat_timeout_hash
cnat_icmp_msg_t gen_icmp_msg
#define INIT_BULK_CACHE(udb)
cnat_session_entry_t nat44_session_db
u32 index_dlist_remelem(u32 head_index, u8 *vector, u32 elsize, u32 offset, u32 index_to_delete)