40 #define HASH_TABLE_SIZE 8192 // hash table size 41 #define THROTTLE_TIME 180 // throttle time value for out of port msg/user 66 #define PREDICT_TRUE(x) (x) 67 #define PREDICT_FALSE(x) (x) 70 #define foreach_cnat_db_v2_error \ 71 _(DROP, "error-drop packets") 74 #define _(sym,str) CNAT_DB_V2_##sym, 81 #define _(sym,string) string, 90 u32 this_start_addr, this_end_addr, this_addr,
new;
98 this_start_addr = start_addr;
99 this_end_addr = end_addr;
106 new = (this_end_addr - this_start_addr) + 1;
108 pm = *port_map_holder;
110 #if DEBUG_NOT_COMMENTED 111 printf(
"this_start_addr = 0x%08X, this_end_addr = 0x%08X, Num Addr = %d\n",
112 this_start_addr, this_end_addr,
new);
113 printf(
"pm_len = %d\n", pm_len);
117 for(i = 0; i< pm_len; i++) {
119 printf(
"address pool with addr 0x%08X exists\n", this_start_addr);
131 printf(
"address pool size (%d) would cross permissible limit (%u) \n",
140 #if DEBUG_NOT_COMMENTED 141 printf(
"total_address_pool_allocated changed from %d to %d (added %d)",
144 printf(
"vec add is ok\n");
147 memset(my_pm, 0,
new*
sizeof(*my_pm));
148 this_addr = this_start_addr;
151 while (this_addr <= this_end_addr) {
152 #if DEBUG_NOT_COMMENTED 153 printf(
"loop %d: this addr = 0x%08X\n", loop_count+1, this_addr);
159 memset(my_pm->
bm, 0xff,
169 if (loop_count !=
new) {
170 printf(
"Mismatch in loop_count (%d) != new (%d)\n",
174 *port_map_holder = pm;
176 #if DEBUG_NOT_COMMENTED 177 printf(
"revised pm len %d\n",
vec_len(*port_map_holder));
191 u32 last_log_timestamp = 0;
192 u32 last_user_dyn_port_exc_timestamp = 0;
193 u32 last_user_stat_port_exc_timestamp = 0;
234 #define CNAT_SET_ICMP_MSG_INFO \ 235 if (PREDICT_TRUE((my_vrfmap->i_vrf < CNAT_MAX_VRFMAP_ENTRIES) && \ 236 (svi_params_array[my_vrfmap->i_vrf].ipv4_addr))) { \ 237 info->gen_icmp_msg = icmp_msg_gen_allowed(); \ 238 info->svi_addr = svi_params_array[my_vrfmap->i_vrf].ipv4_addr; \ 241 #define CNAT_DEBUG_INSIDE_ERR(err) \ 242 if (((protocol == CNAT_UDP) && \ 243 (debug_i_flag & CNAT_DEBUG_ERR_UDP)) || \ 244 ((protocol == CNAT_TCP) && \ 245 (debug_i_flag & CNAT_DEBUG_ERR_TCP)) || \ 246 ((protocol == CNAT_ICMP) && \ 247 (debug_i_flag & CNAT_DEBUG_ERR_ICMP))) { \ 248 cnat_db_debug_error(&u_ki, err); \ 251 #define DSLITE_DEBUG_INSIDE_ERR(err) \ 252 if (((protocol == CNAT_UDP) && \ 253 (debug_i_flag & CNAT_DEBUG_ERR_UDP)) || \ 254 ((protocol == CNAT_TCP) && \ 255 (debug_i_flag & CNAT_DEBUG_ERR_TCP)) || \ 256 ((protocol == CNAT_ICMP) && \ 257 (debug_i_flag & CNAT_DEBUG_ERR_ICMP))) { \ 258 dslite_db_debug_error(&u_ki, err); \ 261 #define PORT_LIMIT_LOW_THRESHOLD_FOR_SYSLOG 7 266 #define CHECK_CLEAR_PORT_LIMIT_EXCEED_FLAG(udb, max_limit) \ 267 if(PREDICT_FALSE(udb->flags & CNAT_USER_DB_PORT_LIMIT_EXCEEDED)) { \ 268 if(udb->ntranslations < \ 269 ((max_limit/10)*PORT_LIMIT_LOW_THRESHOLD_FOR_SYSLOG) && \ 271 udb->flags = udb->flags & (~CNAT_USER_DB_PORT_LIMIT_EXCEEDED); \ 277 static char *debug_db_error[] = {
283 "bad in use for any",
285 "invalid index for direct",
286 "deleted addr for direct",
287 "bad in use for direct",
288 "not found for direct",
293 "bad static port request",
298 "invalid payload size",
300 "bulk single failure",
302 "xlat v6 prefix invalid",
303 "xlat v4 prefix invalid",
304 "xlat tcp mss invalid",
306 "6rd v4 tunnel src invalid",
307 "6rd v6 prefix invalid",
308 "6rd v6 BR unicast invalid",
309 "6rd v4 prefix masklen invalid",
310 "6rd v4 suffix masklen invalid",
311 "6rd v4 combo masklen invalid",
312 "6rd tunnel mtu invalid",
313 "6rd tunnel ttl invalid",
314 "6rd tunnel tos invalid",
323 f64 current_timestamp;
329 hash_value = ((src_addr >> 16) ^ ((src_addr & 0xffff) ^ i_vrf)) % (1024*8);
332 u32 arg[2] = {i_vrf, src_addr};
334 port_log_timestamps[hash_value] = current_timestamp;
385 #ifdef DEBUG_PRINTF_ENABLED 387 "for i-vrf 0x%x addr 0x%x port 0x%x\n",
388 debug_db_error[error], u_ki->
k.
k.
vrf,
404 #ifdef DEBUG_PRINTF_ENABLED 406 "for i-vrf 0x%x addr 0x%x port 0x%x\n",
422 #ifdef DEBUG_PRINTF_ENABLED 448 DSLITE_PRINTF(1,
"Delete1 DSL main hash bucket ..%u\n", bucket);
452 DSLITE_PRINTF(1,
"Delete1 NAT44 main hash bucket ..%u\n", bucket);
459 index = cnat_in2out_hash[bucket].
next;
465 this = cnat_main_db + index;
476 index = this->in2out_hash.next;
477 }
while (index !=
EMPTY);
491 index = cnat_out2in_hash[bucket].
next;
497 this = cnat_main_db + index;
508 index = this->out2in_hash.next;
509 }
while (index !=
EMPTY);
531 db = cnat_main_db + index;
536 }
while (index !=
EMPTY);
563 DSLITE_PRINTF(1,
"Delete1 DSL user hash bucket ..%u\n", bucket);
567 DSLITE_PRINTF(1,
"Delete1 NAT44 user hash bucket ..%u\n", bucket);
572 DSLITE_PRINTF(1,
"Delete2 NAT44 user hash bucket ..%u\n", bucket);
575 index = cnat_user_hash[bucket].
next;
581 this = cnat_user_db + index;
592 index = this->user_hash.next;
593 }
while (index !=
EMPTY);
617 udb = cnat_user_db + index;
622 }
while (index !=
EMPTY);
635 memset(udb, 0,
sizeof(*udb));
645 #ifndef NO_BULK_LOGGING 662 memset(db, 0,
sizeof(*db));
684 (
u8 *)cnat_main_db,
sizeof(cnat_main_db[0]),
704 printf(
"\nMy_Instance_Number %d: Bucket %d, Db_Index %d",
706 printf(
"\nInside (VRF 0x%x, IP 0x%x, PORT 0x%x)",
708 printf(
"\nOutside (VRF 0x%x, IP 0x%x, PORT 0x%x)",
710 printf(
"\nUser Index %d, IP 0x%x",
722 u32 db_index, current_db_index;
730 while( db_index !=
EMPTY) {
731 temp_db = cnat_main_db + db_index;
735 == current_db_index)) {
766 u32 vrfmap_len, udb_len;
771 u16 static_port_range;
772 #ifndef NO_BULK_LOGGING 815 vrfmap_len =
vec_len(cnat_map_by_vrf);
816 udb_len =
vec_len(cnat_user_db);
824 #ifdef DEBUG_PRINTF_ENABLED 825 printf(
"invalid/unused user index in db %d\n", ep->
user_index);
839 DSLITE_PRINTF(3,
"NULL portmap list for dslite_id %u, state %u\n",
853 #ifdef DEBUG_PRINTF_ENABLED 854 printf(
"invalid vrfmap index in db\n");
871 #ifndef NO_BULK_LOGGING
872 , bulk_size, &nfv9_log_req
879 #ifndef NO_BULK_LOGGING
880 , bulk_size, &nfv9_log_req
893 #ifndef NO_BULK_LOGGING
901 #ifndef NO_BULK_LOGGING
916 #ifndef NO_BULK_LOGGING
922 cnat_syslog_ds_lite_mapping_delete(ep,
924 #ifndef NO_BULK_LOGGING
954 sizeof (cnat_main_db[0]),
964 my_pm = pm + my_index;
967 #ifdef DEBUG_PRINTF_IP_N_TO_1_ENABLED 969 "private_ip_users_count = %d",
1012 db = cnat_main_db + index;
1017 }
while (index !=
EMPTY);
1033 u32 free_session = 0;
1126 u32 my_index, free_main, free_user;
1127 u32 current_timestamp;
1128 u16 my_vrfmap_index;
1129 u16 my_vrfmap_entry_found = 0;
1138 #ifndef NO_BULK_LOGGING 1210 my_vrfmap_index = vrf_map_array[u_ki.
k.
k.
vrf];
1211 my_vrfmap = cnat_map_by_vrf + my_vrfmap_index;
1266 in2out_drops_port_limit_exceeded ++;
1285 in2out_drops_system_limit_reached ++;
1289 if (
PREDICT_FALSE((current_timestamp - last_log_timestamp) >
1292 last_log_timestamp = current_timestamp;
1296 printf(
"Limit reached : OLD USER");
1316 #ifndef NO_BULK_LOGGING
1333 #ifndef NO_BULK_LOGGING
1347 free_main = free_main - 1;
1351 in2out_drops_system_limit_reached ++;
1364 #ifndef NO_BULK_LOGGING
1379 in2out_drops_resource_depletion++;
1402 in2out_drops_port_limit_exceeded ++;
1434 in2out_drops_system_limit_reached ++;
1451 #ifndef NO_BULK_LOGGING
1467 #ifndef NO_BULK_LOGGING
1479 free_main = free_main - 1;
1483 in2out_drops_system_limit_reached ++;
1497 #ifndef NO_BULK_LOGGING
1511 in2out_drops_resource_depletion ++;
1522 my_pm = pm + my_index;
1525 #ifdef DEBUG_PRINTF_IP_N_TO_1_ENABLED 1527 "dynamic alloc private_ip_users_count = %d",
1532 "reached MAX PORTS_PER_ADDR");
1534 #ifndef NO_BULK_LOGGING 1578 #ifndef NO_BULK_LOGGING
1586 #ifndef NO_BULK_LOGGING
1627 #ifndef NO_BULK_LOGGING
1635 #ifndef NO_BULK_LOGGING
1656 db = _cnat_get_main_db_entry_v2(ki, port_pair_type,
1657 port_type, info, dest_info);
1678 u32 my_index, free_main, free_user;
1684 #ifndef NO_BULK_LOGGING 1713 #ifdef DEBUG_PRINTF_ENABLED 1714 printf(
"Same Static Port Exists ki 0x%16llx ko 0x%16llx",
1729 #ifdef DEBUG_PRINTF_ENABLED 1730 printf(
"Static Port Existing and Diff ki 0x%16llx ko 0x%16llx",
1741 #ifdef DEBUG_PRINTF_ENABLED 1742 printf(
"Deleting Dynamic entry ki 0x%16llx ko 0x%16llx",
1779 in2out_drops_system_limit_reached ++;
1782 printf(
"Limit reached : OLD USER");
1792 my_pm = pm + my_index;
1800 printf(
"Delete Main db entry and check for" 1801 " ipv4 address sanity pm add = 0x%x ip add = 0x%x\n",
1807 db = cnat_main_db + head;
1818 in2out_drops_resource_depletion ++;
1827 my_pm = pm + my_index;
1830 #ifdef DEBUG_PRINTF_IP_N_TO_1_ENABLED 1832 "static del n alloc private_ip_users_count = " 1837 "reached MAX PORTS_PER_ADDR");
1840 #ifndef NO_BULK_LOGGING 1866 printf (
"Static port alloc any\n");
1896 in2out_drops_system_limit_reached ++;
1910 in2out_drops_resource_depletion ++;
1920 my_pm = pm + my_index;
1923 #ifdef DEBUG_PRINTF_IP_N_TO_1_ENABLED 1925 "static alloc private_ip_users_count = %d",
1930 "reached MAX PORTS_PER_ADDR");
1933 #ifndef NO_BULK_LOGGING 1963 #ifndef NO_BULK_LOGGING
1970 #ifndef NO_BULK_LOGGING
2012 u32 my_index, free_main, free_user;
2019 #ifndef NO_BULK_LOGGING 2023 u16 my_vrfmap_index;
2049 #ifdef DEBUG_PRINTF_ENABLED 2050 printf(
"Same Static Port Exists ki 0x%16llx ko 0x%16llx",
2065 #ifdef DEBUG_PRINTF_ENABLED 2066 printf(
"Static Port Existing and Diff ki 0x%16llx ko 0x%16llx",
2077 #ifdef DEBUG_PRINTF_ENABLED 2078 printf(
"Deleting Dynamic entry ki 0x%16llx ko 0x%16llx",
2102 my_vrfmap = cnat_map_by_vrf + my_vrfmap_index;
2125 printf(
"Limit reached : OLD USER");
2135 my_pm = pm + my_index;
2143 printf(
"Delete Main db entry and check for" 2144 " ipv4 address sanity pm add = 0x%x ip add = 0x%x\n",
2150 db = cnat_main_db + head;
2170 #ifndef NO_BULK_LOGGING 2197 printf (
"Static port alloc any\n");
2250 #ifndef NO_BULK_LOGGING 2304 index = cnat_timeout_hash[index].
next;
2310 db = cnat_timeout_db + index;
2315 }
while (index !=
EMPTY);
2365 if(index ==
EMPTY) {
2367 t_search_key.
k.
ipv4 = 0;
2371 if(index ==
EMPTY) {
2378 t_search_key.
k.
port = 0;
2381 if(index !=
EMPTY) {
2382 #ifdef DEBUG_PRINTF_ENABLED 2383 printf(
"%s: ip only map sucess\n",
"query_and_update_db_timeout");
2387 #ifdef DEBUG_PRINTF_ENABLED 2388 printf(
"%s: port only map sucess\n",
"query_and_update_db_timeout");
2393 #ifdef DEBUG_PRINTF_ENABLED 2394 printf(
"%s: ip port map sucess\n",
"query_and_update_db_timeout");
2399 if(index ==
EMPTY) {
2406 #ifdef DEBUG_PRINTF_ENABLED 2407 printf(
"%s: No match\n",
"query_and_update_db_timeout");
2411 timeout_db_entry = cnat_timeout_db + index;
2440 index = cnat_timeout_hash[bucket].
next;
2464 if(db_index !=
EMPTY) {
2466 db = cnat_timeout_db + db_index;
2482 memset(db, 0,
sizeof(*db));
2515 index = cnat_timeout_hash[bucket].
next;
2517 if(index ==
EMPTY)
return;
2521 this = cnat_timeout_db + index;
2526 cnat_timeout_hash[bucket].
next = this->t_hash.next;
2535 index = this->t_hash.next;
2536 }
while (index !=
EMPTY);
2538 if(index ==
EMPTY)
return;
2556 index = cnat_session_hash[bucket].
next;
2562 this = cnat_session_db + index;
2565 cnat_session_hash[bucket].
next =
2575 index = this->cnat_session_hash.
next;
2576 }
while (index !=
EMPTY);
2590 index = session_head_index;
2596 db = cnat_session_db + index;
2604 }
while (index !=
EMPTY);
2622 index = cnat_session_hash[bucket].
next;
2628 db = cnat_session_db + index;
2637 }
while (index !=
EMPTY);
2647 u32 db_index, bucket_out;
2680 memset(db, 0,
sizeof(*db));
2707 (
u8 *)cnat_session_db,
sizeof(cnat_session_db[0]),
2720 cnat_session_hash[bucket_out].
next;
2721 cnat_session_hash[bucket_out].
next = db_index;
2737 nat44_dslite_common_stats[instance].
sessions++;
2793 u32 session_db_index;
2807 bdb_len =
vec_len(cnat_main_db);
2815 #ifdef DEBUG_PRINTF_ENABLED 2816 printf(
"invalid/unused user index in db %d\n", ep->
main_db_index);
2828 sizeof (cnat_session_db[0]),
2859 _cnat_delete_session_db_entry(sdb_last,
FALSE);
2864 nat44_dslite_common_stats[instance].
sessions--;
2872 _cnat_delete_session_db_entry (ep, log);
2901 db = cnat_main_db + index;
2912 }
while (index !=
EMPTY);
2936 udb = cnat_user_db + index;
2946 }
while (index !=
EMPTY);
2962 memset(udb, 0,
sizeof(*udb));
2980 #ifndef NO_BULK_LOGGING 3009 memset(db, 0,
sizeof(*db));
3033 (
u8 *)cnat_main_db,
sizeof(cnat_main_db[0]),
3045 cnat_out2in_hash[ko->
bucket].
next = db_index;
3050 cnat_in2out_hash[ki->
bucket].
next = db_index;
3052 DSLITE_PRINTF(1,
"Create main db and hash..%u %u %u %u %x\n",
3057 printf(
"\nMy_Instance_Number %d: Bucket %d, Db_Index %d",
3059 printf(
"\nInside (VRF 0x%x, IP 0x%x, PORT 0x%x)",
3061 printf(
"\nOutside (VRF 0x%x, IP 0x%x, PORT 0x%x)",
3063 printf(
"\nUser Index %d, IP 0x%x",
3072 static inline void handle_dslite_port_exceeded_logging(
3138 u32 my_index, free_main, free_user;
3139 u32 current_timestamp;
3141 u16 my_vrfmap_index;
3148 #ifndef NO_BULK_LOGGING 3220 #ifdef DSLITE_USER_IPV4 3237 my_vrfmap = cnat_map_by_vrf + my_vrfmap_index;
3241 my_vrfmap_index = vrf_map_array[u_ki.k.k.vrf];
3242 my_vrfmap = cnat_map_by_vrf + my_vrfmap_index;
3245 (my_vrfmap->
i_vrf == u_ki.k.k.vrf));
3248 u32 arr[] = {ki->k.k.vrf, ki->k.k.ipv4, ki->k.k.port};
3250 (my_vrfmap->
i_vrf == u_ki.k.k.vrf)) {
3272 ko.
k.
k.
vrf = dslite_entry_ptr->
o_vrf | protocol;
3301 handle_dslite_port_exceeded_logging(udb, &u_ki.
dk, dslite_entry_ptr);
3321 if (
PREDICT_FALSE((current_timestamp - last_log_timestamp) >
3324 last_log_timestamp = current_timestamp;
3328 printf(
"Limit reached : OLD USER");
3348 #ifndef NO_BULK_LOGGING
3364 #ifndef NO_BULK_LOGGING
3378 free_main = free_main - 1;
3396 #ifndef NO_BULK_LOGGING
3477 #ifndef NO_BULK_LOGGING
3493 #ifndef NO_BULK_LOGGING
3509 free_main = free_main - 1;
3527 #ifndef NO_BULK_LOGGING
3554 #ifndef NO_BULK_LOGGING 3570 DSLITE_PRINTF(1,
"dslite_create_main_db_entry_and_hash done..\n");
3599 dslite_entry_ptr,
NULL);
3603 #ifndef NO_BULK_LOGGING
3611 #ifndef NO_BULK_LOGGING
3624 new_ki.k.k.port += 1;
3637 #ifndef NO_BULK_LOGGING 3659 .function = cnat_db_v2_node_fn,
3660 .name =
"vcgn-db-v2",
3661 .vector_size =
sizeof (
u32),
3667 .n_next_nodes = CNAT_DB_V2_DROP,
3671 [CNAT_DB_V2_DROP] =
"error-drop",
3695 for(i=0; i< n; i++) {
3699 for(i=0; i< n; i++) {
3700 pool_put(cgse_nat_db, cgse_nat_db + i);
3712 printf(
"DBL Support Not exist\n");
3720 if (n % NUM_BITS_IN_UWORD)
3724 for(i=0; i< n; i++) {
3725 pool_get(cgse_session_db, comb_session);
3728 for(i=0; i< n; i++) {
3729 pool_put(cgse_session_db, cgse_session_db + i);
3744 if (n % NUM_BITS_IN_UWORD)
3748 for(i=0; i< n; i++) {
3752 for(i=0; i< n; i++) {
3753 pool_put(cgse_user_db, cgse_user_db + i);
3762 for(i=0; i< n; i++) {
3766 for(i=0; i< n; i++) {
3767 pool_put(cnat_timeout_db, cnat_timeout_db + i);
3792 PTHREAD_PROCESS_PRIVATE);
3796 PTHREAD_PROCESS_PRIVATE);
3800 PTHREAD_PROCESS_PRIVATE);
3803 cnat_db_init_done = 1;
3804 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)
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
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
static vlib_main_t * vlib_get_main(void)
u32 private_ip_users_count
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
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 pool_alloc(P, N)
Allocate N more free elements to pool (unspecified alignment).
#define NAT44_RESERVED_INST_ID
cnat_user_db_entry_t * cnat_user_db
Fixed length block allocator.
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
static f64 vlib_time_now(vlib_main_t *vm)
#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
pthread_spinlock_t * main_db_lockp
#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)
Use free bitmap to query whether given element is free.
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)
pthread_spinlock_t * user_db_lockp
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#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)
#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)
union cnat_main_db_entry_t::@266 proto_data
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)
u32 dslite_translation_create_count
int vlib_main(vlib_main_t *volatile vm, unformat_input_t *input)
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
static pool_header_t * pool_header(void *v)
Get pool header from user pool pointer.
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)
#define pool_put(P, E)
Free an object E in pool P.
void cnat_update_bulk_range_cache(cnat_user_db_entry_t *udb, u16 o_port, bulk_alloc_size_t bulk_size)
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)
pthread_spinlock_t * session_db_lockp
#define CNAT_SESSION_HASH_MASK
cgse_nat_session_db_entry_t * cgse_session_db
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)
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
#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
struct cnat_main_db_entry_t::@266::seq_pcp_t seq_pcp
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)
Bitmaps built as vectors of machine words.
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
#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)
static void * clib_mem_alloc_aligned(uword size, uword align)
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)
#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)
#define CLIB_CACHE_LINE_BYTES
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)
union cnat_main_db_entry_t::@265 alg
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
union cnat_session_entry_t::@267 alg
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)