FD.io VPP  v19.01.3-6-g70449b9b9
Vector Packet Processing
nat64_in2out.c File Reference

NAT64 IPv6 to IPv4 translation (inside to outside network) More...

+ Include dependency graph for nat64_in2out.c:

Go to the source code of this file.

Data Structures

struct  nat64_in2out_trace_t
 
struct  nat64_in2out_reass_trace_t
 
struct  nat64_in2out_set_ctx_t_
 
struct  unk_proto_st_walk_ctx_t_
 
struct  nat64_in2out_frag_set_ctx_t_
 
struct  nat64_in2out_handoff_trace_t
 

Macros

#define foreach_nat64_in2out_error
 
#define foreach_nat64_in2out_handoff_error
 

Typedefs

typedef struct nat64_in2out_set_ctx_t_ nat64_in2out_set_ctx_t
 
typedef struct unk_proto_st_walk_ctx_t_ unk_proto_st_walk_ctx_t
 
typedef struct nat64_in2out_frag_set_ctx_t_ nat64_in2out_frag_set_ctx_t
 

Enumerations

enum  nat64_in2out_error_t { NAT64_IN2OUT_N_ERROR }
 
enum  nat64_in2out_next_t {
  NAT64_IN2OUT_NEXT_IP4_LOOKUP, NAT64_IN2OUT_NEXT_IP6_LOOKUP, NAT64_IN2OUT_NEXT_DROP, NAT64_IN2OUT_NEXT_SLOWPATH,
  NAT64_IN2OUT_NEXT_REASS, NAT64_IN2OUT_N_NEXT
}
 
enum  nat64_in2out_handoff_error_t { NAT64_IN2OUT_HANDOFF_N_ERROR }
 

Functions

static u8format_nat64_in2out_trace (u8 *s, va_list *args)
 
static u8format_nat64_in2out_reass_trace (u8 *s, va_list *args)
 
static u8 nat64_not_translate (u32 sw_if_index, ip6_address_t ip6_addr)
 
static_always_inline int is_hairpinning (ip6_address_t *dst_addr)
 Check whether is a hairpinning. More...
 
static int nat64_in2out_tcp_udp_set_cb (ip6_header_t *ip6, ip4_header_t *ip4, void *arg)
 
static int nat64_in2out_icmp_set_cb (ip6_header_t *ip6, ip4_header_t *ip4, void *arg)
 
static int nat64_in2out_inner_icmp_set_cb (ip6_header_t *ip6, ip4_header_t *ip4, void *arg)
 
static int unk_proto_st_walk (nat64_db_st_entry_t *ste, void *arg)
 
static int nat64_in2out_unk_proto_set_cb (ip6_header_t *ip6, ip4_header_t *ip4, void *arg)
 
static int nat64_in2out_tcp_udp_hairpinning (vlib_main_t *vm, vlib_buffer_t *b, ip6_header_t *ip6, u32 thread_index)
 
static int nat64_in2out_icmp_hairpinning (vlib_main_t *vm, vlib_buffer_t *b, ip6_header_t *ip6, u32 thread_index)
 
static int nat64_in2out_unk_proto_hairpinning (vlib_main_t *vm, vlib_buffer_t *b, ip6_header_t *ip6, u32 thread_index)
 
static uword nat64_in2out_node_fn_inline (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 is_slow_path)
 
static uword nat64_in2out_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VLIB_NODE_FUNCTION_MULTIARCH (nat64_in2out_node, nat64_in2out_node_fn)
 
static uword nat64_in2out_slowpath_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VLIB_NODE_FUNCTION_MULTIARCH (nat64_in2out_slowpath_node, nat64_in2out_slowpath_node_fn)
 
static int nat64_in2out_frag_set_cb (ip6_header_t *ip6, ip4_header_t *ip4, void *arg)
 
static int nat64_in2out_frag_hairpinning (vlib_buffer_t *b, ip6_header_t *ip6, nat64_in2out_frag_set_ctx_t *ctx)
 
static uword nat64_in2out_reass_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VLIB_NODE_FUNCTION_MULTIARCH (nat64_in2out_reass_node, nat64_in2out_reass_node_fn)
 
static u8format_nat64_in2out_handoff_trace (u8 *s, va_list *args)
 
static uword nat64_in2out_handoff_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VLIB_NODE_FUNCTION_MULTIARCH (nat64_in2out_handoff_node, nat64_in2out_handoff_node_fn)
 

Variables

vlib_node_registration_t nat64_in2out_node
 (constructor) VLIB_REGISTER_NODE (nat64_in2out_node) More...
 
