FD.io VPP  v17.07-30-g839fa73
Vector Packet Processing
out2in.c File Reference
+ Include dependency graph for out2in.c:

Go to the source code of this file.

Data Structures

struct  snat_out2in_trace_t
 
struct  snat_out2in_worker_handoff_trace_t
 

Macros

#define foreach_snat_out2in_error
 

Enumerations

enum  snat_out2in_error_t { SNAT_OUT2IN_N_ERROR }
 
enum  snat_out2in_next_t { SNAT_OUT2IN_NEXT_DROP, SNAT_OUT2IN_NEXT_LOOKUP, SNAT_OUT2IN_NEXT_ICMP_ERROR, SNAT_OUT2IN_N_NEXT }
 

Functions

static u8format_snat_out2in_trace (u8 *s, va_list *args)
 
static u8format_snat_out2in_fast_trace (u8 *s, va_list *args)
 
static u8format_snat_out2in_worker_handoff_trace (u8 *s, va_list *args)
 
static snat_session_t * create_session_for_static_mapping (snat_main_t *sm, vlib_buffer_t *b0, snat_session_key_t in2out, snat_session_key_t out2in, vlib_node_runtime_t *node, u32 thread_index)
 Create session for static mapping. More...
 
static_always_inline snat_out2in_error_t icmp_get_key (ip4_header_t *ip0, snat_session_key_t *p_key0)
 
u32 icmp_match_out2in_slow (snat_main_t *sm, vlib_node_runtime_t *node, u32 thread_index, vlib_buffer_t *b0, u8 *p_proto, snat_session_key_t *p_value, u8 *p_dont_translate, void *d, void *e)
 Get address and port values to be used for packet SNAT translation and create session if needed. More...
 
u32 icmp_match_out2in_fast (snat_main_t *sm, vlib_node_runtime_t *node, u32 thread_index, vlib_buffer_t *b0, u8 *p_proto, snat_session_key_t *p_value, u8 *p_dont_translate, void *d, void *e)
 Get address and port values to be used for packet SNAT translation. More...
 
static u32 icmp_out2in (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, u32 thread_index, void *d, void *e)
 
static u32 icmp_out2in_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 void snat_out2in_unknown_proto (snat_main_t *sm, vlib_buffer_t *b, ip4_header_t *ip, u32 rx_fib_index)
 
static uword snat_out2in_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VLIB_NODE_FUNCTION_MULTIARCH (snat_out2in_node, snat_out2in_node_fn)
 
static uword snat_det_out2in_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VLIB_NODE_FUNCTION_MULTIARCH (snat_det_out2in_node, snat_det_out2in_node_fn)
 
u32 icmp_match_out2in_det (snat_main_t *sm, vlib_node_runtime_t *node, u32 thread_index, vlib_buffer_t *b0, u8 *p_proto, snat_session_key_t *p_value, u8 *p_dont_translate, void *d, void *e)
 Get address and port values to be used for packet SNAT translation and create session if needed. More...
 
static uword snat_out2in_worker_handoff_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VLIB_NODE_FUNCTION_MULTIARCH (snat_out2in_worker_handoff_node, snat_out2in_worker_handoff_fn)
 
static uword snat_out2in_fast_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VLIB_NODE_FUNCTION_MULTIARCH (snat_out2in_fast_node, snat_out2in_fast_node_fn)
 

Variables

vlib_node_registration_t snat_out2in_node
 (constructor) VLIB_REGISTER_NODE (snat_out2in_node) More...
 
vlib_node_registration_t snat_out2in_fast_node
 (constructor) VLIB_REGISTER_NODE (snat_out2in_fast_node) More...
 
vlib_node_registration_t snat_out2in_worker_handoff_node
 (constructor) VLIB_REGISTER_NODE (snat_out2in_worker_handoff_node) More...
 
vlib_node_registration_t snat_det_out2in_node
 (constructor) VLIB_REGISTER_NODE (snat_det_out2in_node) More...
 
static char * snat_out2in_error_strings []
 

Macro Definition Documentation

#define foreach_snat_out2in_error
Value:
_(UNSUPPORTED_PROTOCOL, "Unsupported protocol") \
_(OUT2IN_PACKETS, "Good out2in packets processed") \
_(BAD_ICMP_TYPE, "unsupported ICMP type") \
_(NO_TRANSLATION, "No translation")

Definition at line 86 of file out2in.c.

Enumeration Type Documentation

