FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
nat44_ed.c File Reference
+ Include dependency graph for nat44_ed.c:

Go to the source code of this file.

Macros

#define skip_if_disabled()
 
#define fail_if_enabled()
 
#define fail_if_disabled()
 
#define nat_validate_simple_counter(c, i)
 
#define nat_init_simple_counter(c, n, sn)
 

Functions

static_always_inline void nat_validate_interface_counters (snat_main_t *sm, u32 sw_if_index)
 
 VNET_FEATURE_INIT (nat_pre_in2out, static)
 
 VNET_FEATURE_INIT (nat_pre_out2in, static)
 
 VNET_FEATURE_INIT (snat_in2out_worker_handoff, static)
 
 VNET_FEATURE_INIT (snat_out2in_worker_handoff, static)
 
 VNET_FEATURE_INIT (ip4_snat_in2out, static)
 
 VNET_FEATURE_INIT (ip4_snat_out2in, static)
 
 VNET_FEATURE_INIT (ip4_nat44_ed_in2out, static)
 
 VNET_FEATURE_INIT (ip4_nat44_ed_out2in, static)
 
 VNET_FEATURE_INIT (ip4_nat44_ed_classify, static)
 
 VNET_FEATURE_INIT (ip4_nat_handoff_classify, static)
 
 VNET_FEATURE_INIT (ip4_snat_in2out_fast, static)
 
 VNET_FEATURE_INIT (ip4_snat_out2in_fast, static)
 
 VNET_FEATURE_INIT (ip4_snat_in2out_output, static)
 
 VNET_FEATURE_INIT (ip4_snat_in2out_output_worker_handoff, static)
 
 VNET_FEATURE_INIT (nat_pre_in2out_output, static)
 
 VNET_FEATURE_INIT (ip4_nat44_ed_in2out_output, static)
 
 VLIB_PLUGIN_REGISTER ()
 
static void nat44_ed_db_init (u32 translations, u32 translation_buckets)
 
static void nat44_ed_db_free ()
 
u32 nat_calc_bihash_buckets (u32 n_elts)
 
u8format_session_kvp (u8 *s, va_list *args)
 
u8format_static_mapping_kvp (u8 *s, va_list *args)
 
u8format_ed_session_kvp (u8 *s, va_list *args)
 
void nat_free_session_data (snat_main_t *sm, snat_session_t *s, u32 thread_index, u8 is_ha)
 Free NAT44 session data (lookup keys, external address port) More...
 
static int is_snat_address_used_in_static_mapping (snat_main_t *sm, ip4_address_t addr)
 
static void nat44_ed_add_del_addr_to_fib (ip4_address_t *addr, u8 p_len, u32 sw_if_index, int is_add)
 
static void nat44_ed_add_del_addr_to_fib_foreach_out_if (ip4_address_t *addr, u8 is_add)
 
static_always_inline void nat44_ed_add_del_addr_to_fib_foreach_addr (u32 sw_if_index, u8 is_add)
 
static_always_inline void nat44_ed_add_del_addr_to_fib_foreach_addr_only_sm (u32 sw_if_index, u8 is_add)
 
int nat44_ed_add_address (ip4_address_t *addr, u32 vrf_id, u8 twice_nat)
 
int nat44_ed_del_address (ip4_address_t addr, u8 delete_sm, u8 twice_nat)
 
u32 get_thread_idx_by_port (u16 e_port)
 
void nat_ed_static_mapping_del_sessions (snat_main_t *sm, snat_main_per_thread_data_t *tsm, ip4_address_t l_addr, u16 l_port, u8 protocol, u32 fib_index, int addr_only, ip4_address_t e_addr, u16 e_port)
 
int nat44_ed_reserve_port (ip4_address_t addr, u16 port, nat_protocol_t proto)
 
int nat44_ed_free_port (ip4_address_t addr, u16 port, nat_protocol_t proto)
 
void nat44_ed_add_resolve_record (ip4_address_t l_addr, u16 l_port, u16 e_port, nat_protocol_t proto, u32 vrf_id, u32 sw_if_index, u32 flags, ip4_address_t pool_addr, u8 *tag)
 
int nat44_ed_get_resolve_record (ip4_address_t l_addr, u16 l_port, u16 e_port, nat_protocol_t proto, u32 vrf_id, u32 sw_if_index, u32 flags, int *out)
 
int nat44_ed_del_resolve_record (ip4_address_t l_addr, u16 l_port, u16 e_port, nat_protocol_t proto, u32 vrf_id, u32 sw_if_index, u32 flags)
 
static_always_inline int nat44_ed_validate_sm_input (u32 flags)
 
