FD.io VPP  v18.10-32-g1161dda
Vector Packet Processing
in2out_ed.c File Reference

NAT44 endpoint-dependent inside to outside network translation. More...

+ Include dependency graph for in2out_ed.c:

Go to the source code of this file.

Data Structures

struct  nat_in2out_ed_trace_t
 

Macros

#define foreach_nat_in2out_ed_error
 

Enumerations

enum  nat_in2out_ed_error_t { NAT_IN2OUT_ED_N_ERROR }
 
enum  nat_in2out_ed_next_t {
  NAT_IN2OUT_ED_NEXT_LOOKUP, NAT_IN2OUT_ED_NEXT_DROP, NAT_IN2OUT_ED_NEXT_ICMP_ERROR, NAT_IN2OUT_ED_NEXT_SLOW_PATH,
  NAT_IN2OUT_ED_NEXT_REASS, NAT_IN2OUT_ED_N_NEXT
}
 

Functions

static u8format_nat_in2out_ed_trace (u8 *s, va_list *args)
 
static_always_inline int icmp_get_ed_key (ip4_header_t *ip0, nat_ed_ses_key_t *p_key0)
 
int nat44_i2o_ed_is_idle_session_cb (clib_bihash_kv_16_8_t *kv, void *arg)
 
static u32 icmp_in2out_ed_slow_path (snat_main_t *sm, vlib_buffer_t *b0, ip4_header_t *ip0, icmp46_header_t *icmp0, u32 sw_if_index0, u32 rx_fib_index0, vlib_node_runtime_t *node, u32 next0, f64 now, u32 thread_index, snat_session_t **p_s0)
 
static u32 slow_path_ed (snat_main_t *sm, vlib_buffer_t *b, u32 rx_fib_index, clib_bihash_kv_16_8_t *kv, snat_session_t **sessionp, vlib_node_runtime_t *node, u32 next, u32 thread_index, f64 now, tcp_header_t *tcp)
 
static_always_inline int nat44_ed_not_translate (snat_main_t *sm, vlib_node_runtime_t *node, u32 sw_if_index, ip4_header_t *ip, u32 proto, u32 rx_fib_index, u32 thread_index)
 
static_always_inline int nat_not_translate_output_feature_fwd (snat_main_t *sm, ip4_header_t *ip, u32 thread_index, f64 now, vlib_main_t *vm, vlib_buffer_t *b)
 
static_always_inline int nat44_ed_not_translate_output_feature (snat_main_t *sm, ip4_header_t *ip, u8 proto, u16 src_port, u16 dst_port, u32 thread_index, u32 rx_sw_if_index, u32 tx_sw_if_index)
 
u32 icmp_match_in2out_ed (snat_main_t *sm, vlib_node_runtime_t *node, u32 thread_index, vlib_buffer_t *b, ip4_header_t *ip, u8 *p_proto, snat_session_key_t *p_value, u8 *p_dont_translate, void *d, void *e)
 
static snat_session_t * nat44_ed_in2out_unknown_proto (snat_main_t *sm, vlib_buffer_t *b, ip4_header_t *ip, u32 rx_fib_index, u32 thread_index, f64 now, vlib_main_t *vm, vlib_node_runtime_t *node)
 
static uword nat44_ed_in2out_node_fn_inline (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_slow_path, int is_output_feature)
 
static uword nat44_ed_in2out_fast_path_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VLIB_NODE_FUNCTION_MULTIARCH (nat44_ed_in2out_node, nat44_ed_in2out_fast_path_fn)
 
static uword nat44_ed_in2out_output_fast_path_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VLIB_NODE_FUNCTION_MULTIARCH (nat44_ed_in2out_output_node, nat44_ed_in2out_output_fast_path_fn)
 
static uword nat44_ed_in2out_slow_path_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VLIB_NODE_FUNCTION_MULTIARCH (nat44_ed_in2out_slowpath_node, nat44_ed_in2out_slow_path_fn)
 
static uword nat44_ed_in2out_output_slow_path_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VLIB_NODE_FUNCTION_MULTIARCH (nat44_ed_in2out_output_slowpath_node, nat44_ed_in2out_output_slow_path_fn)
 
static uword nat44_ed_in2out_reass_node_fn_inline (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_output_feature)
 