Enumerator
SNAT_OUT2IN_N_ERROR 

Definition at line 92 of file out2in.c.

Enumerator
SNAT_OUT2IN_NEXT_DROP 
SNAT_OUT2IN_NEXT_LOOKUP 
SNAT_OUT2IN_NEXT_ICMP_ERROR 
SNAT_OUT2IN_N_NEXT 

Definition at line 105 of file out2in.c.

Function Documentation

static snat_session_t* create_session_for_static_mapping ( snat_main_t sm,
vlib_buffer_t b0,
snat_session_key_t  in2out,
snat_session_key_t  out2in,
vlib_node_runtime_t node,
u32  thread_index 
)
inlinestatic

Create session for static mapping.

Create NAT session initiated by host from external network with static mapping.

Parameters
smSNAT main.
b0Vlib buffer.
in2outIn2out SNAT session key.
out2inOut2in SNAT session key.
nodeVlib node.
Returns
SNAT session if successfully created otherwise 0.

Definition at line 127 of file out2in.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 56 of file out2in.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 45 of file out2in.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 67 of file out2in.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Definition at line 230 of file out2in.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 icmp_match_out2in_det ( snat_main_t sm,
vlib_node_runtime_t node,
u32  thread_index,
vlib_buffer_t b0,
u8 p_proto,
snat_session_key_t p_value,
u8 p_dont_translate,
void *  d,
void *  e 
)

Get address and port values to be used for packet SNAT translation and create session if needed.

Parameters
[in,out]smSNAT main
[in,out]nodeSNAT node runtime
[in]thread_indexthread index
[in,out]b0buffer containing packet to be translated
[out]p_protoprotocol used for matching
[out]p_valueaddress and port after NAT translation
[out]p_dont_translateif packet should not be translated
doptional parameter
eoptional parameter

Definition at line 1702 of file out2in.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 icmp_match_out2in_fast ( snat_main_t sm,
vlib_node_runtime_t node,
u32  thread_index,
vlib_buffer_t b0,
u8 p_proto,
snat_session_key_t p_value,
u8 p_dont_translate,
void *  d,
void *  e 
)

Get address and port values to be used for packet SNAT translation.

Parameters
[in]smSNAT main
[in,out]nodeSNAT node runtime
[in]thread_indexthread index
[in,out]b0buffer containing packet to be translated
[out]p_protoprotocol used for matching
[out]p_valueaddress and port after NAT translation
[out]p_dont_translateif packet should not be translated
doptional parameter
eoptional parameter

Definition at line 398 of file out2in.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 icmp_match_out2in_slow ( snat_main_t sm,
vlib_node_runtime_t node,
u32  thread_index,
vlib_buffer_t b0,
u8 p_proto,
snat_session_key_t p_value,
u8 p_dont_translate,
void *  d,
void *  e 
)

Get address and port values to be used for packet SNAT translation and create session if needed.

Parameters
[in,out]smSNAT main
[in,out]nodeSNAT node runtime
[in]thread_indexthread index
[in,out]b0buffer containing packet to be translated
[out]p_protoprotocol used for matching
[out]p_valueaddress and port after NAT translation
[out]p_dont_translateif packet should not be translated
doptional parameter
eoptional parameter

Definition at line 288 of file out2in.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 icmp_out2in ( 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,
u32  thread_index,
void *  d,
void *  e 
)
inlinestatic

Definition at line 458 of file out2in.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 icmp_out2in_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 581 of file out2in.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 1205 of file out2in.c.

+ Here is the call graph for this function:

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

Definition at line 1992 of file out2in.c.

+ Here is the call graph for this function:

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

Definition at line 646 of file out2in.c.

+ Here is the call graph for this function:

static void snat_out2in_unknown_proto ( snat_main_t sm,
vlib_buffer_t b,
ip4_header_t ip,
u32  rx_fib_index 
)
static

Definition at line 615 of file out2in.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 1832 of file out2in.c.

+ Here is the call graph for this function:

VLIB_NODE_FUNCTION_MULTIARCH ( snat_out2in_node  ,
snat_out2in_node_fn   
)

+ Here is the caller graph for this function:

VLIB_NODE_FUNCTION_MULTIARCH ( snat_det_out2in_node  ,
snat_det_out2in_node_fn   
)
VLIB_NODE_FUNCTION_MULTIARCH ( snat_out2in_worker_handoff_node  ,
snat_out2in_worker_handoff_fn   
)
VLIB_NODE_FUNCTION_MULTIARCH ( snat_out2in_fast_node  ,
snat_out2in_fast_node_fn   
)