int nat44_ed_add_static_mapping (ip4_address_t l_addr, ip4_address_t e_addr, u16 l_port, u16 e_port, nat_protocol_t proto, u32 vrf_id, u32 sw_if_index, u32 flags, ip4_address_t pool_addr, u8 *tag)
 
int nat44_ed_del_static_mapping (ip4_address_t l_addr, ip4_address_t e_addr, u16 l_port, u16 e_port, nat_protocol_t proto, u32 vrf_id, u32 sw_if_index, u32 flags)
 
int nat44_ed_add_lb_static_mapping (ip4_address_t e_addr, u16 e_port, nat_protocol_t proto, nat44_lb_addr_port_t *locals, u32 flags, u8 *tag, u32 affinity)
 
int nat44_ed_del_lb_static_mapping (ip4_address_t e_addr, u16 e_port, nat_protocol_t proto, u32 flags)
 
int nat44_ed_add_del_lb_static_mapping_local (ip4_address_t e_addr, u16 e_port, ip4_address_t l_addr, u16 l_port, nat_protocol_t proto, u32 vrf_id, u8 probability, u8 is_add)
 
void expire_per_vrf_sessions (u32 fib_index)
 
void update_per_vrf_sessions_vec (u32 fib_index, int is_del)
 
static_always_inline nat_outside_fib_tnat44_ed_get_outside_fib (nat_outside_fib_t *outside_fibs, u32 fib_index)
 
static_always_inline snat_interface_tnat44_ed_get_interface (snat_interface_t *interfaces, u32 sw_if_index)
 
int nat44_ed_add_interface (u32 sw_if_index, u8 is_inside)
 
int nat44_ed_del_interface (u32 sw_if_index, u8 is_inside)
 
int nat44_ed_add_output_interface (u32 sw_if_index)
 
int nat44_ed_del_output_interface (u32 sw_if_index)
 
int snat_set_workers (uword *bitmap)
 
int nat44_ed_set_frame_queue_nelts (u32 frame_queue_nelts)
 
static void nat44_ed_update_outside_fib_cb (ip4_main_t *im, uword opaque, u32 sw_if_index, u32 new_fib_index, u32 old_fib_index)
 
static void nat44_ed_add_del_interface_address_cb (ip4_main_t *im, uword opaque, u32 sw_if_index, ip4_address_t *address, u32 address_length, u32 if_address_index, u32 is_delete)
 
static void nat44_ed_add_del_static_mapping_addr_only_cb (ip4_main_t *im, uword opaque, u32 sw_if_index, ip4_address_t *address, u32 address_length, u32 if_address_index, u32 is_delete)
 
void test_key_calc_split ()
 
static clib_error_tnat_ip_table_add_del (vnet_main_t *vnm, u32 table_id, u32 is_add)
 
 VNET_IP_TABLE_ADD_DEL_FUNCTION (nat_ip_table_add_del)
 
void nat44_set_node_indexes (snat_main_t *sm, vlib_main_t *vm)
 
static clib_error_tnat_init (vlib_main_t *vm)
 
int nat44_plugin_enable (nat44_config_t c)
 
void nat44_addresses_free (snat_address_t **addresses)
 
int nat44_plugin_disable ()
 
void nat44_ed_forwarding_enable_disable (u8 is_enable)
 
void snat_free_outside_address_and_port (snat_address_t *addresses, u32 thread_index, ip4_address_t *addr, u16 port, nat_protocol_t protocol)
 Free outside address and port pair. More...
 
int snat_static_mapping_match (vlib_main_t *vm, snat_main_t *sm, ip4_address_t match_addr, u16 match_port, u32 match_fib_index, nat_protocol_t match_protocol, ip4_address_t *mapping_addr, u16 *mapping_port, u32 *mapping_fib_index, u8 by_external, u8 *is_addr_only, twice_nat_type_t *twice_nat, lb_nat_type_t *lb, ip4_address_t *ext_host_addr, u8 *is_identity_nat, snat_static_mapping_t **out)
 Match NAT44 static mapping. More...
 
u32 nat44_ed_get_in2out_worker_index (vlib_buffer_t *b, ip4_header_t *ip, u32 rx_fib_index, u8 is_output)
 
u32 nat44_ed_get_out2in_worker_index (vlib_buffer_t *b, ip4_header_t *ip, u32 rx_fib_index, u8 is_output)
 
u32 nat44_get_max_session_limit ()
 
int nat44_set_session_limit (u32 session_limit, u32 vrf_id)
 Set NAT44 session limit (session limit, vrf id) More...
 
int nat44_update_session_limit (u32 session_limit, u32 vrf_id)
 Update NAT44 session limit flushing all data (session limit, vrf id) More...
 
static void nat44_ed_worker_db_init (snat_main_per_thread_data_t *tsm, u32 translations, u32 translation_buckets)
 
