aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/nat/CMakeLists.txt1
-rw-r--r--src/plugins/nat/dslite/dslite.h29
-rw-r--r--src/plugins/nat/dslite/dslite_ce_decap.c3
-rw-r--r--src/plugins/nat/dslite/dslite_ce_encap.c3
-rw-r--r--src/plugins/nat/dslite/dslite_cli.c22
-rw-r--r--src/plugins/nat/dslite/dslite_dpo.c1
-rw-r--r--src/plugins/nat/dslite/dslite_in2out.c19
-rw-r--r--src/plugins/nat/dslite/dslite_out2in.c19
-rw-r--r--src/plugins/nat/lib/alloc.c1
-rw-r--r--src/plugins/nat/lib/alloc.h25
-rw-r--r--src/plugins/nat/lib/inlines.h69
-rw-r--r--src/plugins/nat/lib/lib.h54
-rw-r--r--src/plugins/nat/nat.h1
-rw-r--r--src/plugins/nat/nat_syslog.c30
-rw-r--r--src/plugins/nat/nat_syslog.h20
15 files changed, 213 insertions, 84 deletions
diff --git a/src/plugins/nat/CMakeLists.txt b/src/plugins/nat/CMakeLists.txt
index a1a01789240..8803ee0819e 100644
--- a/src/plugins/nat/CMakeLists.txt
+++ b/src/plugins/nat/CMakeLists.txt
@@ -80,7 +80,6 @@ add_vpp_plugin(nat
add_vpp_plugin(dslite
SOURCES
- nat_format.c
nat_syslog.c
dslite/dslite_api.c
dslite/dslite_dpo.c
diff --git a/src/plugins/nat/dslite/dslite.h b/src/plugins/nat/dslite/dslite.h
index d512cf47c9b..8cb73d88409 100644
--- a/src/plugins/nat/dslite/dslite.h
+++ b/src/plugins/nat/dslite/dslite.h
@@ -15,12 +15,35 @@
#ifndef __included_dslite_h__
#define __included_dslite_h__
+#include <vppinfra/dlist.h>
#include <vppinfra/bihash_8_8.h>
#include <vppinfra/bihash_16_8.h>
#include <vppinfra/bihash_24_8.h>
+
+#include <nat/lib/lib.h>
#include <nat/lib/alloc.h>
-#include <nat/nat.h>
-#include <nat/nat_inlines.h>
+#include <nat/lib/inlines.h>
+
+typedef struct
+{
+ u16 identifier;
+ u16 sequence;
+} echo_header_t;
+
+/* session key (4-tuple) */
+typedef struct
+{
+ union
+ {
+ struct
+ {
+ ip4_address_t addr;
+ u16 port;
+ u16 protocol:3, fib_index:13;
+ };
+ u64 as_u64;
+ };
+} nat_session_key_t;
typedef struct
{
@@ -41,7 +64,7 @@ typedef struct
/* *INDENT-OFF* */
typedef CLIB_PACKED (struct
{
- snat_session_key_t out2in;
+ nat_session_key_t out2in;
dslite_session_key_t in2out;
u32 per_b4_index;
u32 per_b4_list_head_index;
diff --git a/src/plugins/nat/dslite/dslite_ce_decap.c b/src/plugins/nat/dslite/dslite_ce_decap.c
index 3d6ca992e45..56af25129f2 100644
--- a/src/plugins/nat/dslite/dslite_ce_decap.c
+++ b/src/plugins/nat/dslite/dslite_ce_decap.c
@@ -13,7 +13,6 @@
* limitations under the License.
*/
#include <nat/dslite/dslite.h>
-#include <nat/nat_inlines.h>
typedef enum
{
@@ -80,7 +79,7 @@ VLIB_NODE_FN (dslite_ce_decap_node) (vlib_main_t * vm,
}
ip40 = vlib_buffer_get_current (b0) + sizeof (ip6_header_t);
- proto0 = ip_proto_to_snat_proto (ip40->protocol);
+ proto0 = ip_proto_to_nat_proto (ip40->protocol);
if (PREDICT_FALSE (proto0 == ~0))
{
diff --git a/src/plugins/nat/dslite/dslite_ce_encap.c b/src/plugins/nat/dslite/dslite_ce_encap.c
index 8cec5439243..74b5bc39fbe 100644
--- a/src/plugins/nat/dslite/dslite_ce_encap.c
+++ b/src/plugins/nat/dslite/dslite_ce_encap.c
@@ -13,7 +13,6 @@
* limitations under the License.
*/
#include <nat/dslite/dslite.h>
-#include <nat/nat_inlines.h>
typedef enum
{
@@ -66,7 +65,7 @@ VLIB_NODE_FN (dslite_ce_encap_node) (vlib_main_t * vm,
b0 = vlib_get_buffer (vm, bi0);
ip40 = vlib_buffer_get_current (b0);
- proto0 = ip_proto_to_snat_proto (ip40->protocol);
+ proto0 = ip_proto_to_nat_proto (ip40->protocol);
if (PREDICT_FALSE (proto0 == ~0))
{
diff --git a/src/plugins/nat/dslite/dslite_cli.c b/src/plugins/nat/dslite/dslite_cli.c
index d5c0ca6498b..0819f95261a 100644
--- a/src/plugins/nat/dslite/dslite_cli.c
+++ b/src/plugins/nat/dslite/dslite_cli.c
@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
#include <nat/dslite/dslite.h>
static clib_error_t *
@@ -205,6 +204,25 @@ dslite_show_b4_ip6_addr_command_fn (vlib_main_t * vm,
}
static u8 *
+format_nat_protocol (u8 * s, va_list * args)
+{
+ u32 i = va_arg (*args, u32);
+ u8 *t = 0;
+
+ switch (i)
+ {
+#define _(N, j, n, str) case NAT_PROTOCOL_##N: t = (u8 *) str; break;
+ foreach_nat_protocol
+#undef _
+ default:
+ s = format (s, "unknown");
+ return s;
+ }
+ s = format (s, "%s", t);
+ return s;
+}
+
+static u8 *
format_dslite_session (u8 * s, va_list * args)
{
dslite_session_t *session = va_arg (*args, dslite_session_t *);
@@ -216,7 +234,7 @@ format_dslite_session (u8 * s, va_list * args)
clib_net_to_host_u16 (session->in2out.port),
format_ip4_address, &session->out2in.addr,
clib_net_to_host_u16 (session->out2in.port),
- format_snat_protocol, session->in2out.proto);
+ format_nat_protocol, session->in2out.proto);
s = format (s, "%Utotal pkts %d, total bytes %lld\n",
format_white_space, indent + 4,
session->total_pkts, session->total_bytes);
diff --git a/src/plugins/nat/dslite/dslite_dpo.c b/src/plugins/nat/dslite/dslite_dpo.c
index 009b5536289..120a6f0f7c7 100644
--- a/src/plugins/nat/dslite/dslite_dpo.c
+++ b/src/plugins/nat/dslite/dslite_dpo.c
@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
#include <vnet/ip/ip.h>
#include <nat/dslite/dslite_dpo.h>
diff --git a/src/plugins/nat/dslite/dslite_in2out.c b/src/plugins/nat/dslite/dslite_in2out.c
index d1ac17509c6..1d00bb2d7fe 100644
--- a/src/plugins/nat/dslite/dslite_in2out.c
+++ b/src/plugins/nat/dslite/dslite_in2out.c
@@ -13,7 +13,6 @@
* limitations under the License.
*/
#include <nat/dslite/dslite.h>
-#include <nat/nat_inlines.h>
#include <nat/nat_syslog.h>
typedef enum
@@ -42,7 +41,7 @@ slow_path (dslite_main_t * dm, dslite_session_key_t * in2out_key,
dlist_elt_t *head_elt, *oldest_elt, *elt;
u32 oldest_index;
dslite_session_t *s;
- snat_session_key_t out2in_key;
+ nat_session_key_t out2in_key;
nat_ip4_addr_port_t addr_port;
u32 b4_index;
@@ -189,7 +188,7 @@ dslite_icmp_in2out (dslite_main_t * dm, ip6_header_t * ip6,
clib_bihash_kv_24_8_t kv, value;
dslite_session_key_t key;
u32 n = next;
- icmp_echo_header_t *echo;
+ echo_header_t *echo;
u32 new_addr, old_addr;
u16 old_id, new_id;
ip_csum_t sum;
@@ -201,11 +200,11 @@ dslite_icmp_in2out (dslite_main_t * dm, ip6_header_t * ip6,
goto done;
}
- echo = (icmp_echo_header_t *) (icmp + 1);
+ echo = (echo_header_t *) (icmp + 1);
key.addr = ip4->src_address;
key.port = echo->identifier;
- key.proto = SNAT_PROTOCOL_ICMP;
+ key.proto = NAT_PROTOCOL_ICMP;
key.softwire_id.as_u64[0] = ip6->src_address.as_u64[0];
key.softwire_id.as_u64[1] = ip6->src_address.as_u64[1];
key.pad = 0;
@@ -237,7 +236,7 @@ dslite_icmp_in2out (dslite_main_t * dm, ip6_header_t * ip6,
old_id = echo->identifier;
echo->identifier = new_id = s->out2in.port;
sum = icmp->checksum;
- sum = ip_csum_update (sum, old_id, new_id, icmp_echo_header_t, identifier);
+ sum = ip_csum_update (sum, old_id, new_id, echo_header_t, identifier);
icmp->checksum = ip_csum_fold (sum);
done:
@@ -315,7 +314,7 @@ dslite_in2out_node_fn_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
}
ip40 = vlib_buffer_get_current (b0) + sizeof (ip6_header_t);
- proto0 = ip_proto_to_snat_proto (ip40->protocol);
+ proto0 = ip_proto_to_nat_proto (ip40->protocol);
if (PREDICT_FALSE (proto0 == ~0))
{
@@ -329,7 +328,7 @@ dslite_in2out_node_fn_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (is_slow_path)
{
- if (PREDICT_FALSE (proto0 == SNAT_PROTOCOL_ICMP))
+ if (PREDICT_FALSE (proto0 == NAT_PROTOCOL_ICMP))
{
next0 =
dslite_icmp_in2out (dm, ip60, ip40, &s0, next0, &error0,
@@ -342,7 +341,7 @@ dslite_in2out_node_fn_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
}
else
{
- if (PREDICT_FALSE (proto0 == SNAT_PROTOCOL_ICMP))
+ if (PREDICT_FALSE (proto0 == NAT_PROTOCOL_ICMP))
{
next0 = DSLITE_IN2OUT_NEXT_SLOWPATH;
goto trace0;
@@ -390,7 +389,7 @@ dslite_in2out_node_fn_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
ip_csum_update (sum0, old_addr0, new_addr0, ip4_header_t,
src_address);
ip40->checksum = ip_csum_fold (sum0);
- if (PREDICT_TRUE (proto0 == SNAT_PROTOCOL_TCP))
+ if (PREDICT_TRUE (proto0 == NAT_PROTOCOL_TCP))
{
old_port0 = tcp0->src_port;
tcp0->src_port = s0->out2in.port;
diff --git a/src/plugins/nat/dslite/dslite_out2in.c b/src/plugins/nat/dslite/dslite_out2in.c
index ac64a589509..96cf9188cf6 100644
--- a/src/plugins/nat/dslite/dslite_out2in.c
+++ b/src/plugins/nat/dslite/dslite_out2in.c
@@ -13,7 +13,6 @@
* limitations under the License.
*/
#include <nat/dslite/dslite.h>
-#include <nat/nat_inlines.h>
typedef enum
{
@@ -37,14 +36,14 @@ dslite_icmp_out2in (dslite_main_t * dm, ip4_header_t * ip4,
dslite_session_t *s = 0;
icmp46_header_t *icmp = ip4_next_header (ip4);
clib_bihash_kv_8_8_t kv, value;
- snat_session_key_t key;
+ nat_session_key_t key;
u32 n = next;
- icmp_echo_header_t *echo;
+ echo_header_t *echo;
u32 new_addr, old_addr;
u16 old_id, new_id;
ip_csum_t sum;
- echo = (icmp_echo_header_t *) (icmp + 1);
+ echo = (echo_header_t *) (icmp + 1);
if (icmp_type_is_error_message (icmp->type)
|| (icmp->type != ICMP4_echo_reply))
@@ -56,7 +55,7 @@ dslite_icmp_out2in (dslite_main_t * dm, ip4_header_t * ip4,
key.addr = ip4->dst_address;
key.port = echo->identifier;
- key.protocol = SNAT_PROTOCOL_ICMP;
+ key.protocol = NAT_PROTOCOL_ICMP;
key.fib_index = 0;
kv.key = key.as_u64;
@@ -77,7 +76,7 @@ dslite_icmp_out2in (dslite_main_t * dm, ip4_header_t * ip4,
old_id = echo->identifier;
echo->identifier = new_id = s->in2out.port;
sum = icmp->checksum;
- sum = ip_csum_update (sum, old_id, new_id, icmp_echo_header_t, identifier);
+ sum = ip_csum_update (sum, old_id, new_id, echo_header_t, identifier);
icmp->checksum = ip_csum_fold (sum);
old_addr = ip4->dst_address.as_u32;
@@ -129,7 +128,7 @@ VLIB_NODE_FN (dslite_out2in_node) (vlib_main_t * vm,
udp_header_t *udp0;
tcp_header_t *tcp0;
clib_bihash_kv_8_8_t kv0, value0;
- snat_session_key_t key0;
+ nat_session_key_t key0;
dslite_session_t *s0 = 0;
ip_csum_t sum0;
u32 new_addr0, old_addr0;
@@ -145,7 +144,7 @@ VLIB_NODE_FN (dslite_out2in_node) (vlib_main_t * vm,
b0 = vlib_get_buffer (vm, bi0);
ip40 = vlib_buffer_get_current (b0);
- proto0 = ip_proto_to_snat_proto (ip40->protocol);
+ proto0 = ip_proto_to_nat_proto (ip40->protocol);
if (PREDICT_FALSE (proto0 == ~0))
{
@@ -154,7 +153,7 @@ VLIB_NODE_FN (dslite_out2in_node) (vlib_main_t * vm,
goto trace0;
}
- if (PREDICT_FALSE (proto0 == SNAT_PROTOCOL_ICMP))
+ if (PREDICT_FALSE (proto0 == NAT_PROTOCOL_ICMP))
{
next0 =
dslite_icmp_out2in (dm, ip40, &s0, next0, &error0,
@@ -198,7 +197,7 @@ VLIB_NODE_FN (dslite_out2in_node) (vlib_main_t * vm,
dst_address);
ip40->checksum = ip_csum_fold (sum0);
- if (PREDICT_TRUE (proto0 == SNAT_PROTOCOL_TCP))
+ if (PREDICT_TRUE (proto0 == NAT_PROTOCOL_TCP))
{
old_port0 = tcp0->dst_port;
tcp0->dst_port = s0->in2out.port;
diff --git a/src/plugins/nat/lib/alloc.c b/src/plugins/nat/lib/alloc.c
index 33c2c071d62..ed4ba060b0b 100644
--- a/src/plugins/nat/lib/alloc.c
+++ b/src/plugins/nat/lib/alloc.c
@@ -17,6 +17,7 @@
* @brief NAT port/address allocation lib
*/
+#include <nat/lib/lib.h>
#include <nat/lib/alloc.h>
static_always_inline void
diff --git a/src/plugins/nat/lib/alloc.h b/src/plugins/nat/lib/alloc.h
index 9dba2ca94da..a9a2c15fedc 100644
--- a/src/plugins/nat/lib/alloc.h
+++ b/src/plugins/nat/lib/alloc.h
@@ -22,31 +22,6 @@
#include <vnet/ip/ip.h>
-#define foreach_nat_error \
- _(VALUE_EXIST, -1, "Value already exists") \
- _(NO_SUCH_ENTRY, -2, "No such entry") \
- _(UNKNOWN_PROTOCOL, -3, "Unknown protocol") \
- _(OUT_OF_TRANSLATIONS, -4, "Out of translations")
-
-#define foreach_nat_protocol \
- _(UDP, 0, udp, "udp") \
- _(TCP, 1, tcp, "tcp") \
- _(ICMP, 2, icmp, "icmp")
-
-typedef enum
-{
-#define _(N, i, s) NAT_ERROR_##N = i,
- foreach_nat_error
-#undef _
-} nat_error_t;
-
-typedef enum
-{
-#define _(N, i, n, s) NAT_PROTOCOL_##N = i,
- foreach_nat_protocol
-#undef _
-} nat_protocol_t;
-
typedef struct nat_ip4_pool_addr_s nat_ip4_pool_addr_t;
typedef struct nat_ip4_addr_port_s nat_ip4_addr_port_t;
typedef struct nat_ip4_pool_s nat_ip4_pool_t;
diff --git a/src/plugins/nat/lib/inlines.h b/src/plugins/nat/lib/inlines.h
new file mode 100644
index 00000000000..f2bd5e08ce6
--- /dev/null
+++ b/src/plugins/nat/lib/inlines.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2020 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @brief The NAT44 inline functions
+ */
+#ifndef included_nat_inlines_h__
+#define included_nat_inlines_h__
+
+static_always_inline u32
+ip_proto_to_nat_proto (u8 ip_proto)
+{
+ u32 nat_proto = ~0;
+
+ nat_proto = (ip_proto == IP_PROTOCOL_UDP) ? NAT_PROTOCOL_UDP : nat_proto;
+ nat_proto = (ip_proto == IP_PROTOCOL_TCP) ? NAT_PROTOCOL_TCP : nat_proto;
+ nat_proto = (ip_proto == IP_PROTOCOL_ICMP) ? NAT_PROTOCOL_ICMP : nat_proto;
+ nat_proto = (ip_proto == IP_PROTOCOL_ICMP6) ? NAT_PROTOCOL_ICMP : nat_proto;
+
+ return nat_proto;
+}
+
+static_always_inline u8
+nat_proto_to_ip_proto (nat_protocol_t nat_proto)
+{
+ u8 ip_proto = ~0;
+
+ ip_proto = (nat_proto == NAT_PROTOCOL_UDP) ? IP_PROTOCOL_UDP : ip_proto;
+ ip_proto = (nat_proto == NAT_PROTOCOL_TCP) ? IP_PROTOCOL_TCP : ip_proto;
+ ip_proto = (nat_proto == NAT_PROTOCOL_ICMP) ? IP_PROTOCOL_ICMP : ip_proto;
+
+ return ip_proto;
+}
+
+static_always_inline u8
+icmp_type_is_error_message (u8 icmp_type)
+{
+ switch (icmp_type)
+ {
+ case ICMP4_destination_unreachable:
+ case ICMP4_time_exceeded:
+ case ICMP4_parameter_problem:
+ case ICMP4_source_quench:
+ case ICMP4_redirect:
+ case ICMP4_alternate_host_address:
+ return 1;
+ }
+ return 0;
+}
+
+#endif /* included_nat_inlines_h__ */
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/plugins/nat/lib/lib.h b/src/plugins/nat/lib/lib.h
new file mode 100644
index 00000000000..005db81b4a3
--- /dev/null
+++ b/src/plugins/nat/lib/lib.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2020 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file
+ * @brief NAT port/address allocation lib
+ */
+#ifndef included_nat_lib_h__
+#define included_nat_lib_h__
+
+#define foreach_nat_error \
+ _(VALUE_EXIST, -1, "Value already exists") \
+ _(NO_SUCH_ENTRY, -2, "No such entry") \
+ _(UNKNOWN_PROTOCOL, -3, "Unknown protocol") \
+ _(OUT_OF_TRANSLATIONS, -4, "Out of translations")
+
+#define foreach_nat_protocol \
+ _(UDP, 0, udp, "udp") \
+ _(TCP, 1, tcp, "tcp") \
+ _(ICMP, 2, icmp, "icmp")
+
+typedef enum
+{
+#define _(N, i, s) NAT_ERROR_##N = i,
+ foreach_nat_error
+#undef _
+} nat_error_t;
+
+typedef enum
+{
+#define _(N, i, n, s) NAT_PROTOCOL_##N = i,
+ foreach_nat_protocol
+#undef _
+} nat_protocol_t;
+
+#endif /* included_nat_lib_h__ */
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/plugins/nat/nat.h b/src/plugins/nat/nat.h
index fd7ec3b1434..9bcce9d43cc 100644
--- a/src/plugins/nat/nat.h
+++ b/src/plugins/nat/nat.h
@@ -1438,7 +1438,6 @@ typedef struct
} tcp_udp_header_t;
#endif /* __included_nat_h__ */
-
/*
* fd.io coding-style-patch-verification: ON
*
diff --git a/src/plugins/nat/nat_syslog.c b/src/plugins/nat/nat_syslog.c
index 07fe2ea5808..0d7053d9ce3 100644
--- a/src/plugins/nat/nat_syslog.c
+++ b/src/plugins/nat/nat_syslog.c
@@ -16,14 +16,12 @@
* @file
* @brief NAT syslog logging
*/
-
#include <vnet/fib/fib_table.h>
#include <vnet/ip/ip.h>
#include <vnet/syslog/syslog.h>
#include <nat/nat_syslog.h>
-#include <nat/nat_inlines.h>
-
+#include <nat/lib/inlines.h>
#define NAT_FACILITY SYSLOG_FACILITY_LOCAL0
@@ -61,7 +59,7 @@
static inline void
nat_syslog_nat44_apmap (u32 ssubix, u32 sfibix, ip4_address_t * isaddr,
u16 isport, ip4_address_t * xsaddr, u16 xsport,
- snat_protocol_t proto, u8 is_add,
+ nat_protocol_t proto, u8 is_add,
ip6_address_t * sv6enc)
{
syslog_msg_t syslog_msg;
@@ -100,7 +98,7 @@ nat_syslog_nat44_apmap (u32 ssubix, u32 sfibix, ip4_address_t * isaddr,
syslog_msg_add_sd_param (&syslog_msg, XSPORT_SDPARAM_NAME, "%d",
clib_net_to_host_u16 (xsport));
syslog_msg_add_sd_param (&syslog_msg, PROTO_SDPARAM_NAME, "%d",
- snat_proto_to_ip_proto (proto));
+ nat_proto_to_ip_proto (proto));
syslog_msg_send (&syslog_msg);
}
@@ -108,7 +106,7 @@ nat_syslog_nat44_apmap (u32 ssubix, u32 sfibix, ip4_address_t * isaddr,
void
nat_syslog_nat44_apmadd (u32 ssubix, u32 sfibix, ip4_address_t * isaddr,
u16 isport, ip4_address_t * xsaddr, u16 xsport,
- snat_protocol_t proto)
+ nat_protocol_t proto)
{
nat_syslog_nat44_apmap (ssubix, sfibix, isaddr, isport, xsaddr, xsport,
proto, 1, 0);
@@ -117,7 +115,7 @@ nat_syslog_nat44_apmadd (u32 ssubix, u32 sfibix, ip4_address_t * isaddr,
void
nat_syslog_nat44_apmdel (u32 ssubix, u32 sfibix, ip4_address_t * isaddr,
u16 isport, ip4_address_t * xsaddr, u16 xsport,
- snat_protocol_t proto)
+ nat_protocol_t proto)
{
nat_syslog_nat44_apmap (ssubix, sfibix, isaddr, isport, xsaddr, xsport,
proto, 0, 0);
@@ -127,7 +125,7 @@ void
nat_syslog_dslite_apmadd (u32 ssubix, ip6_address_t * sv6enc,
ip4_address_t * isaddr, u16 isport,
ip4_address_t * xsaddr, u16 xsport,
- snat_protocol_t proto)
+ nat_protocol_t proto)
{
nat_syslog_nat44_apmap (ssubix, 0, isaddr, isport, xsaddr, xsport,
proto, 1, sv6enc);
@@ -137,7 +135,7 @@ void
nat_syslog_dslite_apmdel (u32 ssubix, ip6_address_t * sv6enc,
ip4_address_t * isaddr, u16 isport,
ip4_address_t * xsaddr, u16 xsport,
- snat_protocol_t proto)
+ nat_protocol_t proto)
{
nat_syslog_nat44_apmap (ssubix, 0, isaddr, isport, xsaddr, xsport,
proto, 0, sv6enc);
@@ -148,7 +146,7 @@ nat_syslog_nat44_sess (u32 ssubix, u32 sfibix, ip4_address_t * isaddr,
u16 isport, ip4_address_t * xsaddr, u16 xsport,
ip4_address_t * idaddr, u16 idport,
ip4_address_t * xdaddr, u16 xdport,
- snat_protocol_t proto, u8 is_add, u8 is_twicenat)
+ nat_protocol_t proto, u8 is_add, u8 is_twicenat)
{
syslog_msg_t syslog_msg;
fib_table_t *fib;
@@ -179,7 +177,7 @@ nat_syslog_nat44_sess (u32 ssubix, u32 sfibix, ip4_address_t * isaddr,
syslog_msg_add_sd_param (&syslog_msg, XSPORT_SDPARAM_NAME, "%d",
clib_net_to_host_u16 (xsport));
syslog_msg_add_sd_param (&syslog_msg, PROTO_SDPARAM_NAME, "%d",
- snat_proto_to_ip_proto (proto));
+ nat_proto_to_ip_proto (proto));
syslog_msg_add_sd_param (&syslog_msg, XDADDR_SDPARAM_NAME, "%U",
format_ip4_address, xdaddr);
syslog_msg_add_sd_param (&syslog_msg, XDPORT_SDPARAM_NAME, "%d",
@@ -200,7 +198,7 @@ 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,
- snat_protocol_t proto, u8 is_twicenat)
+ nat_protocol_t proto, u8 is_twicenat)
{
nat_syslog_nat44_sess (ssubix, sfibix, isaddr, isport, xsaddr, xsport,
idaddr, idport, xdaddr, xdport, proto, 1,
@@ -212,7 +210,7 @@ nat_syslog_nat44_sdel (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,
- snat_protocol_t proto, u8 is_twicenat)
+ nat_protocol_t proto, u8 is_twicenat)
{
nat_syslog_nat44_sess (ssubix, sfibix, isaddr, isport, xsaddr, xsport,
idaddr, idport, xdaddr, xdport, proto, 0,
@@ -223,7 +221,7 @@ static inline void
nat_syslog_nat64_sess (u32 sfibix, ip6_address_t * isaddr, u16 isport,
ip4_address_t * xsaddr, u16 xsport,
ip4_address_t * xdaddr, u16 xdport,
- snat_protocol_t proto, u8 is_add)
+ nat_protocol_t proto, u8 is_add)
{
syslog_msg_t syslog_msg;
fib_table_t *fib;
@@ -265,7 +263,7 @@ void
nat_syslog_nat64_sadd (u32 sfibix, ip6_address_t * isaddr, u16 isport,
ip4_address_t * xsaddr, u16 xsport,
ip4_address_t * xdaddr, u16 xdport,
- snat_protocol_t proto)
+ nat_protocol_t proto)
{
nat_syslog_nat64_sess (sfibix, isaddr, isport, xsaddr, xsport, xdaddr,
xdport, proto, 1);
@@ -275,7 +273,7 @@ void
nat_syslog_nat64_sdel (u32 sfibix, ip6_address_t * isaddr, u16 isport,
ip4_address_t * xsaddr, u16 xsport,
ip4_address_t * xdaddr, u16 xdport,
- snat_protocol_t proto)
+ nat_protocol_t proto)
{
nat_syslog_nat64_sess (sfibix, isaddr, isport, xsaddr, xsport, xdaddr,
xdport, proto, 0);
diff --git a/src/plugins/nat/nat_syslog.h b/src/plugins/nat/nat_syslog.h
index 15a891fd0c0..755e344ee67 100644
--- a/src/plugins/nat/nat_syslog.h
+++ b/src/plugins/nat/nat_syslog.h
@@ -16,56 +16,54 @@
* @file
* @brief NAT syslog logging
*/
-
#ifndef __included_nat_syslog_h__
#define __included_nat_syslog_h__
-#include <nat/nat.h>
+#include <nat/lib/lib.h>
void nat_syslog_nat44_apmadd (u32 ssubix, u32 sfibix, ip4_address_t * isaddr,
u16 isport, ip4_address_t * xsaddr, u16 xsport,
- snat_protocol_t proto);
+ nat_protocol_t proto);
void nat_syslog_nat44_apmdel (u32 ssubix, u32 sfibix, ip4_address_t * isaddr,
u16 isport, ip4_address_t * xsaddr, u16 xsport,
- snat_protocol_t proto);
+ nat_protocol_t proto);
void
nat_syslog_dslite_apmadd (u32 ssubix, ip6_address_t * sv6enc,
ip4_address_t * isaddr, u16 isport,
ip4_address_t * xsaddr, u16 xsport,
- snat_protocol_t proto);
+ nat_protocol_t proto);
void
nat_syslog_dslite_apmdel (u32 ssubix, ip6_address_t * sv6enc,
ip4_address_t * isaddr, u16 isport,
ip4_address_t * xsaddr, u16 xsport,
- snat_protocol_t proto);
+ nat_protocol_t proto);
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,
- snat_protocol_t proto, u8 is_twicenat);
+ nat_protocol_t proto, u8 is_twicenat);
void nat_syslog_nat44_sdel (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,
- snat_protocol_t proto, u8 is_twicenat);
+ nat_protocol_t proto, u8 is_twicenat);
void nat_syslog_nat64_sadd (u32 sfibix, ip6_address_t * isaddr, u16 isport,
ip4_address_t * xsaddr, u16 xsport,
ip4_address_t * xdaddr, u16 xdport,
- snat_protocol_t proto);
+ nat_protocol_t proto);
void nat_syslog_nat64_sdel (u32 sfibix, ip6_address_t * isaddr, u16 isport,
ip4_address_t * xsaddr, u16 xsport,
ip4_address_t * xdaddr, u16 xdport,
- snat_protocol_t proto);
+ nat_protocol_t proto);
#endif /* __included_nat_syslog_h__ */
-
/*
* fd.io coding-style-patch-verification: ON
*