|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
23 #ifndef __included_det44_h__
24 #define __included_det44_h__
45 #define foreach_det44_session_state \
46 _(0, UNKNOWN, "unknown") \
47 _(1, UDP_ACTIVE, "udp-active") \
48 _(2, TCP_SYN_SENT, "tcp-syn-sent") \
49 _(3, TCP_ESTABLISHED, "tcp-established") \
50 _(4, TCP_FIN_WAIT, "tcp-fin-wait") \
51 _(5, TCP_CLOSE_WAIT, "tcp-close-wait") \
52 _(6, TCP_CLOSING, "tcp-closing") \
53 _(7, TCP_LAST_ACK, "tcp-last-ack") \
54 _(8, TCP_CLOSED, "tcp-closed") \
55 _(9, ICMP_ACTIVE, "icmp-active")
59 #define _(v, N, s) DET44_SESSION_##N = v,
64 #define DET44_SES_PER_USER 1000
194 #define det44_log_err(...) \
195 vlib_log(VLIB_LOG_LEVEL_ERR, det44_main.log_class, __VA_ARGS__)
196 #define det44_log_warn(...) \
197 vlib_log(VLIB_LOG_LEVEL_WARNING, det44_main.log_class, __VA_ARGS__)
198 #define det44_log_notice(...) \
199 vlib_log(VLIB_LOG_LEVEL_NOTICE, det44_main.log_class, __VA_ARGS__)
200 #define det44_log_info(...) \
201 vlib_log(VLIB_LOG_LEVEL_INFO, det44_main.log_class, __VA_ARGS__)
202 #define det44_log_debug(...)\
203 vlib_log(VLIB_LOG_LEVEL_DEBUG, det44_main.log_class, __VA_ARGS__)
206 #define DET44_INTERFACE_FLAG_IS_INSIDE 1
207 #define DET44_INTERFACE_FLAG_IS_OUTSIDE 2
213 #define det44_interface_is_inside(i) i->flags & DET44_INTERFACE_FLAG_IS_INSIDE
219 #define det44_interface_is_outside(i) i->flags & DET44_INTERFACE_FLAG_IS_OUTSIDE
252 u8 * dont_translate);
258 u8 * dont_translate);
260 icmp46_header_t * icmp0,
u32 sw_if_index0,
264 icmp46_header_t * icmp0,
u32 sw_if_index0,
310 u32 in_offset, out_offset;
312 in_offset = clib_net_to_host_u32 (in_addr->
as_u32) -
316 clib_host_to_net_u32 (clib_net_to_host_u32 (dm->
out_addr.
as_u32) +
325 u32 in_offset1, in_offset2, out_offset;
327 out_offset = clib_net_to_host_u32 (out_addr->
as_u32) -
332 clib_host_to_net_u32 (clib_net_to_host_u32 (dm->
in_addr.
as_u32) +
333 in_offset1 + in_offset2);
339 return (clib_net_to_host_u32 (
addr->as_u32) &
pow2_mask (32 - plen)) *
NAT port/address allocation lib.
static_always_inline u8 plugin_enabled()
vl_api_ip_port_and_mask_t dst_port
ip4_main_t ip4_main
Global ip4 main structure.
clib_error_t * det44_api_hookup(vlib_main_t *vm)
static uword pow2_mask(uword x)
#define clib_atomic_add_fetch(a, b)
ip4_address_t ext_host_addr
vlib_main_t vlib_node_runtime_t * node
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
det44_interface_t * interfaces
u32 det44_icmp_out2in(vlib_buffer_t *b0, ip4_header_t *ip0, icmp46_header_t *icmp0, u32 sw_if_index0, u32 rx_fib_index0, vlib_node_runtime_t *node, u32 next0, u32 thread_index, void *d, void *e)
static_always_inline snat_det_map_t * snat_det_map_by_user(ip4_address_t *user_addr)
struct det44_main_s det44_main_t
int det44_plugin_enable()
void nat_ipfix_logging_max_entries_per_user(u32 thread_index, u32 limit, u32 src_ip)
Generate maximum entries per user exceeded event.
#define foreach_det44_session_state
#define pool_foreach(VAR, POOL)
Iterate through pool.
static_always_inline void snat_det_reverse(snat_det_map_t *dm, ip4_address_t *out_addr, u16 out_port, ip4_address_t *in_addr)
IPv4 shallow virtual reassembly.
static_always_inline snat_det_session_t * snat_det_ses_create(u32 thread_index, snat_det_map_t *dm, ip4_address_t *in_addr, u16 in_port, snat_det_out_key_t *out)
snat_det_map_t * det_maps
det44_fib_t * outside_fibs
u32 det44_icmp_in2out(vlib_buffer_t *b0, ip4_header_t *ip0, icmp46_header_t *icmp0, u32 sw_if_index0, u32 rx_fib_index0, vlib_node_runtime_t *node, u32 next0, u32 thread_index, void *d, void *e)
#define static_always_inline
vl_api_ip_port_and_mask_t src_port
int det44_plugin_disable()
struct _vlib_node_registration vlib_node_registration_t
static_always_inline void snat_det_ses_close(snat_det_map_t *dm, snat_det_session_t *ses)
format_function_t format_det_map_ses
static_always_inline snat_det_session_t * snat_det_get_ses_by_out(snat_det_map_t *dm, ip4_address_t *in_addr, u64 out_key)
static_always_inline snat_det_session_t * snat_det_find_ses_by_in(snat_det_map_t *dm, ip4_address_t *in_addr, u16 in_port, snat_det_out_key_t out_key)
int det44_interface_add_del(u32 sw_if_index, u8 is_inside, int is_del)
void det44_reset_timeouts()
static_always_inline int is_addr_in_net(ip4_address_t *addr, ip4_address_t *net, u8 plen)
snat_det_session_t * sessions
static_always_inline void snat_det_forward(snat_det_map_t *dm, ip4_address_t *in_addr, ip4_address_t *out_addr, u16 *lo_port)
vlib_log_class_t log_class
u32 expire_walk_node_index
#define DET44_SES_PER_USER
enum fib_source_t_ fib_source_t
The different sources that can create a route.
nat_timeouts_t det44_get_timeouts()
vl_api_interface_index_t sw_if_index
vlib_node_registration_t det44_out2in_node
(constructor) VLIB_REGISTER_NODE (det44_out2in_node)
#define clib_atomic_bool_cmp_and_swap(addr, old, new)
u32 icmp_match_out2in_det(vlib_node_runtime_t *node, u32 thread_index, vlib_buffer_t *b0, ip4_header_t *ip0, ip4_address_t *addr, u16 *port, u32 *fib_index, nat_protocol_t *proto, void *d, void *e, u8 *dont_translate)
Get address and port values to be used for ICMP packet translation and create session if needed.
int det44_set_timeouts(nat_timeouts_t *timeouts)
static_always_inline u32 snat_det_user_ses_offset(ip4_address_t *addr, u8 plen)
int snat_det_add_map(ip4_address_t *in_addr, u8 in_plen, ip4_address_t *out_addr, u8 out_plen, int is_add)
Add/delete deterministic NAT mapping.
static_always_inline snat_det_map_t * snat_det_map_by_out(ip4_address_t *out_addr)
u32 icmp_match_in2out_det(vlib_node_runtime_t *node, u32 thread_index, vlib_buffer_t *b0, ip4_header_t *ip0, ip4_address_t *addr, u16 *port, u32 *fib_index, nat_protocol_t *proto, void *d, void *e, u8 *dont_translate)
Get address and port values to be used for ICMP packet translation and create session if needed.
VLIB buffer representation.
vlib_node_registration_t det44_in2out_node
(constructor) VLIB_REGISTER_NODE (det44_in2out_node)