static void reinit_ed_flow_hash ()
 
static void nat44_ed_worker_db_free (snat_main_per_thread_data_t *tsm)
 
void nat44_ed_sessions_clear ()
 
static_always_inline int is_sw_if_index_reg_for_auto_resolve (u32 *sw_if_indices, u32 sw_if_index)
 
int nat44_ed_add_interface_address (u32 sw_if_index, u8 twice_nat)
 
int nat44_ed_del_interface_address (u32 sw_if_index, u8 twice_nat)
 
int nat44_ed_del_session (snat_main_t *sm, ip4_address_t *addr, u16 port, ip4_address_t *eh_addr, u16 eh_port, u8 proto, u32 vrf_id, int is_in)
 Delete NAT44 endpoint-dependent session. More...
 
VLIB_NODE_FN() nat_default_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
void nat_6t_l3_l4_csum_calc (nat_6t_flow_t *f)
 
static_always_inline int nat_6t_flow_icmp_translate (vlib_main_t *vm, snat_main_t *sm, vlib_buffer_t *b, ip4_header_t *ip, nat_6t_flow_t *f)
 
static_always_inline void nat_6t_flow_ip4_translate (snat_main_t *sm, vlib_buffer_t *b, ip4_header_t *ip, nat_6t_flow_t *f, nat_protocol_t proto, int is_icmp_inner_ip4, int skip_saddr_rewrite)
 
static_always_inline int it_fits (vlib_main_t *vm, vlib_buffer_t *b, void *object, size_t size)
 
static_always_inline nat_translation_error_e nat_6t_flow_buf_translate (vlib_main_t *vm, snat_main_t *sm, vlib_buffer_t *b, ip4_header_t *ip, nat_6t_flow_t *f, nat_protocol_t proto, int is_output_feature, int is_i2o)
 
nat_translation_error_e nat_6t_flow_buf_translate_i2o (vlib_main_t *vm, snat_main_t *sm, vlib_buffer_t *b, ip4_header_t *ip, nat_6t_flow_t *f, nat_protocol_t proto, int is_output_feature)
 
nat_translation_error_e nat_6t_flow_buf_translate_o2i (vlib_main_t *vm, snat_main_t *sm, vlib_buffer_t *b, ip4_header_t *ip, nat_6t_flow_t *f, nat_protocol_t proto, int is_output_feature)
 
u8format_nat_6t (u8 *s, va_list *args)
 
u8format_nat_ed_translation_error (u8 *s, va_list *args)
 
u8format_nat_6t_flow (u8 *s, va_list *args)
 

Variables

snat_main_t snat_main
 
vlib_node_registration_t nat_default_node
 (constructor) VLIB_REGISTER_NODE (nat_default_node) More...
 

Macro Definition Documentation

◆ fail_if_disabled

#define fail_if_disabled ( )
Value:
do \
{ \
snat_main_t *sm = &snat_main; \
if (PREDICT_FALSE (!sm->enabled)) \
{ \
nat_log_err ("plugin disabled"); \
return 1; \
} \
} \
while (0)

Definition at line 67 of file nat44_ed.c.

◆ fail_if_enabled

#define fail_if_enabled ( )
Value:
do \
{ \
snat_main_t *sm = &snat_main; \
if (PREDICT_FALSE (sm->enabled)) \
{ \
nat_log_err ("plugin enabled"); \
return 1; \
} \
} \
while (0)

Definition at line 55 of file nat44_ed.c.

◆ nat_init_simple_counter

#define nat_init_simple_counter (   c,
  n,
  sn 
)
Value:
do \
{ \
c.name = n; \
c.stat_segment_name = sn; \
nat_validate_simple_counter (c, 0); \
} \
while (0);

Definition at line 2238 of file nat44_ed.c.

◆ nat_validate_simple_counter

#define nat_validate_simple_counter (   c,
  i 
)
Value:
do \
{ \
vlib_validate_simple_counter (&c, i); \
vlib_zero_simple_counter (&c, i); \
} \
while (0);

Definition at line 2230 of file nat44_ed.c.

◆ skip_if_disabled

#define skip_if_disabled ( )
Value:
do \
{ \
snat_main_t *sm = &snat_main; \
if (PREDICT_FALSE (!sm->enabled)) \
return; \
} \
while (0)

Definition at line 46 of file nat44_ed.c.

Function Documentation

◆ expire_per_vrf_sessions()

void expire_per_vrf_sessions ( u32  fib_index)

Definition at line 1550 of file nat44_ed.c.

+ Here is the caller graph for this function:

◆ format_ed_session_kvp()

u8* format_ed_session_kvp ( u8 s,
va_list *  args 
)

Definition at line 209 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format_nat_6t()

u8* format_nat_6t ( u8 s,
va_list *  args 
)