static uword nat44_ed_in2out_reass_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VLIB_NODE_FUNCTION_MULTIARCH (nat44_ed_in2out_reass_node, nat44_ed_in2out_reass_node_fn)
 
static uword nat44_ed_in2out_reass_output_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VLIB_NODE_FUNCTION_MULTIARCH (nat44_ed_in2out_reass_output_node, nat44_ed_in2out_reass_output_node_fn)
 

Variables

static char * nat_in2out_ed_error_strings []
 
vlib_node_registration_t nat44_ed_in2out_node
 (constructor) VLIB_REGISTER_NODE (nat44_ed_in2out_node) More...
 
vlib_node_registration_t nat44_ed_in2out_slowpath_node
 (constructor) VLIB_REGISTER_NODE (nat44_ed_in2out_slowpath_node) More...
 
vlib_node_registration_t nat44_ed_in2out_output_node
 (constructor) VLIB_REGISTER_NODE (nat44_ed_in2out_output_node) More...
 
vlib_node_registration_t nat44_ed_in2out_output_slowpath_node
 (constructor) VLIB_REGISTER_NODE (nat44_ed_in2out_output_slowpath_node) More...
 
vlib_node_registration_t nat44_ed_in2out_reass_node
 (constructor) VLIB_REGISTER_NODE (nat44_ed_in2out_reass_node) More...
 
vlib_node_registration_t nat44_ed_in2out_reass_output_node
 (constructor) VLIB_REGISTER_NODE (nat44_ed_in2out_reass_output_node) More...
 

Detailed Description

NAT44 endpoint-dependent inside to outside network translation.

Definition in file in2out_ed.c.

Macro Definition Documentation

#define foreach_nat_in2out_ed_error
Value:
_(UNSUPPORTED_PROTOCOL, "Unsupported protocol") \
_(IN2OUT_PACKETS, "Good in2out packets processed") \
_(OUT_OF_PORTS, "Out of ports") \
_(BAD_ICMP_TYPE, "unsupported ICMP type") \
_(MAX_SESSIONS_EXCEEDED, "Maximum sessions exceeded") \
_(DROP_FRAGMENT, "Drop fragment") \
_(MAX_REASS, "Maximum reassemblies exceeded") \
_(MAX_FRAG, "Maximum fragments per reassembly exceeded")\
_(NON_SYN, "non-SYN packet try to create session")

Definition at line 32 of file in2out_ed.c.

Enumeration Type Documentation

Enumerator
NAT_IN2OUT_ED_N_ERROR 

Definition at line 43 of file in2out_ed.c.

Enumerator
NAT_IN2OUT_ED_NEXT_LOOKUP 
NAT_IN2OUT_ED_NEXT_DROP 
NAT_IN2OUT_ED_NEXT_ICMP_ERROR 
NAT_IN2OUT_ED_NEXT_SLOW_PATH 
NAT_IN2OUT_ED_NEXT_REASS 
NAT_IN2OUT_ED_N_NEXT 

Definition at line 57 of file in2out_ed.c.

Function Documentation

static u8* format_nat_in2out_ed_trace ( u8 s,
va_list *  args 
)
static

Definition at line 82 of file in2out_ed.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline int icmp_get_ed_key ( ip4_header_t ip0,
nat_ed_ses_key_t p_key0 
)

Definition at line 100 of file in2out_ed.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 icmp_in2out_ed_slow_path ( snat_main_t sm,
vlib_buffer_t b0,
ip4_header_t ip0,
icmp46_header_t *  icmp0,
u32  sw_if_index0,
u32  rx_fib_index0,
vlib_node_runtime_t node,
u32  next0,
f64  now,
u32  thread_index,
snat_session_t **  p_s0 
)
inlinestatic

Definition at line 231 of file in2out_ed.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 icmp_match_in2out_ed ( snat_main_t sm,
vlib_node_runtime_t node,
u32  thread_index,
vlib_buffer_t b,
ip4_header_t ip,
u8 p_proto,
snat_session_key_t p_value,
u8 p_dont_translate,
void *  d,
void *  e 
)

Definition at line 565 of file in2out_ed.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword nat44_ed_in2out_fast_path_fn ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