Variable Documentation

vlib_node_registration_t snat_det_out2in_node
Initial value:
= {
.name = "snat-det-out2in",
.vector_size = sizeof (u32),
.format_trace = format_snat_out2in_trace,
.error_strings = snat_out2in_error_strings,
.runtime_data_bytes = sizeof (snat_runtime_t),
.n_next_nodes = SNAT_OUT2IN_N_NEXT,
.next_nodes = {
[SNAT_OUT2IN_NEXT_DROP] = "error-drop",
[SNAT_OUT2IN_NEXT_LOOKUP] = "ip4-lookup",
[SNAT_OUT2IN_NEXT_ICMP_ERROR] = "ip4-icmp-error",
},
}
#define ARRAY_LEN(x)
Definition: clib.h:59
unsigned int u32
Definition: types.h:88
static uword snat_det_out2in_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: out2in.c:1205
static char * snat_out2in_error_strings[]
Definition: out2in.c:99
static u8 * format_snat_out2in_trace(u8 *s, va_list *args)
Definition: out2in.c:45

(constructor) VLIB_REGISTER_NODE (snat_det_out2in_node)

Definition at line 84 of file out2in.c.

char* snat_out2in_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}
#define foreach_snat_out2in_error
Definition: out2in.c:86

Definition at line 99 of file out2in.c.

vlib_node_registration_t snat_out2in_fast_node
Initial value:
= {
.name = "snat-out2in-fast",
.vector_size = sizeof (u32),
.error_strings = snat_out2in_error_strings,
.runtime_data_bytes = sizeof (snat_runtime_t),
.n_next_nodes = SNAT_OUT2IN_N_NEXT,
.next_nodes = {
[SNAT_OUT2IN_NEXT_LOOKUP] = "ip4-lookup",
[SNAT_OUT2IN_NEXT_DROP] = "error-drop",
[SNAT_OUT2IN_NEXT_ICMP_ERROR] = "ip4-icmp-error",
},
}
static u8 * format_snat_out2in_fast_trace(u8 *s, va_list *args)
Definition: out2in.c:56
#define ARRAY_LEN(x)
Definition: clib.h:59
unsigned int u32
Definition: types.h:88
static char * snat_out2in_error_strings[]
Definition: out2in.c:99
static uword snat_out2in_fast_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: out2in.c:1992

(constructor) VLIB_REGISTER_NODE (snat_out2in_fast_node)

Definition at line 82 of file out2in.c.

vlib_node_registration_t snat_out2in_node
Initial value:
= {
.function = snat_out2in_node_fn,
.name = "snat-out2in",
.vector_size = sizeof (u32),
.format_trace = format_snat_out2in_trace,
.error_strings = snat_out2in_error_strings,
.runtime_data_bytes = sizeof (snat_runtime_t),
.n_next_nodes = SNAT_OUT2IN_N_NEXT,
.next_nodes = {
[SNAT_OUT2IN_NEXT_DROP] = "error-drop",
[SNAT_OUT2IN_NEXT_LOOKUP] = "ip4-lookup",
[SNAT_OUT2IN_NEXT_ICMP_ERROR] = "ip4-icmp-error",
},
}
#define ARRAY_LEN(x)
Definition: clib.h:59
unsigned int u32
Definition: types.h:88
static char * snat_out2in_error_strings[]
Definition: out2in.c:99
static u8 * format_snat_out2in_trace(u8 *s, va_list *args)
Definition: out2in.c:45
static uword snat_out2in_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: out2in.c:646

(constructor) VLIB_REGISTER_NODE (snat_out2in_node)

Definition at line 81 of file out2in.c.

vlib_node_registration_t snat_out2in_worker_handoff_node
Initial value:
= {
.name = "snat-out2in-worker-handoff",
.vector_size = sizeof (u32),
.n_next_nodes = 1,
.next_nodes = {
[0] = "error-drop",
},
}
static uword snat_out2in_worker_handoff_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: out2in.c:1832
unsigned int u32
Definition: types.h:88
static u8 * format_snat_out2in_worker_handoff_trace(u8 *s, va_list *args)
Definition: out2in.c:67

(constructor) VLIB_REGISTER_NODE (snat_out2in_worker_handoff_node)

Definition at line 83 of file out2in.c.