vlib_node_registration_t nat64_in2out_slowpath_node
 (constructor) VLIB_REGISTER_NODE (nat64_in2out_slowpath_node) More...
 
vlib_node_registration_t nat64_in2out_reass_node
 (constructor) VLIB_REGISTER_NODE (nat64_in2out_reass_node) More...
 
vlib_node_registration_t nat64_in2out_handoff_node
 (constructor) VLIB_REGISTER_NODE (nat64_in2out_handoff_node) More...
 
static char * nat64_in2out_error_strings []
 
static char * nat64_in2out_handoff_error_strings []
 

Detailed Description

NAT64 IPv6 to IPv4 translation (inside to outside network)

Definition in file nat64_in2out.c.

Macro Definition Documentation

◆ foreach_nat64_in2out_error

#define foreach_nat64_in2out_error
Value:
_(UNSUPPORTED_PROTOCOL, "unsupported protocol") \
_(IN2OUT_PACKETS, "good in2out packets processed") \
_(NO_TRANSLATION, "no translation") \
_(UNKNOWN, "unknown") \
_(DROP_FRAGMENT, "drop fragment") \
_(MAX_REASS, "maximum reassemblies exceeded") \
_(MAX_FRAG, "maximum fragments per reassembly exceeded") \
_(TCP_PACKETS, "TCP packets") \
_(UDP_PACKETS, "UDP packets") \
_(ICMP_PACKETS, "ICMP packets") \
_(OTHER_PACKETS, "other protocol packets") \
_(FRAGMENTS, "fragments") \
_(CACHED_FRAGMENTS, "cached fragments") \
_(PROCESSED_FRAGMENTS, "processed fragments")

Definition at line 78 of file nat64_in2out.c.

◆ foreach_nat64_in2out_handoff_error

#define foreach_nat64_in2out_handoff_error
Value:
_(CONGESTION_DROP, "congestion drop") \
_(SAME_WORKER, "same worker") \
_(DO_HANDOFF, "do handoff")

Definition at line 1686 of file nat64_in2out.c.

Typedef Documentation

◆ nat64_in2out_frag_set_ctx_t

◆ nat64_in2out_set_ctx_t

◆ unk_proto_st_walk_ctx_t

Enumeration Type Documentation

◆ nat64_in2out_error_t

Enumerator
NAT64_IN2OUT_N_ERROR 

Definition at line 95 of file nat64_in2out.c.

◆ nat64_in2out_handoff_error_t

Enumerator
NAT64_IN2OUT_HANDOFF_N_ERROR 

Definition at line 1691 of file nat64_in2out.c.

◆ nat64_in2out_next_t

Enumerator
NAT64_IN2OUT_NEXT_IP4_LOOKUP 
NAT64_IN2OUT_NEXT_IP6_LOOKUP 
NAT64_IN2OUT_NEXT_DROP 
NAT64_IN2OUT_NEXT_SLOWPATH 
NAT64_IN2OUT_NEXT_REASS 
NAT64_IN2OUT_N_NEXT 

Definition at line 109 of file nat64_in2out.c.

Function Documentation

◆ format_nat64_in2out_handoff_trace()

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

Definition at line 1711 of file nat64_in2out.c.

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

◆ format_nat64_in2out_reass_trace()

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

Definition at line 58 of file nat64_in2out.c.

+ Here is the call graph for this function:

◆ format_nat64_in2out_trace()

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

Definition at line 34 of file nat64_in2out.c.

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

◆ is_hairpinning()

static_always_inline int is_hairpinning ( ip6_address_t dst_addr)

Check whether is a hairpinning.

If the destination IP address of the packet is an IPv4 address assigned to the NAT64 itself, then the packet is a hairpin packet.

param dst_addr Destination address of the packet.

Returns
1 if hairpinning, otherwise 0.

Definition at line 157 of file nat64_in2out.c.

+ Here is the caller graph for this function:

◆ nat64_in2out_frag_hairpinning()

static int nat64_in2out_frag_hairpinning ( vlib_buffer_t b,
ip6_header_t ip6,
nat64_in2out_frag_set_ctx_t ctx 
)
static

Definition at line 1293 of file nat64_in2out.c.

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

◆ nat64_in2out_frag_set_cb()

static int nat64_in2out_frag_set_cb ( ip6_header_t ip6,
ip4_header_t ip4,
void *  arg 
)
static

Definition at line 1241 of file nat64_in2out.c.

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

◆ nat64_in2out_handoff_node_fn()

static uword nat64_in2out_handoff_node_fn ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
inlinestatic

Definition at line 1725 of file nat64_in2out.c.

+ Here is the call graph for this function:

◆ nat64_in2out_icmp_hairpinning()

static int nat64_in2out_icmp_hairpinning ( vlib_main_t vm,
vlib_buffer_t b,
ip6_header_t ip6,
u32  thread_index 
)
static

Definition at line 713 of file nat64_in2out.c.

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

◆ nat64_in2out_icmp_set_cb()

static int nat64_in2out_icmp_set_cb ( ip6_header_t ip6,
ip4_header_t ip4,
void *  arg 
)
static

Definition at line 265 of file nat64_in2out.c.

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

◆ nat64_in2out_inner_icmp_set_cb()

static int nat64_in2out_inner_icmp_set_cb ( ip6_header_t ip6,
ip4_header_t ip4,
void *  arg 
)
static

Definition at line 357 of file nat64_in2out.c.

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

◆ nat64_in2out_node_fn()

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

Definition at line 1170 of file nat64_in2out.c.

+ Here is the call graph for this function:

◆ nat64_in2out_node_fn_inline()

static uword nat64_in2out_node_fn_inline ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame,
u8  is_slow_path 
)
inlinestatic

Definition at line 960 of file nat64_in2out.c.

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

◆ nat64_in2out_reass_node_fn()

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

Definition at line 1378 of file nat64_in2out.c.

+ Here is the call graph for this function:

◆ nat64_in2out_slowpath_node_fn()

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

Definition at line 1200 of file nat64_in2out.c.

+ Here is the call graph for this function:

◆ nat64_in2out_tcp_udp_hairpinning()

static int nat64_in2out_tcp_udp_hairpinning ( vlib_main_t vm,
vlib_buffer_t b,
ip6_header_t ip6,
u32  thread_index 
)
static

Definition at line 590 of file nat64_in2out.c.

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

◆ nat64_in2out_tcp_udp_set_cb()

static int nat64_in2out_tcp_udp_set_cb ( ip6_header_t ip6,
ip4_header_t ip4,
void *  arg 
)
static

Definition at line 172 of file nat64_in2out.c.

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

◆ nat64_in2out_unk_proto_hairpinning()

static int nat64_in2out_unk_proto_hairpinning ( vlib_main_t vm,
vlib_buffer_t b,
ip6_header_t ip6,
u32  thread_index 
)
static

Definition at line 839 of file nat64_in2out.c.

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

◆ nat64_in2out_unk_proto_set_cb()

static int nat64_in2out_unk_proto_set_cb ( ip6_header_t ip6,
ip4_header_t ip4,
void *  arg 
)
static

Definition at line 485 of file nat64_in2out.c.

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

◆ nat64_not_translate()

static u8 nat64_not_translate ( u32  sw_if_index,
ip6_address_t  ip6_addr 
)
inlinestatic

Definition at line 127 of file nat64_in2out.c.

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

◆ unk_proto_st_walk()

static int unk_proto_st_walk ( nat64_db_st_entry_t *  ste,
void *  arg 
)
static

Definition at line 450 of file nat64_in2out.c.

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

◆ VLIB_NODE_FUNCTION_MULTIARCH() [1/4]

VLIB_NODE_FUNCTION_MULTIARCH ( nat64_in2out_node  ,
nat64_in2out_node_fn   
)
+ Here is the caller graph for this function:

◆ VLIB_NODE_FUNCTION_MULTIARCH() [2/4]

VLIB_NODE_FUNCTION_MULTIARCH ( nat64_in2out_slowpath_node  ,
nat64_in2out_slowpath_node_fn   
)

◆ VLIB_NODE_FUNCTION_MULTIARCH() [3/4]

VLIB_NODE_FUNCTION_MULTIARCH ( nat64_in2out_reass_node  ,
nat64_in2out_reass_node_fn   
)

◆ VLIB_NODE_FUNCTION_MULTIARCH() [4/4]

VLIB_NODE_FUNCTION_MULTIARCH ( nat64_in2out_handoff_node  ,
nat64_in2out_handoff_node_fn   
)

Variable Documentation

◆ nat64_in2out_error_strings

char* nat64_in2out_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}
#define foreach_nat64_in2out_error
Definition: nat64_in2out.c:78

Definition at line 103 of file nat64_in2out.c.

◆ nat64_in2out_handoff_error_strings

char* nat64_in2out_handoff_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}
#define foreach_nat64_in2out_handoff_error

Definition at line 1699 of file nat64_in2out.c.

◆ nat64_in2out_handoff_node