Definition at line 3882 of file nat44_ed.c.

+ Here is the caller graph for this function:

◆ format_nat_6t_flow()

u8* format_nat_6t_flow ( u8 s,
va_list *  args 
)

Definition at line 3924 of file nat44_ed.c.

+ Here is the call graph for this function:

◆ format_nat_ed_translation_error()

u8* format_nat_ed_translation_error ( u8 s,
va_list *  args 
)

Definition at line 3895 of file nat44_ed.c.

◆ format_session_kvp()

u8* format_session_kvp ( u8 s,
va_list *  args 
)

Definition at line 186 of file nat44_ed.c.

+ Here is the call graph for this function:

◆ format_static_mapping_kvp()

u8* format_static_mapping_kvp ( u8 s,
va_list *  args 
)

Definition at line 198 of file nat44_ed.c.

+ Here is the caller graph for this function:

◆ get_thread_idx_by_port()

u32 get_thread_idx_by_port ( u16  e_port)

Definition at line 540 of file nat44_ed.c.

+ Here is the caller graph for this function:

◆ is_snat_address_used_in_static_mapping()

static int is_snat_address_used_in_static_mapping ( snat_main_t sm,
ip4_address_t  addr 
)
static

Definition at line 286 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_sw_if_index_reg_for_auto_resolve()

static_always_inline int is_sw_if_index_reg_for_auto_resolve ( u32 sw_if_indices,
u32  sw_if_index 
)

Definition at line 3275 of file nat44_ed.c.

+ Here is the caller graph for this function:

◆ it_fits()

static_always_inline int it_fits ( vlib_main_t vm,
vlib_buffer_t b,
void *  object,
size_t  size 
)

Definition at line 3677 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_addresses_free()

void nat44_addresses_free ( snat_address_t **  addresses)

Definition at line 2442 of file nat44_ed.c.

+ Here is the caller graph for this function:

◆ nat44_ed_add_address()

int nat44_ed_add_address ( ip4_address_t addr,
u32  vrf_id,
u8  twice_nat 
)

Definition at line 388 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_add_del_addr_to_fib()

static void nat44_ed_add_del_addr_to_fib ( ip4_address_t addr,
u8  p_len,
u32  sw_if_index,
int  is_add 
)
static

Definition at line 305 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_add_del_addr_to_fib_foreach_addr()

static_always_inline void nat44_ed_add_del_addr_to_fib_foreach_addr ( u32  sw_if_index,
u8  is_add 
)

Definition at line 360 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_add_del_addr_to_fib_foreach_addr_only_sm()

static_always_inline void nat44_ed_add_del_addr_to_fib_foreach_addr_only_sm ( u32  sw_if_index,
u8  is_add 
)

Definition at line 372 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_add_del_addr_to_fib_foreach_out_if()

static void nat44_ed_add_del_addr_to_fib_foreach_out_if ( ip4_address_t addr,
u8  is_add 
)
static

Definition at line 338 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_add_del_interface_address_cb()

static void nat44_ed_add_del_interface_address_cb ( ip4_main_t im,
uword  opaque,
u32  sw_if_index,
ip4_address_t address,
u32  address_length,
u32  if_address_index,
u32  is_delete 
)
static

Definition at line 3289 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_add_del_lb_static_mapping_local()

int nat44_ed_add_del_lb_static_mapping_local ( ip4_address_t  e_addr,
u16  e_port,
ip4_address_t  l_addr,
u16  l_port,
nat_protocol_t  proto,
u32  vrf_id,
u8  probability,
u8  is_add 
)

Definition at line 1399 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_add_del_static_mapping_addr_only_cb()

static void nat44_ed_add_del_static_mapping_addr_only_cb ( ip4_main_t im,
uword  opaque,
u32  sw_if_index,
ip4_address_t address,
u32  address_length,
u32  if_address_index,
u32  is_delete 
)
static

Definition at line 3206 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_add_interface()

int nat44_ed_add_interface ( u32  sw_if_index,
u8  is_inside 
)

Definition at line 1635 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_add_interface_address()

int nat44_ed_add_interface_address ( u32  sw_if_index,
u8  twice_nat 
)

Definition at line 3362 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_add_lb_static_mapping()

int nat44_ed_add_lb_static_mapping ( ip4_address_t  e_addr,
u16  e_port,
nat_protocol_t  proto,
nat44_lb_addr_port_t locals,
u32  flags,
u8 tag,
u32  affinity 
)

Definition at line 1136 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_add_output_interface()

int nat44_ed_add_output_interface ( u32  sw_if_index)

Definition at line 1848 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_add_resolve_record()