Definition at line 1598 of file in2out_ed.c.

+ Here is the call graph for this function:

static uword nat44_ed_in2out_node_fn_inline ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame,
int  is_slow_path,
int  is_output_feature 
)
inlinestatic

Definition at line 875 of file in2out_ed.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword nat44_ed_in2out_output_fast_path_fn ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

Definition at line 1630 of file in2out_ed.c.

+ Here is the call graph for this function:

static uword nat44_ed_in2out_output_slow_path_fn ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

Definition at line 1694 of file in2out_ed.c.

+ Here is the call graph for this function:

static uword nat44_ed_in2out_reass_node_fn ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

Definition at line 2063 of file in2out_ed.c.

+ Here is the call graph for this function:

static uword nat44_ed_in2out_reass_node_fn_inline ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame,
int  is_output_feature 
)
inlinestatic

Definition at line 1726 of file in2out_ed.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword nat44_ed_in2out_reass_output_node_fn ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

Definition at line 2094 of file in2out_ed.c.

+ Here is the call graph for this function:

static uword nat44_ed_in2out_slow_path_fn ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

Definition at line 1662 of file in2out_ed.c.

+ Here is the call graph for this function:

static snat_session_t* nat44_ed_in2out_unknown_proto ( snat_main_t sm,
vlib_buffer_t b,
ip4_header_t ip,
u32  rx_fib_index,
u32  thread_index,
f64  now,
vlib_main_t vm,
vlib_node_runtime_t node 
)
static

Definition at line 675 of file in2out_ed.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline int nat44_ed_not_translate ( snat_main_t sm,
vlib_node_runtime_t node,
u32  sw_if_index,
ip4_header_t ip,
u32  proto,
u32  rx_fib_index,
u32  thread_index 
)

Definition at line 416 of file in2out_ed.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline int nat44_ed_not_translate_output_feature ( snat_main_t sm,
ip4_header_t ip,
u8  proto,
u16  src_port,
u16  dst_port,
u32  thread_index,
u32  rx_sw_if_index,
u32  tx_sw_if_index 
)

Definition at line 511 of file in2out_ed.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int nat44_i2o_ed_is_idle_session_cb ( clib_bihash_kv_16_8_t kv,
void *  arg 
)

Definition at line 149 of file in2out_ed.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline int nat_not_translate_output_feature_fwd ( snat_main_t sm,
ip4_header_t ip,
u32  thread_index,
f64  now,
vlib_main_t vm,
vlib_buffer_t b 
)

Definition at line 451 of file in2out_ed.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 slow_path_ed ( snat_main_t sm,
vlib_buffer_t b,
u32  rx_fib_index,
clib_bihash_kv_16_8_t kv,
snat_session_t **  sessionp,
vlib_node_runtime_t node,
u32  next,
u32  thread_index,
f64  now,
tcp_header_t tcp 
)
static

Definition at line 253 of file in2out_ed.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VLIB_NODE_FUNCTION_MULTIARCH ( nat44_ed_in2out_node  ,
nat44_ed_in2out_fast_path_fn   
)

+ Here is the caller graph for this function:

VLIB_NODE_FUNCTION_MULTIARCH ( nat44_ed_in2out_output_node  ,
nat44_ed_in2out_output_fast_path_fn   
)
VLIB_NODE_FUNCTION_MULTIARCH ( nat44_ed_in2out_slowpath_node  ,
nat44_ed_in2out_slow_path_fn   
)
VLIB_NODE_FUNCTION_MULTIARCH ( nat44_ed_in2out_reass_node  ,
nat44_ed_in2out_reass_node_fn   
)

Variable Documentation

