|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
15 #ifndef __included_nat64_h__
16 #define __included_nat64_h__
49 #define foreach_nat64_tcp_ses_state \
50 _(0, CLOSED, "closed") \
51 _(1, V4_INIT, "v4-init") \
52 _(2, V6_INIT, "v6-init") \
53 _(3, ESTABLISHED, "established") \
54 _(4, V4_FIN_RCV, "v4-fin-rcv") \
55 _(5, V6_FIN_RCV, "v6-fin-rcv") \
56 _(6, V6_FIN_V4_FIN_RCV, "v6-fin-v4-fin-rcv") \
61 #define _(v, N, s) NAT64_TCP_STATE_##N = v,
97 #define _(N, i, n, s) \
98 u16 busy_##n##_ports; \
99 u16 * busy_##n##_ports_per_thread; \
100 u32 busy_##n##_port_refcounts[65535];
179 #define _(x) vlib_simple_counter_main_t x;
455 uword st_memory_size);
476 #define NAT64_INTERFACE_FLAG_IS_INSIDE 1
477 #define NAT64_INTERFACE_FLAG_IS_OUTSIDE 2
483 #define nat64_interface_is_inside(i) i->flags & NAT64_INTERFACE_FLAG_IS_INSIDE
489 #define nat64_interface_is_outside(i) i->flags & NAT64_INTERFACE_FLAG_IS_OUTSIDE
510 #define nat64_log_err(...) \
511 vlib_log(VLIB_LOG_LEVEL_ERR, nat64_main.log_class, __VA_ARGS__)
512 #define nat64_log_warn(...) \
513 vlib_log(VLIB_LOG_LEVEL_WARNING, nat64_main.log_class, __VA_ARGS__)
514 #define nat64_log_notice(...) \
515 vlib_log(VLIB_LOG_LEVEL_NOTICE, nat64_main.log_class, __VA_ARGS__)
516 #define nat64_log_info(...) \
517 vlib_log(VLIB_LOG_LEVEL_INFO, nat64_main.log_class, __VA_ARGS__)
518 #define nat64_log_debug(...)\
519 vlib_log(VLIB_LOG_LEVEL_DEBUG, nat64_main.log_class, __VA_ARGS__)
NAT port/address allocation lib.
u32 * auto_add_sw_if_indices
sw_if_indices whose interface addresses should be auto-added
void nat64_reset_timeouts()
u32 fq_in2out_index
Worker handoff.
#define foreach_nat64_tcp_ses_state
vlib_log_class_t log_class
vl_api_ip_port_and_mask_t dst_port
int(* nat64_prefix_walk_fn_t)(nat64_prefix_t *pref64, void *ctx)
Call back function when walking addresses in NAT64 prefixes, non-zero return value stop walk.
unformat_function_t unformat_nat_protocol
int nat64_set_udp_timeout(u32 timeout)
Set UDP session timeout.
struct _tcp_header tcp_header_t
u32 expire_worker_walk_node_index
u32 nat64_get_udp_timeout(void)
Get UDP session timeout.
vlib_simple_counter_main_t total_bibs
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
void nat64_set_hash(u32 bib_buckets, uword bib_memory_size, u32 st_buckets, uword st_memory_size)
Set NAT64 hash tables configuration.
u32 error_node_index
node index
u32 udp_timeout
values of various timeouts
void nat64_prefix_walk(nat64_prefix_walk_fn_t fn, void *ctx)
Walk NAT64 prefixes.
void nat64_compose_ip6(ip6_address_t *ip6, ip4_address_t *ip4, u32 fib_index)
Compose IPv4-embedded IPv6 addresses.
void nat64_session_reset_timeout(nat64_db_st_entry_t *ste, vlib_main_t *vm)
Reset NAT64 session timeout.
clib_error_t * nat64_api_hookup(vlib_main_t *vm)
vlib_node_registration_t nat64_out2in_node
(constructor) VLIB_REGISTER_NODE (nat64_out2in_node)
vlib_node_registration_t nat64_in2out_node
(constructor) VLIB_REGISTER_NODE (nat64_in2out_node)
static_always_inline u8 plugin_enabled()
u32 nat64_get_worker_in2out(ip6_address_t *addr)
Get worker thread index for NAT64 in2out.
int(* nat64_pool_addr_walk_fn_t)(nat64_address_t *addr, void *ctx)
Call back function when walking addresses in NAT64 pool, non-zero return value stop walk.
void nat64_interfaces_walk(nat64_interface_walk_fn_t fn, void *ctx)
Walk NAT64 interfaces.
IPv4 shallow virtual reassembly.
u32 nat64_get_tcp_trans_timeout(void)
Get TCP transitory timeout.
void nat64_pool_addr_walk(nat64_pool_addr_walk_fn_t fn, void *ctx)
Walk NAT64 pool.
int nat64_add_del_static_bib_entry(ip6_address_t *in_addr, ip4_address_t *out_addr, u16 in_port, u16 out_port, u8 proto, u32 vrf_id, u8 is_add)
Add/delete static NAT64 BIB entry.
nat64_prefix_t * pref64
Pref64 vector.
#define static_always_inline
u32 bib_buckets
config parameters
nat64_db_t * db
BIB and session DB per thread.
u32 in2out_slowpath_node_index
nat64_static_bib_to_update_t * static_bibs
Pool of static BIB entries to be added/deleted in worker threads.
vl_api_ip_port_and_mask_t src_port
int nat64_plugin_disable()
vlib_simple_counter_main_t total_sessions
struct _vlib_node_registration vlib_node_registration_t
int nat64_alloc_out_addr_and_port(u32 fib_index, nat_protocol_t proto, ip4_address_t *addr, u16 *port, u32 thread_index)
Alloce IPv4 address and port pair from NAT64 pool.
int nat64_add_del_pool_addr(u32 thread_index, ip4_address_t *addr, u32 vrf_id, u8 is_add)
Add/delete address to NAT64 pool.
nat64_cleaner_process_event_e
@ NAT64_CLEANER_RESCHEDULE
u32 expire_walk_node_index
format_function_t format_nat_protocol
int nat64_set_icmp_timeout(u32 timeout)
Set ICMP session timeout.
void nat64_extract_ip4(ip6_address_t *ip6, ip4_address_t *ip4, u32 fib_index)
Extract IPv4 address from the IPv4-embedded IPv6 addresses.
int(* nat64_interface_walk_fn_t)(nat64_interface_t *i, void *ctx)
Call back function when walking interfaces with NAT64 feature, non-zero return value stop walk.
int nat64_interface_add_del(u32 sw_if_index, u8 is_inside, u8 is_add)
Enable/disable NAT64 feature on the interface.
nat64_interface_t * interfaces
Interface pool.
nat64_address_t * addr_pool
Address pool vector.
u32 nat64_get_tcp_est_timeout(void)
Get TCP established timeout.
#define foreach_nat_counter
int nat64_plugin_enable(nat64_config_t c)
A collection of simple counters.
u32 nat64_get_worker_out2in(vlib_buffer_t *b, ip4_header_t *ip)
Get worker thread index for NAT64 out2in.
void nat64_tcp_session_set_state(nat64_db_st_entry_t *ste, tcp_header_t *tcp, u8 is_ip6)
Set NAT64 TCP session state.
int nat64_add_interface_address(u32 sw_if_index, int is_add)
NAT64 pool address from specific (DHCP addressed) interface.
u32 nat64_get_icmp_timeout(void)
Get ICMP session timeout.
enum fib_source_t_ fib_source_t
The different sources that can create a route.
int nat64_add_del_prefix(ip6_address_t *prefix, u8 plen, u32 vrf_id, u8 is_add)
Add/delete NAT64 prefix.
int nat64_set_tcp_timeouts(u32 trans, u32 est)
Set TCP session timeouts.
void nat64_add_del_addr_to_fib(ip4_address_t *addr, u8 p_len, u32 sw_if_index, int is_add)
clib_error_t * nat64_init(vlib_main_t *vm)
Initialize NAT64.
vl_api_interface_index_t sw_if_index
VLIB buffer representation.