19 #ifndef __NAT64_DB_H__ 20 #define __NAT64_DB_H__ 33 #define HASH_ENHANCE 4 36 #define NAT64_MAIN_DB_SIZE \ 37 (PLATFORM_NAT64_MAX_SESSIONS / PLATFORM_CNAT_INSTS) 38 #define NAT64_MAIN_HASH_SIZE \ 39 (HASH_ENHANCE * PLATFORM_CNAT_MAIN_PRELIM_HASH_SIZE) 41 #define NAT64_MAIN_HASH_MASK (NAT64_MAIN_HASH_SIZE-1) 45 #define NAT64_USER_HASH_SIZE CNAT_USER_HASH_SIZE 46 #define NAT64_USER_HASH_MASK (NAT64_USER_HASH_SIZE-1) 52 #define NAT64_MAX_SESSIONS_PER_BIB 0xFFFF 56 #define NAT64_TIMEOUT_HASH_SIZE \ 57 PLATFORM_NAT64_TIMEOUT_HASH_SIZE 59 #define NAT64_TIMEOUT_HASH_MASK (NAT64_TIMEOUT_HASH_SIZE - 1) 60 #define NAT64_TIMEOUT_FULL_MASK 0xFFFFFFFFFFFFFFFF 66 #define NAT64_UDP_DEFAULT 300 67 #define NAT64_UDP_MIN 120 68 #define NAT64_TCP_TRANS 240 69 #define NAT64_TCP_EST 7200 70 #define NAT64_TCP_V4_SYN 6 71 #define NAT64_FRAG_MIN 2 72 #define NAT64_ICMP_DEFAULT 60 75 #define NAT64_V6_GET_HASH(in_key, hash, mask) \ 76 a = in_key->ipv6[0] ^ in_key->ipv6[1] ^ in_key->ipv6[2] ^ in_key->ipv6[3] \ 77 ^ ((in_key->port << 16) | in_key->vrf); \ 80 hash_mix32(a, b, c); \ 84 #define NAT64_V4_GET_HASH(in_key, hash, mask) \ 85 a = in_key.ipv4 ^ ((in_key.port << 16) | in_key.vrf); \ 88 hash_mix32(a, b, c); \ 93 #define NAT64_V6_GET_SESSION_HASH(bib_index, in_addr, port, vrf, hash, mask) \ 94 a = bib_index ^ in_addr[0] ^ in_addr[1] ^ in_addr[2] ^ in_addr[3] \ 98 hash_mix32(a, b, c); \ 101 #define NAT64_V4_GET_SESSION_HASH(bib_index, in_addr, port, vrf, hash, mask) \ 102 a = bib_index ^ in_addr ^ port ^ vrf; \ 103 b = c = 0x9e3779b9; \ 105 hash_mix32(a, b, c); \ 135 #define NAT64_DB_FLAG_STATIC_PORT CNAT_DB_FLAG_STATIC_PORT 136 #define NAT64_DB_NAT64_FLAG CNAT_DB_NAT64_FLAG 137 #define NAT64_DB_FLAG_ALG_ENTRY CNAT_DB_FLAG_ALG_ENTRY 138 #define NAT64_DB_FLAG_PCPI CNAT_DB_FLAG_PCPI 139 #define NAT64_DB_FLAG_PCPE CNAT_DB_FLAG_PCPE 198 #define NAT64_USER_DB_NAT64_FLAG CNAT_USER_DB_NAT64_FLAG 209 #ifndef NO_BULK_LOGGING 453 #define NAT64_CMP_V6_KEY(key1, key2) \ 454 memcmp(key1, key2, sizeof(nat64_v6_key_t)) 456 #define NAT64_CMP_V4_KEY(key1, key2) \ 457 memcmp(key1, key2, sizeof(nat64_v4_key_t)) 460 #define NAT64_CMP_V6_IP(ip1, ip2) \ 461 memcmp(ip1, ip2, (sizeof(u32) * 4)) 464 #define NAT64_CMP_V6_KEY1(key1, key2) \ 465 (key1.ipv6[0] == key2.ipv6[0]) && (key1.ipv6[1] == key2.ipv6[1]) && \ 466 (key1.ipv6[2] == key2.ipv6[2]) && (key1.ipv6[3] == key2.ipv6[3]) && \ 467 (key1.port == key2.port) && (key1.vrf == key2.vrf) 470 #define NAT64_CMP_V6_IP1(ip1, ip2) \ 471 ((ip1[0] == ip2[0]) && (ip1[1] == ip2[1]) && \ 472 (ip1[2] == ip2[2]) && (ip1[3] == ip2[3])) 474 #define NAT64_CMP_V4_KEY1(key1, key2) \ 475 (key1.key64 == key2.key64) void nat64_bib_db_in2out_hash_delete(nat64_bib_entry_t *ep)
index_slist_t nat64_frag_out2in_hash
void nat64_bib_db_out2in_hash_delete(nat64_bib_entry_t *ep)
nat64_session_entry_t * nat64_session_db
void nat64_delete_bib_db_entry(nat64_bib_entry_t *ep, u8 force)
nat64_vrfmap_t * nat64_map_by_vrf
nat64_v4_key_t timeout_key
nat64_bib_entry_t * nat64_bib_db_lookup_entry_out2in(nat64_v4_key_t *ko)
index_slist_t * nat64_bib_in2out_hash
index_slist_t * nat64_bib_out2in_hash
nat64_v4_key_t v4_out_key
nat64_table_entry_t nat64_table_array[NAT64_MAX_NAT64_ENTRIES]
nat64_session_entry_t * nat64_session_db_lookup_entry_out2in(nat64_v4_key_t *ko, u32 bib_index)
index_slist_t * nat64_session_out2in_hash
nat64_bib_entry_t nat64_bib_db
nat64_bib_entry_t * nat64_create_static_bib_db_entry(nat64_v6_key_t *ki, nat64_v4_key_t *ko, nat64_table_entry_t *my_table, cnat_gen_icmp_info *info)
#define BULK_RANGE_CACHE_SIZE
nat64_table_entry_t * nat64_table_ptr
nat64_bib_entry_t * nat64_bib_db_lookup_entry(nat64_v6_key_t *ki)
void nat64_delete_session_db_entry_v2(nat64_session_entry_t *ep, u8 force)
nat64_bib_user_entry_t * nat64_bib_user_db_create_entry(nat64_v6_key_t *uki, u32 bucket, u32 portmap_index)
cnat_main_db_entry_t nat44_main_db
index_slist_t * nat64_timeout_hash
u32 translation_list_head_index
cnat_user_db_entry_t nat44_user_db
nat64_session_entry_t * nat64_create_session_db_entry_v2(nat64_v4_key_t *ko, nat64_bib_entry_t *bdb)
nat64_session_entry_t nat64_session_db
index_slist_t * nat64_bib_user_hash
index_slist_t nat64_frag_in2out_hash
nat64_bib_entry_t * nat64_create_bib_db_entry_and_hash(nat64_v6_key_t *ki, nat64_v4_key_t *ko, nat64_bib_user_entry_t *udb)
u8 nat64_timeout_dirty_flag[NAT64_MAX_NAT64_ENTRIES]
cgse_nat_session_db_entry_t * cgse_session_db
void nat64_session_db_out2in_hash_delete(nat64_session_entry_t *ep)
nat64_bib_entry_t * nat64_get_bib_db_entry(nat64_v6_key_t *ki, port_pair_t port_pair_type, port_type_t port_type, cnat_gen_icmp_info *info)
u16 query_and_update_db_timeout_nat64(nat64_session_entry_t *db)
cgse_nat_db_entry_t * cgse_nat_db
void nat64_bib_user_db_delete(nat64_bib_user_entry_t *up)
index_slist_t nat64_bib_out2in_hash
cgse_nat_user_db_entry_t * cgse_user_db
index_slist_t * nat64_frag_in2out_hash
nat64_in_v6_frag_entry_t * nat64_in_frag_db
nat64_bib_user_entry_t * nat64_bib_user_db_lookup_entry(nat64_v6_key_t *uki, u32 *bucket)
nat64_v4_key_t v4_dest_key
nat64_bib_user_entry_t nat64_user_db
nat64_bib_user_entry_t * nat64_bib_user_db
nat64_session_tcp_init_entry_t * nat64_tcp_init_db
#define NAT64_MAX_NAT64_ENTRIES
index_slist_t nat64_session_out2in_hash
u16 nat64_timeout_db_create(nat64_timeout_t t_entry)
void nat64_timeout_db_delete(nat64_v4_key_t t_key)
nat64_bib_entry_t * nat64_bib_db
void nat64_timeout_db_hash_add(nat64_timeout_db_entry_t *t_entry)
index_slist_t nat64_bib_in2out_hash
u32 nat64_timeout_db_hash_lookup(nat64_v4_key_t t_key)
nat64_timeout_db_entry_t * nat64_timeout_db
nat64_v4_key_t v4_out_key
index_slist_t * nat64_frag_out2in_hash
nat64_out_v4_frag_entry_t * nat64_out_frag_db
index_slist_t * nat64_session_in2out_hash
cnat_session_entry_t nat44_session_db