vlib_node_registration_t nat44_ed_in2out_node
Initial value:
= {
.name = "nat44-ed-in2out",
.vector_size = sizeof (u32),
.format_trace = format_nat_in2out_ed_trace,
.error_strings = nat_in2out_ed_error_strings,
.runtime_data_bytes = sizeof (snat_runtime_t),
.n_next_nodes = NAT_IN2OUT_ED_N_NEXT,
.next_nodes = {
[NAT_IN2OUT_ED_NEXT_DROP] = "error-drop",
[NAT_IN2OUT_ED_NEXT_LOOKUP] = "ip4-lookup",
[NAT_IN2OUT_ED_NEXT_SLOW_PATH] = "nat44-ed-in2out-slowpath",
[NAT_IN2OUT_ED_NEXT_ICMP_ERROR] = "ip4-icmp-error",
[NAT_IN2OUT_ED_NEXT_REASS] = "nat44-ed-in2out-reass",
},
}
unsigned int u32
Definition: types.h:88
static uword nat44_ed_in2out_fast_path_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: in2out_ed.c:1598
static u8 * format_nat_in2out_ed_trace(u8 *s, va_list *args)
Definition: in2out_ed.c:82
#define ARRAY_LEN(x)
Definition: clib.h:61
static char * nat_in2out_ed_error_strings[]
Definition: in2out_ed.c:51

(constructor) VLIB_REGISTER_NODE (nat44_ed_in2out_node)

Definition at line 75 of file in2out_ed.c.

vlib_node_registration_t nat44_ed_in2out_output_node
Initial value:
= {
.name = "nat44-ed-in2out-output",
.vector_size = sizeof (u32),
.format_trace = format_nat_in2out_ed_trace,
.error_strings = nat_in2out_ed_error_strings,
.runtime_data_bytes = sizeof (snat_runtime_t),
.n_next_nodes = NAT_IN2OUT_ED_N_NEXT,
.next_nodes = {
[NAT_IN2OUT_ED_NEXT_DROP] = "error-drop",
[NAT_IN2OUT_ED_NEXT_LOOKUP] = "interface-output",
[NAT_IN2OUT_ED_NEXT_SLOW_PATH] = "nat44-ed-in2out-output-slowpath",
[NAT_IN2OUT_ED_NEXT_ICMP_ERROR] = "ip4-icmp-error",
[NAT_IN2OUT_ED_NEXT_REASS] = "nat44-ed-in2out-reass-output",
},
}
static uword nat44_ed_in2out_output_fast_path_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: in2out_ed.c:1630
unsigned int u32
Definition: types.h:88
static u8 * format_nat_in2out_ed_trace(u8 *s, va_list *args)
Definition: in2out_ed.c:82
#define ARRAY_LEN(x)
Definition: clib.h:61
static char * nat_in2out_ed_error_strings[]
Definition: in2out_ed.c:51

(constructor) VLIB_REGISTER_NODE (nat44_ed_in2out_output_node)

Definition at line 77 of file in2out_ed.c.

vlib_node_registration_t nat44_ed_in2out_output_slowpath_node
Initial value:
= {
.name = "nat44-ed-in2out-output-slowpath",
.vector_size = sizeof (u32),
.format_trace = format_nat_in2out_ed_trace,
.error_strings = nat_in2out_ed_error_strings,
.runtime_data_bytes = sizeof (snat_runtime_t),
.n_next_nodes = NAT_IN2OUT_ED_N_NEXT,
.next_nodes = {
[NAT_IN2OUT_ED_NEXT_DROP] = "error-drop",
[NAT_IN2OUT_ED_NEXT_LOOKUP] = "interface-output",
[NAT_IN2OUT_ED_NEXT_SLOW_PATH] = "nat44-ed-in2out-output-slowpath",
[NAT_IN2OUT_ED_NEXT_ICMP_ERROR] = "ip4-icmp-error",
[NAT_IN2OUT_ED_NEXT_REASS] = "nat44-ed-in2out-reass",
},
}
unsigned int u32
Definition: types.h:88
static uword nat44_ed_in2out_output_slow_path_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: in2out_ed.c:1694
static u8 * format_nat_in2out_ed_trace(u8 *s, va_list *args)
Definition: in2out_ed.c:82
#define ARRAY_LEN(x)
Definition: clib.h:61
static char * nat_in2out_ed_error_strings[]
Definition: in2out_ed.c:51

(constructor) VLIB_REGISTER_NODE (nat44_ed_in2out_output_slowpath_node)

Definition at line 78 of file in2out_ed.c.