void nat44_ed_add_resolve_record ( ip4_address_t  l_addr,
u16  l_port,
u16  e_port,
nat_protocol_t  proto,
u32  vrf_id,
u32  sw_if_index,
u32  flags,
ip4_address_t  pool_addr,
u8 tag 
)

Definition at line 678 of file nat44_ed.c.

+ Here is the caller graph for this function:

◆ nat44_ed_add_static_mapping()

int nat44_ed_add_static_mapping ( ip4_address_t  l_addr,
ip4_address_t  e_addr,
u16  l_port,
u16  e_port,
nat_protocol_t  proto,
u32  vrf_id,
u32  sw_if_index,
u32  flags,
ip4_address_t  pool_addr,
u8 tag 
)

Definition at line 783 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_db_free()

static void nat44_ed_db_free ( )
static

Definition at line 3165 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_db_init()

static void nat44_ed_db_init ( u32  translations,
u32  translation_buckets 
)
static

Definition at line 3125 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_del_address()

int nat44_ed_del_address ( ip4_address_t  addr,
u8  delete_sm,
u8  twice_nat 
)

Definition at line 449 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_del_interface()

int nat44_ed_del_interface ( u32  sw_if_index,
u8  is_inside 
)

Definition at line 1743 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_del_interface_address()

int nat44_ed_del_interface_address ( u32  sw_if_index,
u8  twice_nat 
)

Definition at line 3401 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_del_lb_static_mapping()

int nat44_ed_del_lb_static_mapping ( ip4_address_t  e_addr,
u16  e_port,
nat_protocol_t  proto,
u32  flags 
)

Definition at line 1279 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_del_output_interface()

int nat44_ed_del_output_interface ( u32  sw_if_index)

Definition at line 1946 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_del_resolve_record()

int nat44_ed_del_resolve_record ( ip4_address_t  l_addr,
u16  l_port,
u16  e_port,
nat_protocol_t  proto,
u32  vrf_id,
u32  sw_if_index,
u32  flags 
)

Definition at line 748 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_del_session()

int nat44_ed_del_session ( snat_main_t sm,
ip4_address_t addr,
u16  port,
ip4_address_t eh_addr,
u16  eh_port,
u8  proto,
u32  vrf_id,
int  is_in 
)

Delete NAT44 endpoint-dependent session.

Parameters
smsnat global configuration data
addrIPv4 address
portL4 port number
protoL4 protocol
vrf_idVRF ID
is_in1 = inside network address and port pair, 0 = outside
Returns
0 on success, non-zero value otherwise

Definition at line 3465 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_del_static_mapping()

int nat44_ed_del_static_mapping ( ip4_address_t  l_addr,
ip4_address_t  e_addr,
u16  l_port,
u16  e_port,
nat_protocol_t  proto,
u32  vrf_id,
u32  sw_if_index,
u32  flags 
)

Definition at line 983 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_forwarding_enable_disable()

void nat44_ed_forwarding_enable_disable ( u8  is_enable)

Definition at line 2524 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_free_port()

int nat44_ed_free_port ( ip4_address_t  addr,
u16  port,
nat_protocol_t  proto 
)

Definition at line 639 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_get_in2out_worker_index()

u32 nat44_ed_get_in2out_worker_index ( vlib_buffer_t b,
ip4_header_t ip,
u32  rx_fib_index,
u8  is_output 
)

Definition at line 2757 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_get_interface()

static_always_inline snat_interface_t* nat44_ed_get_interface ( snat_interface_t interfaces,
u32  sw_if_index 
)

Definition at line 1621 of file nat44_ed.c.

+ Here is the caller graph for this function:

◆ nat44_ed_get_out2in_worker_index()

u32 nat44_ed_get_out2in_worker_index ( vlib_buffer_t b,
ip4_header_t ip,
u32  rx_fib_index,
u8  is_output 
)

Definition at line 2882 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_get_outside_fib()

static_always_inline nat_outside_fib_t* nat44_ed_get_outside_fib ( nat_outside_fib_t outside_fibs,
u32  fib_index 
)

Definition at line 1607 of file nat44_ed.c.

+ Here is the caller graph for this function:

◆ nat44_ed_get_resolve_record()

int nat44_ed_get_resolve_record ( ip4_address_t  l_addr,
u16  l_port,
u16  e_port,
nat_protocol_t  proto,
u32  vrf_id,
u32  sw_if_index,
u32  flags,
int *  out 
)

Definition at line 698 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_reserve_port()

int nat44_ed_reserve_port ( ip4_address_t  addr,
u16  port,
nat_protocol_t  proto 
)

Definition at line 598 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_sessions_clear()

void nat44_ed_sessions_clear ( )

Definition at line 3185 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_set_frame_queue_nelts()

int nat44_ed_set_frame_queue_nelts ( u32  frame_queue_nelts)

