From 06596c54dc51e35222737b01c617cc675505a260 Mon Sep 17 00:00:00 2001 From: Matus Fabian Date: Tue, 6 Jun 2017 04:53:28 -0700 Subject: NAT64: Add NAT64 support for snat plugin (VPP-699) Basic NAT64 feature (no hairpinning, no multi-thread). Change-Id: I392fccbce93e70c117f4a9a7ec7cf08d6c537f2d Signed-off-by: Matus Fabian --- src/plugins/snat/snat.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/plugins/snat/snat.h') diff --git a/src/plugins/snat/snat.h b/src/plugins/snat/snat.h index d76026cd..016c2ff5 100644 --- a/src/plugins/snat/snat.h +++ b/src/plugins/snat/snat.h @@ -30,8 +30,10 @@ #define SNAT_UDP_TIMEOUT 300 +#define SNAT_UDP_TIMEOUT_MIN 120 #define SNAT_TCP_TRANSITORY_TIMEOUT 240 #define SNAT_TCP_ESTABLISHED_TIMEOUT 7440 +#define SNAT_TCP_INCOMING_SYN 6 #define SNAT_ICMP_TIMEOUT 60 /* Key */ @@ -383,14 +385,15 @@ typedef struct { u16 sequence; } icmp_echo_header_t; -always_inline snat_protocol_t +always_inline u32 ip_proto_to_snat_proto (u8 ip_proto) { - snat_protocol_t snat_proto = ~0; + u32 snat_proto = ~0; snat_proto = (ip_proto == IP_PROTOCOL_UDP) ? SNAT_PROTOCOL_UDP : snat_proto; snat_proto = (ip_proto == IP_PROTOCOL_TCP) ? SNAT_PROTOCOL_TCP : snat_proto; snat_proto = (ip_proto == IP_PROTOCOL_ICMP) ? SNAT_PROTOCOL_ICMP : snat_proto; + snat_proto = (ip_proto == IP_PROTOCOL_ICMP6) ? SNAT_PROTOCOL_ICMP : snat_proto; return snat_proto; } @@ -445,6 +448,9 @@ clib_error_t * snat_api_init(vlib_main_t * vm, snat_main_t * sm); int snat_set_workers (uword * bitmap); int snat_interface_add_del(u32 sw_if_index, u8 is_inside, int is_del); int snat_add_interface_address(snat_main_t *sm, u32 sw_if_index, int is_del); +uword unformat_snat_protocol(unformat_input_t * input, va_list * args); +u8 * format_snat_protocol(u8 * s, va_list * args); + static_always_inline u8 icmp_is_error_message (icmp46_header_t * icmp) { -- cgit 1.2.3-korg