22 #ifndef __included_nat_det_h__ 23 #define __included_nat_det_h__ 30 #define SNAT_DET_SES_PER_USER 1000 52 if (is_addr_in_net(user_addr, &dm->in_addr, dm->in_plen))
67 if (is_addr_in_net(out_addr, &dm->out_addr, dm->out_plen))
78 u32 in_offset, out_offset;
80 in_offset = clib_net_to_host_u32 (in_addr->
as_u32) -
93 u32 in_offset1, in_offset2, out_offset;
95 out_offset = clib_net_to_host_u32 (out_addr->
as_u32) -
100 clib_host_to_net_u32 (clib_net_to_host_u32 (dm->
in_addr.
as_u32) +
101 in_offset1 + in_offset2);
122 return &dm->
sessions[i + user_offset];
139 ses = &dm->
sessions[i + user_offset];
143 return &dm->
sessions[i + user_offset];
170 return &dm->
sessions[i + user_offset];
176 SNAT_DET_SES_PER_USER,
void snat_ipfix_logging_max_entries_per_user(u32 thread_index, u32 limit, u32 src_ip)
Generate maximum entries per user exceeded event.
int snat_det_add_map(snat_main_t *sm, ip4_address_t *in_addr, u8 in_plen, ip4_address_t *out_addr, u8 out_plen, int is_add)
Add/delete deterministic NAT mapping.
#define clib_atomic_add_fetch(a, b)
static void snat_det_ses_close(snat_det_map_t *dm, snat_det_session_t *ses)
static snat_det_session_t * snat_det_find_ses_by_in(snat_det_map_t *dm, ip4_address_t *in_addr, u16 in_port, snat_det_out_key_t out_key)
static void snat_det_forward(snat_det_map_t *dm, ip4_address_t *in_addr, ip4_address_t *out_addr, u16 *lo_port)
snat_det_map_t * det_maps
static void snat_det_reverse(snat_det_map_t *dm, ip4_address_t *out_addr, u16 out_port, ip4_address_t *in_addr)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
ip4_address_t ext_host_addr
static uword pow2_mask(uword x)
#define SNAT_DET_SES_PER_USER
static u32 snat_det_user_ses_offset(ip4_address_t *addr, u8 plen)
snat_det_session_t * sessions
static snat_det_map_t * snat_det_map_by_out(snat_main_t *sm, ip4_address_t *out_addr)
static snat_det_session_t * snat_det_ses_create(u32 thread_index, snat_det_map_t *dm, ip4_address_t *in_addr, u16 in_port, snat_det_out_key_t *out)
sll srl srl sll sra u16x4 i
static int is_addr_in_net(ip4_address_t *addr, ip4_address_t *net, u8 plen)
static snat_det_map_t * snat_det_map_by_user(snat_main_t *sm, ip4_address_t *user_addr)
#define clib_atomic_bool_cmp_and_swap(addr, old, new)
static snat_det_session_t * snat_det_get_ses_by_out(snat_det_map_t *dm, ip4_address_t *in_addr, u64 out_key)
ip4_main_t ip4_main
Global ip4 main structure.