Definition at line 2058 of file nat44_ed.c.

+ Here is the caller graph for this function:

◆ nat44_ed_update_outside_fib_cb()

static void nat44_ed_update_outside_fib_cb ( ip4_main_t im,
uword  opaque,
u32  sw_if_index,
u32  new_fib_index,
u32  old_fib_index 
)
static

Definition at line 2067 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_validate_sm_input()

static_always_inline int nat44_ed_validate_sm_input ( u32  flags)

Definition at line 764 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_ed_worker_db_free()

static void nat44_ed_worker_db_free ( snat_main_per_thread_data_t tsm)
static

Definition at line 3157 of file nat44_ed.c.

+ Here is the caller graph for this function:

◆ nat44_ed_worker_db_init()

static void nat44_ed_worker_db_init ( snat_main_per_thread_data_t tsm,
u32  translations,
u32  translation_buckets 
)
static

Definition at line 3084 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_get_max_session_limit()

u32 nat44_get_max_session_limit ( )

Definition at line 3032 of file nat44_ed.c.

+ Here is the caller graph for this function:

◆ nat44_plugin_disable()

int nat44_plugin_disable ( )

Definition at line 2457 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_plugin_enable()

int nat44_plugin_enable ( nat44_config_t  c)

Definition at line 2364 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_set_node_indexes()

void nat44_set_node_indexes ( snat_main_t sm,
vlib_main_t vm 
)

Definition at line 2216 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_set_session_limit()

int nat44_set_session_limit ( u32  session_limit,
u32  vrf_id 
)

Set NAT44 session limit (session limit, vrf id)

Parameters
session_limitSession limit
vrf_idVRF id
Returns
0 on success, non-zero value otherwise

Definition at line 3046 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_update_session_limit()

int nat44_update_session_limit ( u32  session_limit,
u32  vrf_id 
)

Update NAT44 session limit flushing all data (session limit, vrf id)

Parameters
session_limitSession limit
vrf_idVRF id
Returns
0 on success, non-zero value otherwise

Definition at line 3065 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_6t_flow_buf_translate()

static_always_inline nat_translation_error_e nat_6t_flow_buf_translate ( vlib_main_t vm,
snat_main_t sm,
vlib_buffer_t b,
ip4_header_t ip,
nat_6t_flow_t f,
nat_protocol_t  proto,
int  is_output_feature,
int  is_i2o 
)

Definition at line 3826 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_6t_flow_buf_translate_i2o()

nat_translation_error_e nat_6t_flow_buf_translate_i2o ( vlib_main_t vm,
snat_main_t sm,
vlib_buffer_t b,
ip4_header_t ip,
nat_6t_flow_t f,
nat_protocol_t  proto,
int  is_output_feature 
)

Definition at line 3862 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_6t_flow_buf_translate_o2i()

nat_translation_error_e nat_6t_flow_buf_translate_o2i ( vlib_main_t vm,
snat_main_t sm,
vlib_buffer_t b,
ip4_header_t ip,
nat_6t_flow_t f,
nat_protocol_t  proto,
int  is_output_feature 
)

Definition at line 3872 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_6t_flow_icmp_translate()

static_always_inline int nat_6t_flow_icmp_translate ( vlib_main_t vm,
snat_main_t sm,
vlib_buffer_t b,
ip4_header_t ip,
nat_6t_flow_t f 
)

Definition at line 3686 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_6t_flow_ip4_translate()

static_always_inline void nat_6t_flow_ip4_translate ( snat_main_t sm,
vlib_buffer_t b,
ip4_header_t ip,
nat_6t_flow_t f,
nat_protocol_t  proto,
int  is_icmp_inner_ip4,
int  skip_saddr_rewrite 
)

Definition at line 3603 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_6t_l3_l4_csum_calc()

void nat_6t_l3_l4_csum_calc ( nat_6t_flow_t f)

Definition at line 3532 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_calc_bihash_buckets()

u32 nat_calc_bihash_buckets ( u32  n_elts)

Definition at line 122 of file lib.h.

+ Here is the caller graph for this function:

◆ nat_default_node()

VLIB_NODE_FN() nat_default_node ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)

Definition at line 3503 of file nat44_ed.c.

◆ nat_ed_static_mapping_del_sessions()

void nat_ed_static_mapping_del_sessions ( snat_main_t sm,
snat_main_per_thread_data_t tsm,
ip4_address_t  l_addr,
u16  l_port,
u8  protocol,
u32  fib_index,
int  addr_only,
ip4_address_t  e_addr,
u16  e_port 
)

Definition at line 554 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_free_session_data()

void nat_free_session_data ( snat_main_t sm,
snat_session_t *  s,
u32  thread_index,
u8  is_ha 
)