vlib_node_registration_t nat64_in2out_handoff_node
Initial value:
= {
.name = "nat64-in2out-handoff",
.vector_size = sizeof (u32),
.n_next_nodes = 1,
.next_nodes = {
[0] = "error-drop",
},
}
unsigned int u32
Definition: types.h:88
static u8 * format_nat64_in2out_handoff_trace(u8 *s, va_list *args)
#define ARRAY_LEN(x)
Definition: clib.h:62
static char * nat64_in2out_handoff_error_strings[]
static uword nat64_in2out_handoff_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)

(constructor) VLIB_REGISTER_NODE (nat64_in2out_handoff_node)

Definition at line 76 of file nat64_in2out.c.

◆ nat64_in2out_node

vlib_node_registration_t nat64_in2out_node
Initial value:
= {
.function = nat64_in2out_node_fn,
.name = "nat64-in2out",
.vector_size = sizeof (u32),
.format_trace = format_nat64_in2out_trace,
.error_strings = nat64_in2out_error_strings,
.n_next_nodes = NAT64_IN2OUT_N_NEXT,
.next_nodes = {
[NAT64_IN2OUT_NEXT_DROP] = "error-drop",
[NAT64_IN2OUT_NEXT_IP4_LOOKUP] = "ip4-lookup",
[NAT64_IN2OUT_NEXT_IP6_LOOKUP] = "ip6-lookup",
[NAT64_IN2OUT_NEXT_SLOWPATH] = "nat64-in2out-slowpath",
[NAT64_IN2OUT_NEXT_REASS] = "nat64-in2out-reass",
},
}
static u8 * format_nat64_in2out_trace(u8 *s, va_list *args)
Definition: nat64_in2out.c:34
unsigned int u32
Definition: types.h:88
static char * nat64_in2out_error_strings[]
Definition: nat64_in2out.c:103
#define ARRAY_LEN(x)
Definition: clib.h:62
static uword nat64_in2out_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)

(constructor) VLIB_REGISTER_NODE (nat64_in2out_node)

Definition at line 73 of file nat64_in2out.c.

◆ nat64_in2out_reass_node

vlib_node_registration_t nat64_in2out_reass_node
Initial value:
= {
.name = "nat64-in2out-reass",
.vector_size = sizeof (u32),
.error_strings = nat64_in2out_error_strings,
.n_next_nodes = NAT64_IN2OUT_N_NEXT,
.next_nodes = {
[NAT64_IN2OUT_NEXT_DROP] = "error-drop",
[NAT64_IN2OUT_NEXT_IP4_LOOKUP] = "ip4-lookup",
[NAT64_IN2OUT_NEXT_IP6_LOOKUP] = "ip6-lookup",
[NAT64_IN2OUT_NEXT_SLOWPATH] = "nat64-in2out-slowpath",
[NAT64_IN2OUT_NEXT_REASS] = "nat64-in2out-reass",
},
}
unsigned int u32
Definition: types.h:88
static u8 * format_nat64_in2out_reass_trace(u8 *s, va_list *args)
Definition: nat64_in2out.c:58
static char * nat64_in2out_error_strings[]
Definition: nat64_in2out.c:103
#define ARRAY_LEN(x)
Definition: clib.h:62
static uword nat64_in2out_reass_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)

(constructor) VLIB_REGISTER_NODE (nat64_in2out_reass_node)

Definition at line 75 of file nat64_in2out.c.

◆ nat64_in2out_slowpath_node

vlib_node_registration_t nat64_in2out_slowpath_node
Initial value:
= {
.name = "nat64-in2out-slowpath",
.vector_size = sizeof (u32),
.format_trace = format_nat64_in2out_trace,
.error_strings = nat64_in2out_error_strings,
.n_next_nodes = NAT64_IN2OUT_N_NEXT,
.next_nodes = {
[NAT64_IN2OUT_NEXT_DROP] = "error-drop",
[NAT64_IN2OUT_NEXT_IP4_LOOKUP] = "ip4-lookup",
[NAT64_IN2OUT_NEXT_IP6_LOOKUP] = "ip6-lookup",
[NAT64_IN2OUT_NEXT_SLOWPATH] = "nat64-in2out-slowpath",
[NAT64_IN2OUT_NEXT_REASS] = "nat64-in2out-reass",
},
}
static u8 * format_nat64_in2out_trace(u8 *s, va_list *args)
Definition: nat64_in2out.c:34
unsigned int u32
Definition: types.h:88
static uword nat64_in2out_slowpath_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static char * nat64_in2out_error_strings[]
Definition: nat64_in2out.c:103
#define ARRAY_LEN(x)
Definition: clib.h:62

(constructor) VLIB_REGISTER_NODE (nat64_in2out_slowpath_node)

Definition at line 74 of file nat64_in2out.c.