|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
26 #define NAT44_EI_FLAG_HAIRPINNING (1 << 0)
64 s =
format (s,
" is-static-mapping");
95 #ifndef CLIB_MARCH_VARIANT
102 u32 old_addr, new_addr;
111 old_addr =
ip->dst_address.as_u32;
122 #ifndef CLIB_MARCH_VARIANT
128 u32 *required_thread_index)
130 nat44_ei_session_t *s0 = NULL;
133 u32 new_dst_addr0 = 0, old_dst_addr0,
si = ~0;
134 u16 new_dst_port0 = ~0, old_dst_port0;
144 &sm0_addr, &sm0_port, &sm0_fib_index, 1 , 0, 0))
146 new_dst_addr0 = sm0_addr.
as_u32;
147 new_dst_port0 = sm0_port;
155 rv = clib_bihash_search_8_8 (&
nm->
out2in, &kv0, &value0);
170 new_dst_addr0 = s0->in2out.addr.as_u32;
171 new_dst_port0 = s0->in2out.port;
180 old_dst_port0 = tcp0->dst;
181 if (new_dst_addr0 == old_dst_addr0 && new_dst_port0 == old_dst_port0 &&
195 old_dst_port0 = tcp0->dst;
200 tcp0->dst = new_dst_port0;
201 sum0 = tcp0->checksum;
218 sum0 = tcp0->checksum;
230 (b0->
flags & VLIB_BUFFER_IS_TRACED)))
234 t->
port = new_dst_port0;
249 #ifndef CLIB_MARCH_VARIANT
253 icmp46_header_t *icmp0,
u32 *required_thread_index)
256 u32 old_dst_addr0, new_dst_addr0;
257 u32 old_addr0, new_addr0;
258 u16 old_port0, new_port0;
259 u16 old_checksum0, new_checksum0;
262 nat44_ei_session_t *s0;
280 if (clib_bihash_search_8_8 (&
nm->
out2in, &kv0, &value0))
285 *required_thread_index =
ti;
290 new_dst_addr0 = s0->in2out.addr.as_u32;
297 sum0 = icmp0->checksum;
303 old_checksum0 = inner_ip0->
checksum;
308 new_checksum0 = inner_ip0->
checksum;
309 sum0 = icmp0->checksum;
316 l4_header->
src_port = s0->in2out.port;
318 sum0 = icmp0->checksum;
333 int rv = clib_bihash_search_8_8 (&
nm->
out2in, &kv0, &value0);
339 *required_thread_index =
ti;
344 new_dst_addr0 = s0->in2out.addr.as_u32;
347 sum0 = icmp0->checksum;
381 #ifndef CLIB_MARCH_VARIANT
388 u32 old_addr, new_addr;
397 old_addr =
ip->dst_address.as_u32;
448 (sw_if_index0 ==
i->sw_if_index))
456 goto skip_feature_next;
461 goto skip_feature_next;
479 n_left_to_next, bi0, next0);
534 if (proto0 == NAT_PROTOCOL_TCP || proto0 == NAT_PROTOCOL_UDP)
540 udp0, tcp0, proto0, 1 ,
541 &required_thread_index);
543 else if (proto0 == NAT_PROTOCOL_ICMP)
548 &required_thread_index);
561 required_thread_index;
573 n_left_to_next, bi0, next0);
579 return frame->n_vectors;
630 int next0_resolved = 0;
634 &required_thread_index))
643 required_thread_index;
660 n_left_to_next, bi0, next0);
666 return frame->n_vectors;
684 .name =
"nat44-ei-hairpin-dst-handoff",
685 .vector_size =
sizeof (
u32),
698 .name =
"nat44-ei-hairpinning-handoff",
699 .vector_size =
sizeof (
u32),
712 .name =
"nat44-ei-hairpin-src",
713 .vector_size =
sizeof (
u32),
725 .name =
"nat44-ei-hairpin-dst",
726 .vector_size =
sizeof (
u32),
738 .name =
"nat44-ei-hairpinning",
739 .vector_size =
sizeof (
u32),
static char * nat44_ei_hairpinning_handoff_error_strings[]
void nat44_ei_hairpinning_sm_unknown_proto(nat44_ei_main_t *nm, vlib_buffer_t *b, ip4_header_t *ip)
static u32 nat_value_get_thread_index(clib_bihash_kv_8_8_t *value)
static_always_inline int nat44_ei_is_hairpinning(nat44_ei_main_t *nm, ip4_address_t *dst_addr)
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
vnet_config_main_t config_main
int nat44_ei_hairpinning(vlib_main_t *vm, vlib_node_runtime_t *node, nat44_ei_main_t *nm, u32 thread_index, vlib_buffer_t *b0, ip4_header_t *ip0, udp_header_t *udp0, tcp_header_t *tcp0, u32 proto0, int do_trace, u32 *required_thread_index)
vlib_node_registration_t nat44_ei_hairpin_src_node
(constructor) VLIB_REGISTER_NODE (nat44_ei_hairpin_src_node)
nat44_ei_hairpin_src_next_t next_index
nat44_ei_static_mapping_t * static_mappings
vlib_main_t vlib_node_runtime_t * node
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
struct _tcp_header tcp_header_t
static nat_protocol_t ip_proto_to_nat_proto(u8 ip_proto)
Common NAT inline functions.
@ VLIB_NODE_TYPE_INTERNAL
#define NAT44_EI_FLAG_HAIRPINNING
@ NAT44_EI_HAIRPIN_NEXT_DROP
@ NAT44_EI_HAIRPIN_SRC_NEXT_DROP
void nat44_ei_hairpinning_unknown_proto(nat44_ei_main_t *nm, vlib_buffer_t *b, ip4_header_t *ip)
nat44_ei_address_t * addresses
struct nat44_ei_main_s::@81 counters
static_always_inline u8 icmp_type_is_error_message(u8 icmp_type)
@ NAT44_EI_HAIRPIN_SRC_NEXT_SNAT_IN2OUT
int nat44_ei_static_mapping_match(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, u8 *is_identity_nat)
Match NAT44-EI static mapping.
nat44_ei_session_t * sessions
#define pool_foreach(VAR, POOL)
Iterate through pool.
static void vlib_increment_simple_counter(vlib_simple_counter_main_t *cm, u32 thread_index, u32 index, u64 increment)
Increment a simple counter.
@ NAT44_EI_HAIRPIN_SRC_NEXT_SNAT_IN2OUT_WH
#define VLIB_NODE_FN(node)
vlib_simple_counter_main_t hairpinning
static u32 nat_value_get_session_index(clib_bihash_kv_8_8_t *value)
nat44_ei_main_t nat44_ei_main
#define VLIB_NODE_FLAG_TRACE
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
@ NAT44_EI_HAIRPIN_N_NEXT
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u32 nat44_ei_icmp_hairpinning(nat44_ei_main_t *nm, vlib_buffer_t *b0, u32 thread_index, ip4_header_t *ip0, icmp46_header_t *icmp0, u32 *required_thread_index)
#define static_always_inline
vl_api_ip_port_and_mask_t src_port
vl_api_mac_address_t dst_addr
vlib_node_registration_t nat44_ei_hairpinning_node
(constructor) VLIB_REGISTER_NODE (nat44_ei_hairpinning_node)
sll srl srl sll sra u16x4 i
nat44_ei_main_per_thread_data_t * per_thread_data
static u8 * format_nat44_ei_hairpinning_handoff_trace(u8 *s, va_list *args)
vnet_feature_config_main_t * cm
vnet_feature_main_t feature_main
static uword nat44_ei_hairpinning_handoff_fn_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u32 fq_index)
clib_bihash_8_8_t static_mapping_by_external
#define nat44_ei_interface_is_inside(ip)
struct _vlib_node_registration vlib_node_registration_t
nat44_ei_interface_t * output_feature_interfaces
@ NAT44_EI_HAIRPIN_NEXT_LOOKUP
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
vlib_node_registration_t nat44_ei_hairpinning_dst_handoff_node
(constructor) VLIB_REGISTER_NODE (nat44_ei_hairpinning_dst_handoff_node)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
description fragment has unexpected format
@ NAT44_EI_HAIRPIN_SRC_NEXT_INTERFACE_OUTPUT
vlib_put_next_frame(vm, node, next_index, 0)
vl_api_ip_proto_t protocol
@ NAT44_EI_HAIRPIN_SRC_N_NEXT
#define vec_foreach(var, vec)
Vector iterator.
8 octet key, 8 octet key value pair
vlib_node_registration_t nat44_ei_hairpin_dst_node
(constructor) VLIB_REGISTER_NODE (nat44_ei_hairpin_dst_node)
#define ip_csum_update(sum, old, new, type, field)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static void * vnet_get_config_data(vnet_config_main_t *cm, u32 *config_index, u32 *next_index, u32 n_data_bytes)
nat44_ei_hairpin_src_next_t
vnet_feature_config_main_t * feature_config_mains
feature config main objects
vl_api_address_union_t src_address
@ NAT44_EI_HAIRPIN_NEXT_HANDOFF
vl_api_interface_index_t sw_if_index
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
static u16 ip_csum_fold(ip_csum_t c)
static void init_nat_k(clib_bihash_kv_8_8_t *kv, ip4_address_t addr, u16 port, u32 fib_index, nat_protocol_t proto)
struct _vnet_feature_arc_registration vnet_feature_arc_registration_t
feature registration object
vlib_node_registration_t nat44_ei_hairpinning_handoff_node
(constructor) VLIB_REGISTER_NODE (nat44_ei_hairpinning_handoff_node)
vl_api_fib_path_type_t type
static u8 * format_nat44_ei_hairpin_trace(u8 *s, va_list *args)
static void * ip4_next_header(ip4_header_t *i)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)
vnet_feature_arc_registration_t vnet_feat_arc_ip4_local