Free NAT44 session data (lookup keys, external address port)

Parameters
smsnat global configuration data
sNAT session
thread_indexthread index
is_hais HA event

Definition at line 231 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_init()

static clib_error_t* nat_init ( vlib_main_t vm)
static

Definition at line 2261 of file nat44_ed.c.

+ Here is the call graph for this function:

◆ nat_ip_table_add_del()

static clib_error_t* nat_ip_table_add_del ( vnet_main_t vnm,
u32  table_id,
u32  is_add 
)
static

Definition at line 2199 of file nat44_ed.c.

+ Here is the call graph for this function:

◆ nat_validate_interface_counters()

static_always_inline void nat_validate_interface_counters ( snat_main_t sm,
u32  sw_if_index 
)

Definition at line 2248 of file nat44_ed.c.

+ Here is the caller graph for this function:

◆ reinit_ed_flow_hash()

static void reinit_ed_flow_hash ( )
static

Definition at line 3114 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ snat_free_outside_address_and_port()

void snat_free_outside_address_and_port ( snat_address_t addresses,
u32  thread_index,
ip4_address_t addr,
u16  port,
nat_protocol_t  protocol 
)

Free outside address and port pair.

Parameters
addressesvector of outside addresses
thread_indexthread index
keyaddress, port and protocol

Definition at line 2560 of file nat44_ed.c.

+ Here is the caller graph for this function:

◆ snat_set_workers()

int snat_set_workers ( uword bitmap)

Definition at line 2032 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ snat_static_mapping_match()

int snat_static_mapping_match ( vlib_main_t vm,
snat_main_t sm,
ip4_address_t  match_addr,
u16  match_port,
u32  match_fib_index,
nat_protocol_t  match_protocol,
ip4_address_t mapping_addr,
u16 mapping_port,
u32 mapping_fib_index,
u8  by_external,
u8 is_addr_only,
twice_nat_type_t twice_nat,
lb_nat_type_t lb,
ip4_address_t ext_host_addr,
u8 is_identity_nat,
snat_static_mapping_t **  out 
)

Match NAT44 static mapping.

Parameters
keyaddress and port to match
addrexternal/local address of the matched mapping
portport of the matched mapping
fib_indexfib index of the matched mapping
by_externalif 0 match by local address otherwise match by external address
is_addr_only1 if matched mapping is address only
twice_natmatched mapping is twice NAT type
lb1 if matched mapping is load-balanced
ext_host_addrexternal host address
is_identity_nat1 if indentity mapping
outif !=0 set to pointer of the mapping structure
Returns
0 if match found otherwise 1.

Definition at line 2597 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_key_calc_split()

void test_key_calc_split ( )

Definition at line 2147 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_per_vrf_sessions_vec()

void update_per_vrf_sessions_vec ( u32  fib_index,
int  is_del 
)

Definition at line 1570 of file nat44_ed.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ VLIB_PLUGIN_REGISTER()

VLIB_PLUGIN_REGISTER ( )

◆ VNET_FEATURE_INIT() [1/16]

VNET_FEATURE_INIT ( ip4_nat44_ed_classify  ,
static   
)

◆ VNET_FEATURE_INIT() [2/16]

VNET_FEATURE_INIT ( ip4_nat44_ed_in2out  ,
static   
)

◆ VNET_FEATURE_INIT() [3/16]

VNET_FEATURE_INIT ( ip4_nat44_ed_in2out_output  ,
static   
)

◆ VNET_FEATURE_INIT() [4/16]

VNET_FEATURE_INIT ( ip4_nat44_ed_out2in  ,
static   
)

◆ VNET_FEATURE_INIT() [5/16]

VNET_FEATURE_INIT ( ip4_nat_handoff_classify  ,
static   
)

◆ VNET_FEATURE_INIT() [6/16]

VNET_FEATURE_INIT ( ip4_snat_in2out  ,
static   
)

◆ VNET_FEATURE_INIT() [7/16]

VNET_FEATURE_INIT ( ip4_snat_in2out_fast  ,
static   
)

◆ VNET_FEATURE_INIT() [8/16]

VNET_FEATURE_INIT ( ip4_snat_in2out_output  ,
static   
)

◆ VNET_FEATURE_INIT() [9/16]

VNET_FEATURE_INIT ( ip4_snat_in2out_output_worker_handoff  ,
static   
)

◆ VNET_FEATURE_INIT() [10/16]

VNET_FEATURE_INIT ( ip4_snat_out2in  ,
static   
)

◆ VNET_FEATURE_INIT() [11/16]

VNET_FEATURE_INIT ( ip4_snat_out2in_fast  ,
static   
)

◆ VNET_FEATURE_INIT() [12/16]

VNET_FEATURE_INIT ( nat_pre_in2out  ,
static   
)