vlib_node_registration_t nat44_ed_in2out_reass_node
Initial value:
= {
.name = "nat44-ed-in2out-reass",
.vector_size = sizeof (u32),
.format_trace = format_nat44_reass_trace,
.error_strings = nat_in2out_ed_error_strings,
.n_next_nodes = NAT_IN2OUT_ED_N_NEXT,
.next_nodes = {
[NAT_IN2OUT_ED_NEXT_DROP] = "error-drop",
[NAT_IN2OUT_ED_NEXT_LOOKUP] = "ip4-lookup",
[NAT_IN2OUT_ED_NEXT_SLOW_PATH] = "nat44-in2out-slowpath",
[NAT_IN2OUT_ED_NEXT_ICMP_ERROR] = "ip4-icmp-error",
[NAT_IN2OUT_ED_NEXT_REASS] = "nat44-ed-in2out-reass",
},
}
unsigned int u32
Definition: types.h:88
#define ARRAY_LEN(x)
Definition: clib.h:61
static uword nat44_ed_in2out_reass_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: in2out_ed.c:2063
format_function_t format_nat44_reass_trace
Definition: nat.h:590
static char * nat_in2out_ed_error_strings[]
Definition: in2out_ed.c:51

(constructor) VLIB_REGISTER_NODE (nat44_ed_in2out_reass_node)

Definition at line 79 of file in2out_ed.c.

vlib_node_registration_t nat44_ed_in2out_reass_output_node
Initial value:
= {
.name = "nat44-ed-in2out-reass-output",
.vector_size = sizeof (u32),
.format_trace = format_nat44_reass_trace,
.error_strings = nat_in2out_ed_error_strings,
.n_next_nodes = NAT_IN2OUT_ED_N_NEXT,
.next_nodes = {
[NAT_IN2OUT_ED_NEXT_DROP] = "error-drop",
[NAT_IN2OUT_ED_NEXT_LOOKUP] = "interface-output",
[NAT_IN2OUT_ED_NEXT_SLOW_PATH] = "nat44-in2out-slowpath",
[NAT_IN2OUT_ED_NEXT_ICMP_ERROR] = "ip4-icmp-error",
[NAT_IN2OUT_ED_NEXT_REASS] = "nat44-ed-in2out-reass",
},
}
unsigned int u32
Definition: types.h:88
static uword nat44_ed_in2out_reass_output_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: in2out_ed.c:2094
#define ARRAY_LEN(x)
Definition: clib.h:61
format_function_t format_nat44_reass_trace
Definition: nat.h:590
static char * nat_in2out_ed_error_strings[]
Definition: in2out_ed.c:51

(constructor) VLIB_REGISTER_NODE (nat44_ed_in2out_reass_output_node)

Definition at line 2102 of file in2out_ed.c.

vlib_node_registration_t nat44_ed_in2out_slowpath_node
Initial value:
= {
.name = "nat44-ed-in2out-slowpath",
.vector_size = sizeof (u32),
.format_trace = format_nat_in2out_ed_trace,
.error_strings = nat_in2out_ed_error_strings,
.runtime_data_bytes = sizeof (snat_runtime_t),
.n_next_nodes = NAT_IN2OUT_ED_N_NEXT,
.next_nodes = {
[NAT_IN2OUT_ED_NEXT_DROP] = "error-drop",
[NAT_IN2OUT_ED_NEXT_LOOKUP] = "ip4-lookup",
[NAT_IN2OUT_ED_NEXT_SLOW_PATH] = "nat44-ed-in2out-slowpath",
[NAT_IN2OUT_ED_NEXT_ICMP_ERROR] = "ip4-icmp-error",
[NAT_IN2OUT_ED_NEXT_REASS] = "nat44-ed-in2out-reass",
},
}
unsigned int u32
Definition: types.h:88
static u8 * format_nat_in2out_ed_trace(u8 *s, va_list *args)
Definition: in2out_ed.c:82
#define ARRAY_LEN(x)
Definition: clib.h:61
static uword nat44_ed_in2out_slow_path_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: in2out_ed.c:1662
static char * nat_in2out_ed_error_strings[]
Definition: in2out_ed.c:51

(constructor) VLIB_REGISTER_NODE (nat44_ed_in2out_slowpath_node)

Definition at line 76 of file in2out_ed.c.

char* nat_in2out_ed_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}
#define foreach_nat_in2out_ed_error
Definition: in2out_ed.c:32

Definition at line 51 of file in2out_ed.c.