|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
19 #ifndef __included_nat44_ei_h__
20 #define __included_nat44_ei_h__
41 #define NAT_FQ_NELTS_DEFAULT 64
44 #define foreach_nat44_ei_addr_and_port_alloc_alg \
45 _ (0, DEFAULT, "default") \
46 _ (1, MAPE, "map-e") \
47 _ (2, RANGE, "port-range")
51 #define _(v, N, s) NAT44_EI_ADDR_AND_PORT_ALLOC_ALG_##N = v,
57 #define NAT44_EI_INTERFACE_FLAG_IS_INSIDE (1 << 0)
58 #define NAT44_EI_INTERFACE_FLAG_IS_OUTSIDE (1 << 1)
61 #define NAT44_EI_SESSION_FLAG_STATIC_MAPPING (1 << 0)
62 #define NAT44_EI_SESSION_FLAG_UNKNOWN_PROTO (1 << 1)
65 #define NAT44_EI_STATIC_MAPPING_FLAG_ADDR_ONLY (1 << 0)
66 #define NAT44_EI_STATIC_MAPPING_FLAG_IDENTITY_NAT (1 << 1)
72 #define _(N, i, n, s) \
73 u32 busy_##n##_ports; \
74 u32 *busy_##n##_ports_per_thread; \
75 u32 busy_##n##_port_refcounts[0xffff + 1];
86 u16 port_per_thread,
u32 snat_thread_index);
231 u32 per_user_list_head_index;
243 f64 ha_last_refreshed;
255 u16 ext_host_nat_port;
261 u64 tcp_closed_timestamp;
265 }) nat44_ei_session_t;
270 u32 sessions_per_user_list_head_index;
413 #define _(x) vlib_simple_counter_main_t x;
511 u32 rx_fib_index0,
u8 is_output);
557 u8 identity_nat,
u8 *tag,
u8 is_add);
591 u16 *mapping_port,
u32 *mapping_fib_index,
592 u8 by_external,
u8 *is_addr_only,
593 u8 *is_identity_nat);
654 int do_trace,
u32 *required_thread_index);
662 icmp46_header_t *icmp0,
663 u32 *required_thread_index);
667 #define nat44_ei_is_session_static(sp) \
668 (sp->flags & NAT44_EI_SESSION_FLAG_STATIC_MAPPING)
669 #define nat44_ei_is_unk_proto_session(sp) \
670 (sp->flags & NAT44_EI_SESSION_FLAG_UNKNOWN_PROTO)
672 #define nat44_ei_interface_is_inside(ip) \
673 (ip->flags & NAT44_EI_INTERFACE_FLAG_IS_INSIDE)
674 #define nat44_ei_interface_is_outside(ip) \
675 (ip->flags & NAT44_EI_INTERFACE_FLAG_IS_OUTSIDE)
677 #define nat44_ei_is_addr_only_static_mapping(mp) \
678 (mp->flags & NAT44_EI_STATIC_MAPPING_FLAG_ADDR_ONLY)
679 #define nat44_ei_is_identity_static_mapping(mp) \
680 (mp->flags & NAT44_EI_STATIC_MAPPING_FLAG_IDENTITY_NAT)
683 #define nat44_ei_log_err(...) \
684 vlib_log (VLIB_LOG_LEVEL_ERR, nat44_ei_main.log_class, __VA_ARGS__)
685 #define nat44_ei_log_warn(...) \
686 vlib_log (VLIB_LOG_LEVEL_WARNING, nat44_ei_main.log_class, __VA_ARGS__)
687 #define nat44_ei_log_notice(...) \
688 vlib_log (VLIB_LOG_LEVEL_NOTICE, nat44_ei_main.log_class, __VA_ARGS__)
689 #define nat44_ei_log_info(...) \
690 vlib_log (VLIB_LOG_LEVEL_INFO, nat44_ei_main.log_class, __VA_ARGS__)
691 #define nat44_ei_log_debug(...) \
692 vlib_log (VLIB_LOG_LEVEL_DEBUG, nat44_ei_main.log_class, __VA_ARGS__)
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)
NAT port/address allocation lib.
nat44_ei_main_per_thread_data_t * tnm
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)
nat44_ei_config_t rconfig
u32 fq_in2out_output_index
void nat44_ei_free_session_data(nat44_ei_main_t *nm, nat44_ei_session_t *s, u32 thread_index, u8 is_ha)
vl_api_ip_port_and_mask_t dst_port
nat44_ei_static_mapping_t * static_mappings
clib_error_t * nat44_ei_api_hookup(vlib_main_t *vm)
int nat44_o2i_is_idle_session_cb(clib_bihash_kv_8_8_t *kv, void *arg)
void nat44_ei_sessions_clear()
Clear all active NAT44-EI sessions.
int nat44_ei_interface_add_del_output_feature(u32 sw_if_index, u8 is_inside, int is_del)
struct _tcp_header tcp_header_t
nat44_ei_interface_t * interfaces
vlib_main_t vlib_node_runtime_t * node
nat44_ei_addr_and_port_alloc_alg_t
int nat44_ei_set_frame_queue_nelts(u32 frame_queue_nelts)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
vl_api_dhcp_client_state_t state
nat44_ei_addr_and_port_alloc_alg_t addr_and_port_alloc_alg
nat44_ei_address_t * addresses
struct nat44_ei_main_s::@81 counters
u32 max_translations_per_thread
int() nat44_ei_alloc_out_addr_and_port_function_t(nat44_ei_address_t *addresses, u32 fib_index, u32 thread_index, nat_protocol_t proto, ip4_address_t s_addr, ip4_address_t *addr, u16 *port, u16 port_per_thread, u32 snat_thread_index)
int nat44_i2o_is_idle_session_cb(clib_bihash_kv_8_8_t *kv, void *arg)
nat44_ei_session_t * sessions
u32 tcp_trans_lru_head_index
int nat44_ei_add_del_static_mapping(ip4_address_t l_addr, ip4_address_t e_addr, u16 l_port, u16 e_port, nat_protocol_t proto, u32 sw_if_index, u32 vrf_id, u8 addr_only, u8 identity_nat, u8 *tag, u8 is_add)
Add/delete NAT44-EI static mapping.
nat44_ei_static_map_resolve_t * to_resolve
void nat44_ei_hairpinning_sm_unknown_proto(nat44_ei_main_t *nm, vlib_buffer_t *b, ip4_header_t *ip)
vlib_simple_counter_main_t hairpinning
int nat44_ei_plugin_enable(nat44_ei_config_t c)
struct nat44_ei_main_s::@81::@82 fastpath
nat44_ei_main_t nat44_ei_main
u32 unk_proto_lru_head_index
void nat44_ei_set_alloc_default(void)
Set address and port assignment algorithm to default/standard.
u32 max_translations_per_user
int nat44_ei_interface_add_del(u32 sw_if_index, u8 is_inside, int is_del)
nat44_ei_user_t * nat44_ei_user_get_or_create(nat44_ei_main_t *nm, ip4_address_t *addr, u32 fib_index, u32 thread_index)
vlib_log_class_t log_class
void nat44_ei_free_session_data_v2(nat44_ei_main_t *nm, nat44_ei_session_t *s, u32 thread_index, u8 is_ha)
void nat44_ei_static_mapping_del_sessions(nat44_ei_main_t *nm, nat44_ei_main_per_thread_data_t *tnm, nat44_ei_user_key_t u_key, int addr_only, ip4_address_t e_addr, u16 e_port)
Delete session for static mapping.
u32 in2out_hairpinning_finish_interface_output_node_fq_index
typedef CLIB_PACKED(struct { struct { ip4_address_t addr;u32 fib_index;u16 port;} out2in;struct { ip4_address_t addr;u32 fib_index;u16 port;} in2out;nat_protocol_t nat_proto;u32 flags;u32 per_user_index;u32 per_user_list_head_index;u32 lru_head_index;u32 lru_index;f64 last_lru_update;f64 last_heard;f64 ha_last_refreshed;u64 total_bytes;u32 total_pkts;ip4_address_t ext_host_addr;u16 ext_host_port;ip4_address_t ext_host_nat_addr;u16 ext_host_nat_port;u8 state;u32 i2o_fin_seq;u32 o2i_fin_seq;u64 tcp_closed_timestamp;u32 user_index;}) nat44_ei_session_t
nat44_ei_main_per_thread_data_t * per_thread_data
void nat44_ei_free_outside_address_and_port(nat44_ei_address_t *addresses, u32 thread_index, ip4_address_t *addr, u16 port, nat_protocol_t protocol)
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.
ip4_address_t external_addr
clib_bihash_8_8_t static_mapping_by_external
nat44_ei_interface_t * output_feature_interfaces
nat44_ei_alloc_out_addr_and_port_function_t * alloc_addr_and_port
int nat44_ei_del_session(nat44_ei_main_t *nm, ip4_address_t *addr, u16 port, nat_protocol_t proto, u32 vrf_id, int is_in)
Delete NAT44-EI session.
void nat44_ei_add_del_address_dpo(ip4_address_t addr, u8 is_add)
API main structure, used by both vpp and binary API clients.
int nat44_ei_plugin_disable()
#define foreach_nat44_ei_addr_and_port_alloc_alg
nat44_ei_session_t * nat44_ei_session_alloc_or_recycle(nat44_ei_main_t *nm, nat44_ei_user_t *u, u32 thread_index, f64 now)
int nat44_ei_set_outside_address_and_port(nat44_ei_address_t *addresses, u32 thread_index, ip4_address_t addr, u16 port, nat_protocol_t protocol)
clib_bihash_8_8_t user_hash
int nat44_ei_user_del(ip4_address_t *addr, u32 fib_index)
Delete specific NAT44 EI user and his sessions.
clib_bihash_8_8_t static_mapping_by_local
int nat44_ei_del_address(nat44_ei_main_t *nm, ip4_address_t addr, u8 delete_sm)
u8 static_mapping_connection_tracking
void nat44_ei_delete_session(nat44_ei_main_t *nm, nat44_ei_session_t *ses, u32 thread_index)
vl_api_ip_proto_t protocol
u32 nat44_ei_get_out2in_worker_index(vlib_buffer_t *b, ip4_header_t *ip0, u32 rx_fib_index0, u8 is_output)
vlib_simple_counter_main_t user_limit_reached
8 octet key, 8 octet key value pair
uword * cached_presence_by_ip4_address
void nat44_ei_set_alloc_mape(u16 psid, u16 psid_offset, u16 psid_length)
Set address and port assignment algorithm for MAP-E CE.
A collection of simple counters.
u32 in2out_hairpinning_finish_ip4_lookup_node_fq_index
u32 in2out_output_node_index
struct nat44_ei_main_s::@81::@83 slowpath
struct nat44_ei_main_s nat44_ei_main_t
vlib_simple_counter_main_t total_users
enum fib_source_t_ fib_source_t
The different sources that can create a route.
u32 * auto_add_sw_if_indices
u8 translation_memory_size_set
ip_lookup_main_t * ip4_lookup_main
u32 tcp_estab_lru_head_index
vlib_simple_counter_main_t total_sessions
int nat44_ei_add_interface_address(nat44_ei_main_t *nm, u32 sw_if_index, int is_del)
vl_api_interface_index_t sw_if_index
nat44_ei_outside_fib_t * outside_fibs
void nat44_ei_set_alloc_range(u16 start_port, u16 end_port)
Set address and port assignment algorithm for port range.
u32 nat44_ei_get_in2out_worker_index(ip4_header_t *ip0, u32 rx_fib_index0, u8 is_output)
int nat44_ei_set_workers(uword *bitmap)
nat44_ei_lb_addr_port_t * locals
VLIB buffer representation.
int nat44_ei_add_address(nat44_ei_main_t *nm, ip4_address_t *addr, u32 vrf_id)
vl_api_wireguard_peer_flags_t flags