◆ VNET_FEATURE_INIT() [13/16]

VNET_FEATURE_INIT ( nat_pre_in2out_output  ,
static   
)

◆ VNET_FEATURE_INIT() [14/16]

VNET_FEATURE_INIT ( nat_pre_out2in  ,
static   
)

◆ VNET_FEATURE_INIT() [15/16]

VNET_FEATURE_INIT ( snat_in2out_worker_handoff  ,
static   
)

◆ VNET_FEATURE_INIT() [16/16]

VNET_FEATURE_INIT ( snat_out2in_worker_handoff  ,
static   
)

◆ VNET_IP_TABLE_ADD_DEL_FUNCTION()

VNET_IP_TABLE_ADD_DEL_FUNCTION ( nat_ip_table_add_del  )

Variable Documentation

◆ nat_default_node

vlib_node_registration_t nat_default_node
Initial value:
= {
.name = "nat-default",
.vector_size = sizeof (u32),
.format_trace = 0,
.n_errors = 0,
.n_next_nodes = NAT_N_NEXT,
.next_nodes = {
[NAT_NEXT_DROP] = "error-drop",
[NAT_NEXT_ICMP_ERROR] = "ip4-icmp-error",
[NAT_NEXT_IN2OUT_ED_FAST_PATH] = "nat44-ed-in2out",
[NAT_NEXT_IN2OUT_ED_SLOW_PATH] = "nat44-ed-in2out-slowpath",
[NAT_NEXT_IN2OUT_ED_OUTPUT_FAST_PATH] = "nat44-ed-in2out-output",
[NAT_NEXT_IN2OUT_ED_OUTPUT_SLOW_PATH] = "nat44-ed-in2out-output-slowpath",
[NAT_NEXT_OUT2IN_ED_FAST_PATH] = "nat44-ed-out2in",
[NAT_NEXT_OUT2IN_ED_SLOW_PATH] = "nat44-ed-out2in-slowpath",
[NAT_NEXT_IN2OUT_CLASSIFY] = "nat44-in2out-worker-handoff",
[NAT_NEXT_OUT2IN_CLASSIFY] = "nat44-out2in-worker-handoff",
},
}

(constructor) VLIB_REGISTER_NODE (nat_default_node)

Definition at line 3510 of file nat44_ed.c.

◆ snat_main

snat_main_t snat_main

Definition at line 41 of file nat44_ed.c.

NAT_NEXT_IN2OUT_CLASSIFY
@ NAT_NEXT_IN2OUT_CLASSIFY
Definition: nat44_ed.h:83
VLIB_NODE_TYPE_INTERNAL
@ VLIB_NODE_TYPE_INTERNAL
Definition: node.h:72
NAT_NEXT_IN2OUT_ED_SLOW_PATH
@ NAT_NEXT_IN2OUT_ED_SLOW_PATH
Definition: nat44_ed.h:78
NAT_NEXT_IN2OUT_ED_OUTPUT_SLOW_PATH
@ NAT_NEXT_IN2OUT_ED_OUTPUT_SLOW_PATH
Definition: nat44_ed.h:80
NAT_NEXT_ICMP_ERROR
@ NAT_NEXT_ICMP_ERROR
Definition: nat44_ed.h:76
NAT_NEXT_IN2OUT_ED_FAST_PATH
@ NAT_NEXT_IN2OUT_ED_FAST_PATH
Definition: nat44_ed.h:77
PREDICT_FALSE
#define PREDICT_FALSE(x)
Definition: clib.h:124
NAT_NEXT_OUT2IN_ED_FAST_PATH
@ NAT_NEXT_OUT2IN_ED_FAST_PATH
Definition: nat44_ed.h:81
c
svmdb_client_t * c
Definition: vpp_get_metrics.c:48
NAT_N_NEXT
@ NAT_N_NEXT
Definition: nat44_ed.h:85
NAT_NEXT_IN2OUT_ED_OUTPUT_FAST_PATH
@ NAT_NEXT_IN2OUT_ED_OUTPUT_FAST_PATH
Definition: nat44_ed.h:79
u32
unsigned int u32
Definition: types.h:88
NAT_NEXT_DROP
@ NAT_NEXT_DROP
Definition: nat44_ed.h:75
NAT_NEXT_OUT2IN_ED_SLOW_PATH
@ NAT_NEXT_OUT2IN_ED_SLOW_PATH
Definition: nat44_ed.h:82
snat_main
snat_main_t snat_main
Definition: nat44_ed.c:41
NAT_NEXT_OUT2IN_CLASSIFY
@ NAT_NEXT_OUT2IN_CLASSIFY
Definition: nat44_ed.h:84
i
int i
Definition: flowhash_template.h:376
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123