|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
38 #define ED_PORT_ALLOC_ATTEMPTS (10)
41 #define _(sym,string) string,
70 "NAT44_IN2OUT_ED_FAST_PATH";
76 s =
format (s,
", session %d, translation result '%U' via %s",
87 s =
format (s,
"\n lookup skipped - cached session index used");
171 u16 port_per_thread,
u32 snat_thread_index, snat_session_t *s,
174 const u16 port_thread_offset = (port_per_thread * snat_thread_index) + 1024;
176 s->o2i.match.daddr =
a->addr;
178 u16 port = clib_net_to_host_u16 (*outside_port);
179 u16 port_offset =
port - port_thread_offset;
180 if (
port <= port_thread_offset ||
181 port > port_thread_offset + port_per_thread)
186 port = port_thread_offset + port_offset;
191 if (NAT_PROTOCOL_ICMP == nat_proto)
193 s->o2i.match.sport = clib_host_to_net_u16 (
port);
195 s->o2i.match.dport = clib_host_to_net_u16 (
port);
198 #define _(N, i, n, s) \
199 case NAT_PROTOCOL_##N: \
200 ++a->busy_##n##_port_refcounts[port]; \
201 a->busy_##n##_ports_per_thread[thread_index]++; \
202 a->busy_##n##_ports++; \
212 *outside_addr =
a->addr;
213 *outside_port = clib_host_to_net_u16 (
port);
217 port = port_thread_offset + port_offset;
220 while (attempts > 0);
227 u16 port_per_thread,
u32 snat_thread_index,
241 if (
a->fib_index == rx_fib_index)
245 snat_thread_index, s, outside_addr, outside_port);
247 else if (
a->fib_index == ~0)
253 for (
i = 0;
i < s_addr_offset; ++
i)
256 if (
a->fib_index == rx_fib_index)
260 snat_thread_index, s, outside_addr, outside_port);
262 else if (
a->fib_index == ~0)
271 sm, nat_proto,
thread_index,
a, port_per_thread, snat_thread_index,
272 s, outside_addr, outside_port);
288 .fp_addr = {.ip4.as_u32 =
addr.as_u32,}
313 init_nat_k (&kv, match_addr, match_port, match_fib_index, match_protocol);
344 u32 outside_fib_index;
348 snat_session_t *s = NULL;
359 b->
error =
node->errors[NAT_IN2OUT_ED_ERROR_NON_SYN];
369 b->
error =
node->errors[NAT_IN2OUT_ED_ERROR_MAX_SESSIONS_EXCEEDED];
398 nat_proto, &sm_addr, &sm_port, &sm_fib_index,
399 0, 0, 0, &lb, 0, &is_identity_nat, 0))
419 s->in2out.addr = l_addr;
420 s->in2out.port = l_port;
421 s->nat_proto = nat_proto;
422 s->in2out.fib_index = rx_fib_index;
423 s->out2in.fib_index = outside_fib_index;
426 outside_port = l_port;
430 sm, r_addr, r_port, nat_proto, outside_fib_index, &daddr, &
dport);
436 s->out2in.fib_index,
proto);
438 if (NAT_PROTOCOL_ICMP == nat_proto)
454 b->
error =
node->errors[NAT_IN2OUT_ED_ERROR_OUT_OF_PORTS];
458 s->out2in.addr = outside_addr;
459 s->out2in.port = outside_port;
464 s->out2in.addr = outside_addr = sm_addr;
465 s->out2in.port = outside_port = sm_port;
466 s->in2out.addr = l_addr;
467 s->in2out.port = l_port;
468 s->nat_proto = nat_proto;
469 s->in2out.fib_index = rx_fib_index;
470 s->out2in.fib_index = outside_fib_index;
475 sm, r_addr, r_port, nat_proto, outside_fib_index, &daddr, &
dport);
478 if (NAT_PROTOCOL_ICMP == nat_proto)
481 sm_port, s->out2in.fib_index,
proto);
487 sm_port, s->out2in.fib_index,
proto);
502 s->ext_host_addr = r_addr;
503 s->ext_host_port = r_port;
506 rx_fib_index,
proto);
510 if (NAT_PROTOCOL_ICMP == nat_proto)
529 s->in2out.addr.as_u32,
530 s->out2in.addr.as_u32,
533 s->out2in.port, s->in2out.fib_index);
536 s->in2out.port, &s->ext_host_nat_addr,
537 s->ext_host_nat_port, &s->out2in.addr, s->out2in.port,
538 &s->ext_host_addr, s->ext_host_port, s->nat_proto, 0);
550 &outside_addr, outside_port,
555 *sessionp = s = NULL;
576 u16 placeholder_port;
577 u32 placeholder_fib_index;
581 &placeholder_fib_index, 1, 0, 0, 0, 0, 0, 0))
600 snat_session_t *s = 0;
606 if (
ip->protocol == IP_PROTOCOL_ICMP)
609 u16 lookup_sport, lookup_dport;
612 &lookup_sport, &lookup_daddr,
613 &lookup_dport, &lookup_protocol))
615 init_ed_k (&kv, lookup_saddr, lookup_sport, lookup_daddr, lookup_dport,
618 else if (
ip->protocol == IP_PROTOCOL_UDP ||
ip->protocol == IP_PROTOCOL_TCP)
639 if (
ip->protocol == IP_PROTOCOL_TCP)
663 f64 now,
int is_multi_worker)
674 tx_fib_index,
ip->protocol);
682 && (!s->tcp_closed_timestamp ||
now >= s->tcp_closed_timestamp))
691 if (is_multi_worker &&
696 lookup.fib_index = rx_fib_index;
698 lookup.daddr.as_u32 =
ip->src_address.as_u32;
700 lookup.saddr.as_u32 =
ip->dst_address.as_u32;
706 goto skip_dst_nat_lookup;
712 rx_fib_index,
ip->protocol);
747 snat_session_t *s = NULL;
748 u8 lookup_protocol =
ip->protocol;
749 u16 lookup_sport, lookup_dport;
753 &lookup_sport, &lookup_daddr,
754 &lookup_dport, &lookup_protocol);
773 ip, NAT_PROTOCOL_ICMP,
783 b->
error =
node->errors[NAT_IN2OUT_ED_ERROR_BAD_ICMP_TYPE];
788 lookup_sport, lookup_dport,
ip->protocol, rx_fib_index,
820 static snat_session_t *
831 snat_session_t *s = NULL;
840 b->
error =
node->errors[NAT_IN2OUT_ED_ERROR_MAX_SESSIONS_EXCEEDED];
872 if (s->ext_host_addr.as_u32 ==
ip->dst_address.as_u32)
874 init_ed_k (&s_kv, s->out2in.addr, 0,
ip->dst_address, 0,
875 outside_fib_index,
ip->protocol);
876 if (clib_bihash_search_16_8 (&sm->
flow_hash, &s_kv, &s_value))
878 new_src_addr = s->out2in.addr;
889 outside_fib_index,
ip->protocol);
890 if (clib_bihash_search_16_8 (&sm->
flow_hash, &s_kv, &s_value))
907 b->
error =
node->errors[NAT_IN2OUT_ED_ERROR_MAX_SESSIONS_EXCEEDED];
913 ip->dst_address, 0, rx_fib_index,
ip->protocol);
920 outside_fib_index, &new_dst_addr, NULL);
927 outside_fib_index,
ip->protocol);
932 s->ext_host_addr.as_u32 =
ip->dst_address.as_u32;
935 s->out2in.addr.as_u32 = new_src_addr.
as_u32;
936 s->out2in.fib_index = outside_fib_index;
937 s->in2out.addr.as_u32 =
ip->src_address.as_u32;
938 s->in2out.fib_index = rx_fib_index;
939 s->in2out.port = s->out2in.port =
ip->protocol;
972 int is_output_feature,
993 u32 sw_if_index0, rx_fib_index0, iph_offset0 = 0;
996 snat_session_t *s0 = 0;
1001 int lookup_skipped = 0;
1018 if (is_output_feature)
1020 iph_offset0 =
vnet_buffer (b0)->ip.reass.save_rewrite_length;
1031 lookup.fib_index = rx_fib_index0;
1037 ICMP4_time_exceeded_ttl_exceeded_in_transit,
1045 if (is_output_feature)
1056 ICMP4_echo_request &&
1062 b0->
error =
node->errors[NAT_IN2OUT_ED_ERROR_BAD_ICMP_TYPE];
1087 if (is_multi_worker &&
1111 if (clib_bihash_search_16_8 (&sm->
flow_hash, &kv0, &value0))
1136 if (s0->tcp_closed_timestamp)
1138 if (
now >= s0->tcp_closed_timestamp)
1146 b0->
error =
node->errors[NAT_IN2OUT_ED_ERROR_TCP_CLOSED];
1153 u64 sess_timeout_time;
1156 if (
now >= sess_timeout_time)
1165 b0->
flags |= VNET_BUFFER_F_IS_NATED;
1187 sm, b0, ip0,
f, proto0, is_output_feature)))
1197 case NAT_PROTOCOL_TCP:
1202 case NAT_PROTOCOL_UDP:
1206 case NAT_PROTOCOL_ICMP:
1210 case NAT_PROTOCOL_OTHER:
1226 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
1262 return frame->n_vectors;
1269 int is_output_feature,
1270 int is_multi_worker)
1288 u32 sw_if_index0, rx_fib_index0, iph_offset0 = 0;
1292 icmp46_header_t *icmp0;
1293 snat_session_t *s0 = 0;
1299 if (is_output_feature)
1300 iph_offset0 =
vnet_buffer (b0)->ip.reass.save_rewrite_length;
1315 ICMP4_time_exceeded_ttl_exceeded_in_transit,
1322 icmp0 = (icmp46_header_t *) udp0;
1334 sm, b0, ip0, &s0->i2o, proto0, is_output_feature)))
1347 sm, b0, ip0, icmp0, sw_if_index0, rx_fib_index0,
node,
next[0],
1352 sm, b0, ip0, &s0->i2o, proto0, is_output_feature)))
1366 if (!clib_bihash_search_16_8 (&sm->
flow_hash, &kv0, &value0))
1373 if (s0->tcp_closed_timestamp &&
now >= s0->tcp_closed_timestamp)
1383 if (is_output_feature)
1397 (proto0 == NAT_PROTOCOL_UDP
1399 clib_host_to_net_u16 (UDP_DST_PORT_dhcp_to_server))
1406 vm, sm,
node, sw_if_index0, b0, ip0, proto0, rx_fib_index0,
1425 b0->
flags |= VNET_BUFFER_F_IS_NATED;
1429 sm, b0, ip0, &s0->i2o, proto0, is_output_feature)))
1458 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
1496 return frame->n_vectors;
1514 .name =
"nat44-ed-in2out",
1515 .vector_size =
sizeof (
u32),
1516 .sibling_of =
"nat-default",
1539 .name =
"nat44-ed-in2out-output",
1540 .vector_size =
sizeof (
u32),
1541 .sibling_of =
"nat-default",
1564 .name =
"nat44-ed-in2out-slowpath",
1565 .vector_size =
sizeof (
u32),
1566 .sibling_of =
"nat-default",
1590 .name =
"nat44-ed-in2out-output-slowpath",
1591 .vector_size =
sizeof (
u32),
1592 .sibling_of =
"nat-default",
1625 .name =
"nat-pre-in2out",
1626 .vector_size =
sizeof (
u32),
1627 .sibling_of =
"nat-default",
1634 .name =
"nat-pre-in2out-output",
1635 .vector_size =
sizeof (
u32),
1636 .sibling_of =
"nat-default",
static u32 ed_value_get_thread_index(clib_bihash_kv_16_8_t *value)
static uword nat44_ed_in2out_fast_path_node_fn_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_output_feature, int is_multi_worker)
static bool tcp_flags_is_init(u8 f)
Check if client initiating TCP connection (received SYN from client)
static void nat_6t_flow_saddr_rewrite_set(nat_6t_flow_t *f, u32 saddr)
static uword nat44_ed_in2out_slow_path_node_fn_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_output_feature, int is_multi_worker)
static_always_inline int nat44_ed_external_sm_lookup(snat_main_t *sm, ip4_address_t match_addr, u16 match_port, nat_protocol_t match_protocol, u32 match_fib_index, ip4_address_t *daddr, u16 *dport)
struct snat_main_s::@736 counters
#define nat_elog_notice(_pm, nat_elog_str)
static u32 ed_value_get_session_index(clib_bihash_kv_16_8_t *value)
snat_static_mapping_t * static_mappings
vlib_buffer_t * bufs[VLIB_FRAME_SIZE]
#define SNAT_SESSION_FLAG_HAIRPINNING
vl_api_ip_port_and_mask_t dst_port
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define nat_elog_warn(_pm, nat_elog_str)
struct snat_main_s::@736::@738 slowpath
static int nat_ed_alloc_addr_and_port_with_snat_address(snat_main_t *sm, u32 nat_proto, u32 thread_index, snat_address_t *a, u16 port_per_thread, u32 snat_thread_index, snat_session_t *s, ip4_address_t *outside_addr, u16 *outside_port)
#define clib_memcpy(d, s, n)
#define SNAT_SESSION_FLAG_UNKNOWN_PROTO
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
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)
#define nat_interface_is_inside(i)
Check if NAT interface is inside.
static_always_inline int nat_get_icmp_session_lookup_values(vlib_buffer_t *b, ip4_header_t *ip0, ip4_address_t *lookup_saddr, u16 *lookup_sport, ip4_address_t *lookup_daddr, u16 *lookup_dport, u8 *lookup_protocol)
static u32 nat44_session_get_timeout(snat_main_t *sm, snat_session_t *s)
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.
static_always_inline void nat_6t_o2i_flow_init(snat_main_t *sm, u32 thread_idx, snat_session_t *s, ip4_address_t saddr, u16 sport, ip4_address_t daddr, u16 dport, u32 fib_index, u8 proto)
vlib_get_buffers(vm, from, b, n_left_from)
static nat_protocol_t ip_proto_to_nat_proto(u8 ip_proto)
Common NAT inline functions.
@ VLIB_NODE_TYPE_INTERNAL
static hash_pair_t * lookup(void *v, uword key, enum lookup_opcode op, void *new_value, void *old_value)
snat_interface_t * interfaces
vlib_node_registration_t nat44_ed_in2out_output_slowpath_node
(constructor) VLIB_REGISTER_NODE (nat44_ed_in2out_output_slowpath_node)
#define FIB_NODE_INDEX_INVALID
nat_translation_error_e translation_error
u32 ip4_fib_table_get_index_for_sw_if_index(u32 sw_if_index)
#define SNAT_SESSION_FLAG_STATIC_MAPPING
static ip_csum_t ip_incremental_checksum_buffer(vlib_main_t *vm, vlib_buffer_t *first_buffer, u32 first_buffer_offset, u32 n_bytes_to_checksum, ip_csum_t sum)
static void nat44_set_tcp_session_state_i2o(snat_main_t *sm, f64 now, snat_session_t *ses, vlib_buffer_t *b, u32 thread_index)
fib_node_index_t fib_table_lookup(u32 fib_index, const fib_prefix_t *prefix)
Perfom a longest prefix match in the non-forwarding table.
@ NAT_NEXT_IN2OUT_ED_SLOW_PATH
static_always_inline u8 nat44_ed_maximum_sessions_exceeded(snat_main_t *sm, u32 fib_index, u32 thread_index)
static void nat_6t_flow_daddr_rewrite_set(nat_6t_flow_t *f, u32 daddr)
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.
static int snat_not_translate_fast(snat_main_t *sm, vlib_node_runtime_t *node, u32 sw_if_index0, ip4_header_t *ip0, u32 proto0, u32 rx_fib_index0)
Check if packet should be translated.
vlib_buffer_enqueue_to_next(vm, node, from,(u16 *) nexts, frame->n_vectors)
snat_address_t * addresses
static_always_inline u8 icmp_type_is_error_message(u8 icmp_type)
clib_bihash_8_8_t static_mapping_by_external
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
nat_translation_error_e nat_6t_flow_buf_translate(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)
void nat_ipfix_logging_addresses_exhausted(u32 thread_index, u32 pool_id)
Generate NAT addresses exhausted event.
static_always_inline void nat_6t_i2o_flow_init(snat_main_t *sm, u32 thread_idx, snat_session_t *s, ip4_address_t saddr, u16 sport, ip4_address_t daddr, u16 dport, u32 fib_index, u8 proto)
static_always_inline void per_vrf_sessions_register_session(snat_session_t *s, u32 thread_index)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
clib_bihash_kv_16_8_t search_key
#define CLIB_PREFETCH(addr, size, type)
#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.
@ NAT_NEXT_IN2OUT_ED_OUTPUT_SLOW_PATH
void nat_syslog_nat44_sadd(u32 ssubix, u32 sfibix, ip4_address_t *isaddr, u16 isport, ip4_address_t *idaddr, u16 idport, ip4_address_t *xsaddr, u16 xsport, ip4_address_t *xdaddr, u16 xdport, nat_protocol_t proto, u8 is_twicenat)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
snat_main_per_thread_data_t * per_thread_data
vlib_node_registration_t nat_pre_in2out_output_node
(constructor) VLIB_REGISTER_NODE (nat_pre_in2out_output_node)
#define VLIB_NODE_FN(node)
static int nat_ed_alloc_addr_and_port(snat_main_t *sm, u32 rx_fib_index, u32 nat_proto, u32 thread_index, ip4_address_t s_addr, u16 port_per_thread, u32 snat_thread_index, snat_session_t *s, ip4_address_t *outside_addr, u16 *outside_port)
static u8 * format_nat_in2out_ed_trace(u8 *s, va_list *args)
clib_bihash_16_8_t flow_hash
void nat_ipfix_logging_max_sessions(u32 thread_index, u32 limit)
Generate maximum session entries exceeded event.
static int ip4_is_fragment(const ip4_header_t *i)
@ NAT_NEXT_IN2OUT_ED_FAST_PATH
#define VLIB_NODE_FLAG_TRACE
vlib_node_registration_t nat44_ed_in2out_node
(constructor) VLIB_REGISTER_NODE (nat44_ed_in2out_node)
nat_outside_fib_t * outside_fibs
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static_always_inline u16 snat_random_port(u16 min, u16 max)
static_always_inline int nat44_ed_not_translate_output_feature(snat_main_t *sm, vlib_buffer_t *b, ip4_header_t *ip, u16 src_port, u16 dst_port, u32 thread_index, u32 rx_sw_if_index, u32 tx_sw_if_index, f64 now, int is_multi_worker)
#define static_always_inline
u32 fib_node_index_t
A typedef of a node index.
vl_api_interface_index_t tx_sw_if_index
static void init_ed_k(clib_bihash_kv_16_8_t *kv, ip4_address_t l_addr, u16 l_port, ip4_address_t r_addr, u16 r_port, u32 fib_index, u8 proto)
vl_api_ip_port_and_mask_t src_port
sll srl srl sll sra u16x4 i
static uword nat_pre_node_fn_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u32 def_next)
static void nat_6t_flow_icmp_id_rewrite_set(nat_6t_flow_t *f, u16 id)
vlib_node_registration_t nat44_ed_in2out_slowpath_node
(constructor) VLIB_REGISTER_NODE (nat44_ed_in2out_slowpath_node)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
struct snat_main_s::@736::@737 fastpath
u32 fib_entry_get_resolving_interface(fib_node_index_t entry_index)
snat_session_t * sessions
#define CLIB_CACHE_LINE_BYTES
@ NAT_ED_TRNSL_ERR_FLOW_MISMATCH
struct _vlib_node_registration vlib_node_registration_t
static void nat_ed_session_delete(snat_main_t *sm, snat_session_t *ses, u32 thread_index, int lru_delete)
static_always_inline void icmp4_error_set_vnet_buffer(vlib_buffer_t *b, u8 type, u8 code, u32 data)
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)
#define foreach_nat_in2out_ed_error
static u8 is_interface_addr(snat_main_t *sm, vlib_node_runtime_t *node, u32 sw_if_index0, u32 ip4_addr)
static u32 icmp_in2out_ed_slow_path(snat_main_t *sm, vlib_buffer_t *b, ip4_header_t *ip, icmp46_header_t *icmp, u32 sw_if_index, u32 rx_fib_index, vlib_node_runtime_t *node, u32 next, f64 now, u32 thread_index, nat_protocol_t nat_proto, snat_session_t **s_p, int is_multi_worker)
format_function_t format_nat_ed_translation_error
static_always_inline int nat_6t_t_eq(nat_6t_t *t1, nat_6t_t *t2)
#define SNAT_SESSION_FLAG_LOAD_BALANCING
@ NAT_NEXT_IN2OUT_ED_OUTPUT_FAST_PATH
static_always_inline snat_session_t * nat_ed_session_alloc(snat_main_t *sm, u32 thread_index, f64 now, u8 proto)
void nat_ipfix_logging_nat44_ses_create(u32 thread_index, u32 src_ip, u32 nat_src_ip, nat_protocol_t nat_proto, u16 src_port, u16 nat_src_port, u32 fib_index)
Generate NAT44 session create event.
static_always_inline int nat_lru_free_one(snat_main_t *sm, int thread_index, f64 now)
#define nat_elog_info(_pm, nat_elog_str)
static void nat_6t_flow_sport_rewrite_set(nat_6t_flow_t *f, u32 sport)
description fragment has unexpected format
u32 fib_table_get_index_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the index of the FIB bound to the interface.
static u8 * format_nat_pre_trace(u8 *s, va_list *args)
static void nat44_session_update_counters(snat_session_t *s, f64 now, uword bytes, u32 thread_index)
#define is_addr_only_static_mapping(sm)
Check if NAT static mapping is address only (1:1NAT).
#define vec_foreach(var, vec)
Vector iterator.
clib_bihash_8_8_t static_mapping_by_local
8 octet key, 8 octet key value pair
format_function_t format_ed_session_kvp
u32 max_translations_per_thread
fib_protocol_t fp_proto
protocol type
@ NAT_NEXT_OUT2IN_ED_SLOW_PATH
format_function_t format_nat_6t_flow
static_always_inline int nat_ed_ses_i2o_flow_hash_add_del(snat_main_t *sm, u32 thread_idx, snat_session_t *s, int is_add)
static_always_inline u8 per_vrf_sessions_is_expired(snat_session_t *s, u32 thread_index)
#define nat44_is_ses_closed(s)
Check if NAT44 endpoint-dependent TCP session is closed.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static char * nat_in2out_ed_error_strings[]
static vlib_main_t * vlib_get_main(void)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vlib_main_t vlib_node_runtime_t * node
ip4_address_t external_addr
#define is_fwd_bypass_session(s)
Check if NAT session is forwarding bypass.
#define nat_interface_is_outside(i)
Check if NAT interface is outside.
u16 nexts[VLIB_FRAME_SIZE]
static int ip4_header_bytes(const ip4_header_t *i)
static f64 vlib_time_now(vlib_main_t *vm)
vlib_node_registration_t nat44_ed_in2out_output_node
(constructor) VLIB_REGISTER_NODE (nat44_ed_in2out_output_node)
#define SNAT_SESSION_FLAG_ENDPOINT_DEPENDENT
vl_api_interface_index_t sw_if_index
static u16 ip_csum_fold(ip_csum_t c)
@ NAT_ED_TRNSL_ERR_SUCCESS
static void nat_6t_flow_dport_rewrite_set(nat_6t_flow_t *f, u32 dport)
static snat_session_t * nat44_ed_in2out_slowpath_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 void init_nat_k(clib_bihash_kv_8_8_t *kv, ip4_address_t addr, u16 port, u32 fib_index, nat_protocol_t proto)
static u32 slow_path_ed(vlib_main_t *vm, snat_main_t *sm, vlib_buffer_t *b, ip4_address_t l_addr, ip4_address_t r_addr, u16 l_port, u16 r_port, u8 proto, u32 rx_fib_index, snat_session_t **sessionp, vlib_node_runtime_t *node, u32 next, u32 thread_index, f64 now)
Aggregate type for a prefix.
vlib_node_registration_t nat_pre_in2out_node
(constructor) VLIB_REGISTER_NODE (nat_pre_in2out_node)
static_always_inline int nat44_ed_not_translate(vlib_main_t *vm, snat_main_t *sm, vlib_node_runtime_t *node, u32 sw_if_index, vlib_buffer_t *b, ip4_header_t *ip, u32 proto, u32 rx_fib_index, u32 thread_index)
vl_api_fib_path_type_t type
static void nat44_session_update_lru(snat_main_t *sm, snat_session_t *s, u32 thread_index)
Per-user LRU list maintenance.
#define ED_PORT_ALLOC_ATTEMPTS
static_always_inline int nat_ed_ses_o2i_flow_hash_add_del(snat_main_t *sm, u32 thread_idx, snat_session_t *s, int is_add)
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,...
static void nat_6t_flow_txfib_rewrite_set(nat_6t_flow_t *f, u32 tx_fib_index)
VLIB buffer representation.
snat_interface_t * output_feature_interfaces
#define VLIB_REGISTER_NODE(x,...)
static_always_inline u32 nat_outside_fib_index_lookup(snat_main_t *sm, ip4_address_t addr)