NAT: Rename snat plugin to nat (VPP-955)
Change-Id: I30a7e3da7a4efc6038a91e27b48045d4b07e2764 Signed-off-by: Matus Fabian <matfabia@cisco.com>
This commit is contained in:
@ -169,7 +169,7 @@ PLUGIN_ENABLED(lb)
|
||||
PLUGIN_ENABLED(memif)
|
||||
PLUGIN_ENABLED(pppoe)
|
||||
PLUGIN_ENABLED(sixrd)
|
||||
PLUGIN_ENABLED(snat)
|
||||
PLUGIN_ENABLED(nat)
|
||||
|
||||
###############################################################################
|
||||
# Dependency checks
|
||||
|
@ -29,7 +29,7 @@ Now run VPP and make sure the plugin is loaded.
|
||||
...
|
||||
load_one_plugin:184: Loaded plugin: memif_plugin.so (Packet Memory Interface (experimetal))
|
||||
load_one_plugin:184: Loaded plugin: sample_plugin.so (Sample of VPP Plugin)
|
||||
load_one_plugin:184: Loaded plugin: snat_plugin.so (Network Address Translation)
|
||||
load_one_plugin:184: Loaded plugin: nat_plugin.so (Network Address Translation)
|
||||
...
|
||||
DBGvpp#
|
||||
|
||||
|
@ -74,8 +74,8 @@ if ENABLE_SIXRD_PLUGIN
|
||||
include sixrd.am
|
||||
endif
|
||||
|
||||
if ENABLE_SNAT_PLUGIN
|
||||
include snat.am
|
||||
if ENABLE_NAT_PLUGIN
|
||||
include nat.am
|
||||
endif
|
||||
|
||||
include ../suffix-rules.mk
|
||||
|
41
src/plugins/nat.am
Normal file
41
src/plugins/nat.am
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
# Copyright (c) <current-year> <your-organization>
|
||||
# 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.
|
||||
|
||||
vppapitestplugins_LTLIBRARIES += nat_test_plugin.la
|
||||
vppplugins_LTLIBRARIES += nat_plugin.la
|
||||
|
||||
nat_plugin_la_SOURCES = nat/nat.c \
|
||||
nat/nat_api.c \
|
||||
nat/in2out.c \
|
||||
nat/out2in.c \
|
||||
nat/nat_plugin.api.h \
|
||||
nat/nat_ipfix_logging.c \
|
||||
nat/nat_det.c \
|
||||
nat/nat64.c \
|
||||
nat/nat64_cli.c \
|
||||
nat/nat64_in2out.c \
|
||||
nat/nat64_out2in.c \
|
||||
nat/nat64_db.c
|
||||
|
||||
API_FILES += nat/nat.api
|
||||
|
||||
nobase_apiinclude_HEADERS += \
|
||||
nat/nat_all_api_h.h \
|
||||
nat/nat_msg_enum.h \
|
||||
nat/nat.api.h
|
||||
|
||||
nat_test_plugin_la_SOURCES = \
|
||||
nat/nat_test.c nat/nat_plugin.api.h
|
||||
|
||||
# vi:syntax=automake
|
@ -21,9 +21,9 @@
|
||||
#include <vnet/ip/ip.h>
|
||||
#include <vnet/ethernet/ethernet.h>
|
||||
#include <vnet/fib/ip4_fib.h>
|
||||
#include <snat/snat.h>
|
||||
#include <snat/snat_ipfix_logging.h>
|
||||
#include <snat/snat_det.h>
|
||||
#include <nat/nat.h>
|
||||
#include <nat/nat_ipfix_logging.h>
|
||||
#include <nat/nat_det.h>
|
||||
|
||||
#include <vppinfra/hash.h>
|
||||
#include <vppinfra/error.h>
|
||||
@ -49,7 +49,7 @@ static u8 * format_snat_in2out_trace (u8 * s, va_list * args)
|
||||
snat_in2out_trace_t * t = va_arg (*args, snat_in2out_trace_t *);
|
||||
char * tag;
|
||||
|
||||
tag = t->is_slow_path ? "SNAT_IN2OUT_SLOW_PATH" : "SNAT_IN2OUT_FAST_PATH";
|
||||
tag = t->is_slow_path ? "NAT44_IN2OUT_SLOW_PATH" : "NAT44_IN2OUT_FAST_PATH";
|
||||
|
||||
s = format (s, "%s: sw_if_index %d, next index %d, session %d", tag,
|
||||
t->sw_if_index, t->next_index, t->session_index);
|
||||
@ -63,7 +63,7 @@ static u8 * format_snat_in2out_fast_trace (u8 * s, va_list * args)
|
||||
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
|
||||
snat_in2out_trace_t * t = va_arg (*args, snat_in2out_trace_t *);
|
||||
|
||||
s = format (s, "SANT_IN2OUT_FAST: sw_if_index %d, next index %d",
|
||||
s = format (s, "NAT44_IN2OUT_FAST: sw_if_index %d, next index %d",
|
||||
t->sw_if_index, t->next_index);
|
||||
|
||||
return s;
|
||||
@ -78,7 +78,7 @@ static u8 * format_snat_in2out_worker_handoff_trace (u8 * s, va_list * args)
|
||||
char * m;
|
||||
|
||||
m = t->do_handoff ? "next worker" : "same worker";
|
||||
s = format (s, "SNAT_IN2OUT_WORKER_HANDOFF: %s %d", m, t->next_worker_index);
|
||||
s = format (s, "NAT44_IN2OUT_WORKER_HANDOFF: %s %d", m, t->next_worker_index);
|
||||
|
||||
return s;
|
||||
}
|
||||
@ -138,11 +138,11 @@ typedef enum {
|
||||
* Packets aimed at outside interface and external addresss with active session
|
||||
* should be translated.
|
||||
*
|
||||
* @param sm SNAT main
|
||||
* @param rt SNAT runtime data
|
||||
* @param sm NAT main
|
||||
* @param rt NAT runtime data
|
||||
* @param sw_if_index0 index of the inside interface
|
||||
* @param ip0 IPv4 header
|
||||
* @param proto0 SNAT protocol
|
||||
* @param proto0 NAT protocol
|
||||
* @param rx_fib_index0 RX FIB index
|
||||
*
|
||||
* @returns 0 if packet should be translated otherwise 1
|
||||
@ -502,11 +502,11 @@ snat_in2out_error_t icmp_get_key(ip4_header_t *ip0,
|
||||
}
|
||||
|
||||
/**
|
||||
* Get address and port values to be used for packet SNAT translation
|
||||
* Get address and port values to be used for ICMP packet translation
|
||||
* and create session if needed
|
||||
*
|
||||
* @param[in,out] sm SNAT main
|
||||
* @param[in,out] node SNAT node runtime
|
||||
* @param[in,out] sm NAT main
|
||||
* @param[in,out] node NAT node runtime
|
||||
* @param[in] thread_index thread index
|
||||
* @param[in,out] b0 buffer containing packet to be translated
|
||||
* @param[out] p_proto protocol used for matching
|
||||
@ -601,10 +601,10 @@ out:
|
||||
}
|
||||
|
||||
/**
|
||||
* Get address and port values to be used for packet SNAT translation
|
||||
* Get address and port values to be used for ICMP packet translation
|
||||
*
|
||||
* @param[in] sm SNAT main
|
||||
* @param[in,out] node SNAT node runtime
|
||||
* @param[in] sm NAT main
|
||||
* @param[in,out] node NAT node runtime
|
||||
* @param[in] thread_index thread index
|
||||
* @param[in,out] b0 buffer containing packet to be translated
|
||||
* @param[out] p_proto protocol used for matching
|
||||
@ -810,12 +810,12 @@ out:
|
||||
* communicate even if they only use each other's external IP addresses
|
||||
* and ports.
|
||||
*
|
||||
* @param sm SNAT main.
|
||||
* @param sm NAT main.
|
||||
* @param b0 Vlib buffer.
|
||||
* @param ip0 IP header.
|
||||
* @param udp0 UDP header.
|
||||
* @param tcp0 TCP header.
|
||||
* @param proto0 SNAT protocol.
|
||||
* @param proto0 NAT protocol.
|
||||
*/
|
||||
static inline void
|
||||
snat_hairpinning (snat_main_t *sm,
|
||||
@ -1956,7 +1956,7 @@ snat_in2out_fast_path_fn (vlib_main_t * vm,
|
||||
|
||||
VLIB_REGISTER_NODE (snat_in2out_node) = {
|
||||
.function = snat_in2out_fast_path_fn,
|
||||
.name = "snat-in2out",
|
||||
.name = "nat44-in2out",
|
||||
.vector_size = sizeof (u32),
|
||||
.format_trace = format_snat_in2out_trace,
|
||||
.type = VLIB_NODE_TYPE_INTERNAL,
|
||||
@ -1972,7 +1972,7 @@ VLIB_REGISTER_NODE (snat_in2out_node) = {
|
||||
.next_nodes = {
|
||||
[SNAT_IN2OUT_NEXT_DROP] = "error-drop",
|
||||
[SNAT_IN2OUT_NEXT_LOOKUP] = "ip4-lookup",
|
||||
[SNAT_IN2OUT_NEXT_SLOW_PATH] = "snat-in2out-slowpath",
|
||||
[SNAT_IN2OUT_NEXT_SLOW_PATH] = "nat44-in2out-slowpath",
|
||||
[SNAT_IN2OUT_NEXT_ICMP_ERROR] = "ip4-icmp-error",
|
||||
},
|
||||
};
|
||||
@ -1989,7 +1989,7 @@ snat_in2out_output_fast_path_fn (vlib_main_t * vm,
|
||||
|
||||
VLIB_REGISTER_NODE (snat_in2out_output_node) = {
|
||||
.function = snat_in2out_output_fast_path_fn,
|
||||
.name = "snat-in2out-output",
|
||||
.name = "nat44-in2out-output",
|
||||
.vector_size = sizeof (u32),
|
||||
.format_trace = format_snat_in2out_trace,
|
||||
.type = VLIB_NODE_TYPE_INTERNAL,
|
||||
@ -2005,7 +2005,7 @@ VLIB_REGISTER_NODE (snat_in2out_output_node) = {
|
||||
.next_nodes = {
|
||||
[SNAT_IN2OUT_NEXT_DROP] = "error-drop",
|
||||
[SNAT_IN2OUT_NEXT_LOOKUP] = "interface-output",
|
||||
[SNAT_IN2OUT_NEXT_SLOW_PATH] = "snat-in2out-output-slowpath",
|
||||
[SNAT_IN2OUT_NEXT_SLOW_PATH] = "nat44-in2out-output-slowpath",
|
||||
[SNAT_IN2OUT_NEXT_ICMP_ERROR] = "ip4-icmp-error",
|
||||
},
|
||||
};
|
||||
@ -2023,7 +2023,7 @@ snat_in2out_slow_path_fn (vlib_main_t * vm,
|
||||
|
||||
VLIB_REGISTER_NODE (snat_in2out_slowpath_node) = {
|
||||
.function = snat_in2out_slow_path_fn,
|
||||
.name = "snat-in2out-slowpath",
|
||||
.name = "nat44-in2out-slowpath",
|
||||
.vector_size = sizeof (u32),
|
||||
.format_trace = format_snat_in2out_trace,
|
||||
.type = VLIB_NODE_TYPE_INTERNAL,
|
||||
@ -2039,7 +2039,7 @@ VLIB_REGISTER_NODE (snat_in2out_slowpath_node) = {
|
||||
.next_nodes = {
|
||||
[SNAT_IN2OUT_NEXT_DROP] = "error-drop",
|
||||
[SNAT_IN2OUT_NEXT_LOOKUP] = "ip4-lookup",
|
||||
[SNAT_IN2OUT_NEXT_SLOW_PATH] = "snat-in2out-slowpath",
|
||||
[SNAT_IN2OUT_NEXT_SLOW_PATH] = "nat44-in2out-slowpath",
|
||||
[SNAT_IN2OUT_NEXT_ICMP_ERROR] = "ip4-icmp-error",
|
||||
},
|
||||
};
|
||||
@ -2057,7 +2057,7 @@ snat_in2out_output_slow_path_fn (vlib_main_t * vm,
|
||||
|
||||
VLIB_REGISTER_NODE (snat_in2out_output_slowpath_node) = {
|
||||
.function = snat_in2out_output_slow_path_fn,
|
||||
.name = "snat-in2out-output-slowpath",
|
||||
.name = "nat44-in2out-output-slowpath",
|
||||
.vector_size = sizeof (u32),
|
||||
.format_trace = format_snat_in2out_trace,
|
||||
.type = VLIB_NODE_TYPE_INTERNAL,
|
||||
@ -2073,7 +2073,7 @@ VLIB_REGISTER_NODE (snat_in2out_output_slowpath_node) = {
|
||||
.next_nodes = {
|
||||
[SNAT_IN2OUT_NEXT_DROP] = "error-drop",
|
||||
[SNAT_IN2OUT_NEXT_LOOKUP] = "interface-output",
|
||||
[SNAT_IN2OUT_NEXT_SLOW_PATH] = "snat-in2out-output-slowpath",
|
||||
[SNAT_IN2OUT_NEXT_SLOW_PATH] = "nat44-in2out-output-slowpath",
|
||||
[SNAT_IN2OUT_NEXT_ICMP_ERROR] = "ip4-icmp-error",
|
||||
},
|
||||
};
|
||||
@ -2658,7 +2658,7 @@ snat_det_in2out_node_fn (vlib_main_t * vm,
|
||||
|
||||
VLIB_REGISTER_NODE (snat_det_in2out_node) = {
|
||||
.function = snat_det_in2out_node_fn,
|
||||
.name = "snat-det-in2out",
|
||||
.name = "nat44-det-in2out",
|
||||
.vector_size = sizeof (u32),
|
||||
.format_trace = format_snat_in2out_trace,
|
||||
.type = VLIB_NODE_TYPE_INTERNAL,
|
||||
@ -2681,11 +2681,11 @@ VLIB_REGISTER_NODE (snat_det_in2out_node) = {
|
||||
VLIB_NODE_FUNCTION_MULTIARCH (snat_det_in2out_node, snat_det_in2out_node_fn);
|
||||
|
||||
/**
|
||||
* Get address and port values to be used for packet SNAT translation
|
||||
* Get address and port values to be used for ICMP packet translation
|
||||
* and create session if needed
|
||||
*
|
||||
* @param[in,out] sm SNAT main
|
||||
* @param[in,out] node SNAT node runtime
|
||||
* @param[in,out] sm NAT main
|
||||
* @param[in,out] node NAT node runtime
|
||||
* @param[in] thread_index thread index
|
||||
* @param[in,out] b0 buffer containing packet to be translated
|
||||
* @param[out] p_proto protocol used for matching
|
||||
@ -3009,7 +3009,7 @@ snat_in2out_worker_handoff_fn (vlib_main_t * vm,
|
||||
|
||||
VLIB_REGISTER_NODE (snat_in2out_worker_handoff_node) = {
|
||||
.function = snat_in2out_worker_handoff_fn,
|
||||
.name = "snat-in2out-worker-handoff",
|
||||
.name = "nat44-in2out-worker-handoff",
|
||||
.vector_size = sizeof (u32),
|
||||
.format_trace = format_snat_in2out_worker_handoff_trace,
|
||||
.type = VLIB_NODE_TYPE_INTERNAL,
|
||||
@ -3034,7 +3034,7 @@ snat_in2out_output_worker_handoff_fn (vlib_main_t * vm,
|
||||
|
||||
VLIB_REGISTER_NODE (snat_in2out_output_worker_handoff_node) = {
|
||||
.function = snat_in2out_output_worker_handoff_fn,
|
||||
.name = "snat-in2out-output-worker-handoff",
|
||||
.name = "nat44-in2out-output-worker-handoff",
|
||||
.vector_size = sizeof (u32),
|
||||
.format_trace = format_snat_in2out_worker_handoff_trace,
|
||||
.type = VLIB_NODE_TYPE_INTERNAL,
|
||||
@ -3160,7 +3160,7 @@ snat_hairpin_dst_fn (vlib_main_t * vm,
|
||||
|
||||
VLIB_REGISTER_NODE (snat_hairpin_dst_node) = {
|
||||
.function = snat_hairpin_dst_fn,
|
||||
.name = "snat-hairpin-dst",
|
||||
.name = "nat44-hairpin-dst",
|
||||
.vector_size = sizeof (u32),
|
||||
.type = VLIB_NODE_TYPE_INTERNAL,
|
||||
.n_errors = ARRAY_LEN(snat_in2out_error_strings),
|
||||
@ -3240,7 +3240,7 @@ snat_hairpin_src_fn (vlib_main_t * vm,
|
||||
|
||||
VLIB_REGISTER_NODE (snat_hairpin_src_node) = {
|
||||
.function = snat_hairpin_src_fn,
|
||||
.name = "snat-hairpin-src",
|
||||
.name = "nat44-hairpin-src",
|
||||
.vector_size = sizeof (u32),
|
||||
.type = VLIB_NODE_TYPE_INTERNAL,
|
||||
.n_errors = ARRAY_LEN(snat_in2out_error_strings),
|
||||
@ -3248,9 +3248,9 @@ VLIB_REGISTER_NODE (snat_hairpin_src_node) = {
|
||||
.n_next_nodes = SNAT_HAIRPIN_SRC_N_NEXT,
|
||||
.next_nodes = {
|
||||
[SNAT_HAIRPIN_SRC_NEXT_DROP] = "error-drop",
|
||||
[SNAT_HAIRPIN_SRC_NEXT_SNAT_IN2OUT] = "snat-in2out-output",
|
||||
[SNAT_HAIRPIN_SRC_NEXT_SNAT_IN2OUT] = "nat44-in2out-output",
|
||||
[SNAT_HAIRPIN_SRC_NEXT_INTERFACE_OUTPUT] = "interface-output",
|
||||
[SNAT_HAIRPIN_SRC_NEXT_SNAT_IN2OUT_WH] = "snat-in2out-output-worker-handoff",
|
||||
[SNAT_HAIRPIN_SRC_NEXT_SNAT_IN2OUT_WH] = "nat44-in2out-output-worker-handoff",
|
||||
},
|
||||
};
|
||||
|
||||
@ -3430,7 +3430,7 @@ snat_in2out_fast_static_map_fn (vlib_main_t * vm,
|
||||
|
||||
VLIB_REGISTER_NODE (snat_in2out_fast_node) = {
|
||||
.function = snat_in2out_fast_static_map_fn,
|
||||
.name = "snat-in2out-fast",
|
||||
.name = "nat44-in2out-fast",
|
||||
.vector_size = sizeof (u32),
|
||||
.format_trace = format_snat_in2out_fast_trace,
|
||||
.type = VLIB_NODE_TYPE_INTERNAL,
|
||||
@ -3446,7 +3446,7 @@ VLIB_REGISTER_NODE (snat_in2out_fast_node) = {
|
||||
.next_nodes = {
|
||||
[SNAT_IN2OUT_NEXT_DROP] = "error-drop",
|
||||
[SNAT_IN2OUT_NEXT_LOOKUP] = "ip4-lookup",
|
||||
[SNAT_IN2OUT_NEXT_SLOW_PATH] = "snat-in2out-slowpath",
|
||||
[SNAT_IN2OUT_NEXT_SLOW_PATH] = "nat44-in2out-slowpath",
|
||||
[SNAT_IN2OUT_NEXT_ICMP_ERROR] = "ip4-icmp-error",
|
||||
},
|
||||
};
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* snat.h - simple nat definitions
|
||||
* nat.h - NAT plugin definitions
|
||||
*
|
||||
* Copyright (c) 2016 Cisco and/or its affiliates.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -15,8 +15,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef __included_snat_h__
|
||||
#define __included_snat_h__
|
||||
#ifndef __included_nat_h__
|
||||
#define __included_nat_h__
|
||||
|
||||
#include <vnet/vnet.h>
|
||||
#include <vnet/ip/ip.h>
|
||||
@ -538,4 +538,4 @@ is_interface_addr(snat_main_t *sm, vlib_node_runtime_t *node, u32 sw_if_index0,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* __included_snat_h__ */
|
||||
#endif /* __included_nat_h__ */
|
@ -17,8 +17,8 @@
|
||||
* @brief NAT64 implementation
|
||||
*/
|
||||
|
||||
#include <snat/nat64.h>
|
||||
#include <snat/nat64_db.h>
|
||||
#include <nat/nat64.h>
|
||||
#include <nat/nat64_db.h>
|
||||
#include <vnet/fib/ip4_fib.h>
|
||||
|
||||
|
@ -19,8 +19,8 @@
|
||||
#ifndef __included_nat64_h__
|
||||
#define __included_nat64_h__
|
||||
|
||||
#include <snat/snat.h>
|
||||
#include <snat/nat64_db.h>
|
||||
#include <nat/nat.h>
|
||||
#include <nat/nat64_db.h>
|
||||
|
||||
#define foreach_nat64_tcp_ses_state \
|
||||
_(0, CLOSED, "closed") \
|
@ -17,8 +17,8 @@
|
||||
* @brief NAT64 CLI
|
||||
*/
|
||||
|
||||
#include <snat/nat64.h>
|
||||
#include <snat/snat.h>
|
||||
#include <nat/nat64.h>
|
||||
#include <nat/nat.h>
|
||||
#include <vnet/fib/fib_table.h>
|
||||
|
||||
static clib_error_t *
|
@ -16,7 +16,7 @@
|
||||
* @file
|
||||
* @brief NAT64 DB
|
||||
*/
|
||||
#include <snat/nat64_db.h>
|
||||
#include <nat/nat64_db.h>
|
||||
|
||||
int
|
||||
nat64_db_init (nat64_db_t * db)
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include <vppinfra/bihash_24_8.h>
|
||||
#include <vppinfra/bihash_48_8.h>
|
||||
#include <snat/snat.h>
|
||||
#include <nat/nat.h>
|
||||
|
||||
|
||||
typedef struct
|
@ -17,7 +17,7 @@
|
||||
* @brief NAT64 IPv6 to IPv4 translation (inside to outside network)
|
||||
*/
|
||||
|
||||
#include <snat/nat64.h>
|
||||
#include <nat/nat64.h>
|
||||
#include <vnet/ip/ip6_to_ip4.h>
|
||||
#include <vnet/fib/fib_table.h>
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @brief NAT64 IPv4 to IPv6 translation (otside to inside network)
|
||||
*/
|
||||
|
||||
#include <snat/nat64.h>
|
||||
#include <nat/nat64.h>
|
||||
#include <vnet/ip/ip4_to_ip6.h>
|
||||
#include <vnet/fib/ip4_fib.h>
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* snat_all_api_h.h - skeleton vpp engine plug-in api #include file
|
||||
* nat_all_api_h.h - skeleton vpp engine plug-in api #include file
|
||||
*
|
||||
* Copyright (c) <current-year> <your-organization>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -16,4 +16,4 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* Include the generated file, see BUILT_SOURCES in Makefile.am */
|
||||
#include <snat/snat.api.h>
|
||||
#include <nat/nat.api.h>
|
File diff suppressed because it is too large
Load Diff
@ -19,7 +19,7 @@
|
||||
* @brief deterministic NAT
|
||||
*/
|
||||
|
||||
#include <snat/snat_det.h>
|
||||
#include <nat/nat_det.h>
|
||||
|
||||
|
||||
/**
|
||||
@ -105,7 +105,7 @@ snat_det_add_map (snat_main_t * sm, ip4_address_t * in_addr, u8 in_plen,
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The 'snat-det-expire-walk' process's main loop.
|
||||
* @brief The 'nat-det-expire-walk' process's main loop.
|
||||
*
|
||||
* Check expire time for active sessions.
|
||||
*/
|
||||
@ -145,7 +145,7 @@ VLIB_REGISTER_NODE (snat_det_expire_walk_node, static) = {
|
||||
.function = snat_det_expire_walk_fn,
|
||||
.type = VLIB_NODE_TYPE_PROCESS,
|
||||
.name =
|
||||
"snat-det-expire-walk",
|
||||
"nat-det-expire-walk",
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* snat_det.h - deterministic nat definitions
|
||||
* snat_det.h - deterministic NAT definitions
|
||||
*
|
||||
* Copyright (c) 2017 Cisco and/or its affiliates.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -19,12 +19,12 @@
|
||||
* @brief deterministic NAT definitions
|
||||
*/
|
||||
|
||||
#ifndef __included_snat_det_h__
|
||||
#define __included_snat_det_h__
|
||||
#ifndef __included_nat_det_h__
|
||||
#define __included_nat_det_h__
|
||||
|
||||
#include <vnet/ip/ip.h>
|
||||
#include <snat/snat.h>
|
||||
#include <snat/snat_ipfix_logging.h>
|
||||
#include <nat/nat.h>
|
||||
#include <nat/nat_ipfix_logging.h>
|
||||
|
||||
|
||||
#define SNAT_DET_SES_PER_USER 1000
|
||||
@ -185,7 +185,7 @@ snat_det_ses_close (snat_det_map_t * dm, snat_det_session_t * ses)
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* __included_snat_det_h__ */
|
||||
#endif /* __included_nat_det_h__ */
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* snat_ipfix_logging.c - NAT Events IPFIX logging
|
||||
* nat_ipfix_logging.c - NAT Events IPFIX logging
|
||||
*
|
||||
* Copyright (c) 2016 Cisco and/or its affiliates.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -17,8 +17,8 @@
|
||||
|
||||
#include <vnet/flow/flow_report.h>
|
||||
#include <vlibmemory/api.h>
|
||||
#include <snat/snat.h>
|
||||
#include <snat/snat_ipfix_logging.h>
|
||||
#include <nat/nat.h>
|
||||
#include <nat/nat_ipfix_logging.h>
|
||||
|
||||
snat_ipfix_logging_main_t snat_ipfix_logging_main;
|
||||
|
||||
@ -610,7 +610,7 @@ snat_ipfix_logging_nat44_ses_rpc_cb (snat_ipfix_logging_nat44_ses_args_t *a)
|
||||
*
|
||||
* @param src_ip source IPv4 address
|
||||
* @param nat_src_ip transaltes source IPv4 address
|
||||
* @param snat_proto SNAT transport protocol
|
||||
* @param snat_proto NAT transport protocol
|
||||
* @param src_port source port
|
||||
* @param nat_src_port translated source port
|
||||
* @param vrf_id VRF ID
|
||||
@ -642,7 +642,7 @@ snat_ipfix_logging_nat44_ses_create (u32 src_ip,
|
||||
*
|
||||
* @param src_ip source IPv4 address
|
||||
* @param nat_src_ip transaltes source IPv4 address
|
||||
* @param snat_proto SNAT transport protocol
|
||||
* @param snat_proto NAT transport protocol
|
||||
* @param src_port source port
|
||||
* @param nat_src_port translated source port
|
||||
* @param vrf_id VRF ID
|
||||
@ -751,7 +751,7 @@ snat_data_callback_max_entries_per_usr (flow_report_main_t * frm,
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable/disable SNAT IPFIX logging
|
||||
* @brief Enable/disable NAT plugin IPFIX logging
|
||||
*
|
||||
* @param enable 1 if enable, 0 if disable
|
||||
* @param domain_id observation domain ID
|
||||
@ -818,7 +818,7 @@ snat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize SNAT IPFIX logging
|
||||
* @brief Initialize NAT plugin IPFIX logging
|
||||
*
|
||||
* @param vm vlib main
|
||||
*/
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* snat_ipfix_logging.h - NAT Events IPFIX logging
|
||||
* nat_ipfix_logging.h - NAT Events IPFIX logging
|
||||
*
|
||||
* Copyright (c) 2016 Cisco and/or its affiliates.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -14,8 +14,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef __included_snat_ipfix_logging_h__
|
||||
#define __included_snat_ipfix_logging_h__
|
||||
#ifndef __included_nat_ipfix_logging_h__
|
||||
#define __included_nat_ipfix_logging_h__
|
||||
|
||||
typedef enum {
|
||||
NAT_ADDRESSES_EXHAUTED = 3,
|
||||
@ -30,7 +30,7 @@ typedef enum {
|
||||
} quota_exceed_event_t;
|
||||
|
||||
typedef struct {
|
||||
/** S-NAT IPFIX logging enabled */
|
||||
/** NAT plugin IPFIX logging enabled */
|
||||
u8 enabled;
|
||||
|
||||
/** ipfix buffers under construction */
|
||||
@ -76,4 +76,4 @@ void snat_ipfix_logging_nat44_ses_delete (u32 src_ip, u32 nat_src_ip,
|
||||
void snat_ipfix_logging_addresses_exhausted(u32 pool_id);
|
||||
void snat_ipfix_logging_max_entries_per_user(u32 src_ip);
|
||||
|
||||
#endif /* __included_snat_ipfix_logging_h__ */
|
||||
#endif /* __included_nat_ipfix_logging_h__ */
|
@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* snat_msg_enum.h - skeleton vpp engine plug-in message enumeration
|
||||
* nat_msg_enum.h - skeleton vpp engine plug-in message enumeration
|
||||
*
|
||||
* Copyright (c) <current-year> <your-organization>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -15,17 +15,17 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef included_snat_msg_enum_h
|
||||
#define included_snat_msg_enum_h
|
||||
#ifndef included_nat_msg_enum_h
|
||||
#define included_nat_msg_enum_h
|
||||
|
||||
#include <vppinfra/byte_order.h>
|
||||
|
||||
#define vl_msg_id(n,h) n,
|
||||
typedef enum {
|
||||
#include <snat/snat_all_api_h.h>
|
||||
#include <nat/nat_all_api_h.h>
|
||||
/* We'll want to know how many messages IDs we need... */
|
||||
VL_MSG_FIRST_AVAILABLE,
|
||||
} vl_msg_id_t;
|
||||
#undef vl_msg_id
|
||||
|
||||
#endif /* included_snat_msg_enum_h */
|
||||
#endif /* included_nat_msg_enum_h */
|
@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* snat.c - skeleton vpp-api-test plug-in
|
||||
* nat.c - skeleton vpp-api-test plug-in
|
||||
*
|
||||
* Copyright (c) <current-year> <your-organization>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -21,7 +21,7 @@
|
||||
#include <vlibsocket/api.h>
|
||||
#include <vppinfra/error.h>
|
||||
#include <vnet/ip/ip.h>
|
||||
#include <snat/snat.h>
|
||||
#include <nat/nat.h>
|
||||
|
||||
#define __plugin_msg_base snat_test_main.msg_id_base
|
||||
#include <vlibapi/vat_helper_macros.h>
|
||||
@ -29,28 +29,28 @@
|
||||
uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
|
||||
|
||||
/* Declare message IDs */
|
||||
#include <snat/snat_msg_enum.h>
|
||||
#include <nat/nat_msg_enum.h>
|
||||
|
||||
/* define message structures */
|
||||
#define vl_typedefs
|
||||
#include <snat/snat_all_api_h.h>
|
||||
#include <nat/nat_all_api_h.h>
|
||||
#undef vl_typedefs
|
||||
|
||||
/* declare message handlers for each api */
|
||||
|
||||
#define vl_endianfun /* define message structures */
|
||||
#include <snat/snat_all_api_h.h>
|
||||
#include <nat/nat_all_api_h.h>
|
||||
#undef vl_endianfun
|
||||
|
||||
/* instantiate all the print functions we know about */
|
||||
#define vl_print(handle, ...)
|
||||
#define vl_printfun
|
||||
#include <snat/snat_all_api_h.h>
|
||||
#include <nat/nat_all_api_h.h>
|
||||
#undef vl_printfun
|
||||
|
||||
/* Get the API version number. */
|
||||
#define vl_api_version(n,v) static u32 api_version=(v);
|
||||
#include <snat/snat_all_api_h.h>
|
||||
#include <nat/nat_all_api_h.h>
|
||||
#undef vl_api_version
|
||||
|
||||
typedef struct {
|
@ -22,9 +22,9 @@
|
||||
#include <vnet/udp/udp.h>
|
||||
#include <vnet/ethernet/ethernet.h>
|
||||
#include <vnet/fib/ip4_fib.h>
|
||||
#include <snat/snat.h>
|
||||
#include <snat/snat_ipfix_logging.h>
|
||||
#include <snat/snat_det.h>
|
||||
#include <nat/nat.h>
|
||||
#include <nat/nat_ipfix_logging.h>
|
||||
#include <nat/nat_det.h>
|
||||
|
||||
#include <vppinfra/hash.h>
|
||||
#include <vppinfra/error.h>
|
||||
@ -48,7 +48,7 @@ static u8 * format_snat_out2in_trace (u8 * s, va_list * args)
|
||||
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
|
||||
snat_out2in_trace_t * t = va_arg (*args, snat_out2in_trace_t *);
|
||||
|
||||
s = format (s, "SNAT_OUT2IN: sw_if_index %d, next index %d, session index %d",
|
||||
s = format (s, "NAT44_OUT2IN: sw_if_index %d, next index %d, session index %d",
|
||||
t->sw_if_index, t->next_index, t->session_index);
|
||||
return s;
|
||||
}
|
||||
@ -59,7 +59,7 @@ static u8 * format_snat_out2in_fast_trace (u8 * s, va_list * args)
|
||||
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
|
||||
snat_out2in_trace_t * t = va_arg (*args, snat_out2in_trace_t *);
|
||||
|
||||
s = format (s, "SNAT_OUT2IN_FAST: sw_if_index %d, next index %d",
|
||||
s = format (s, "NAT44_OUT2IN_FAST: sw_if_index %d, next index %d",
|
||||
t->sw_if_index, t->next_index);
|
||||
return s;
|
||||
}
|
||||
@ -73,7 +73,7 @@ static u8 * format_snat_out2in_worker_handoff_trace (u8 * s, va_list * args)
|
||||
char * m;
|
||||
|
||||
m = t->do_handoff ? "next worker" : "same worker";
|
||||
s = format (s, "SNAT_OUT2IN_WORKER_HANDOFF: %s %d", m, t->next_worker_index);
|
||||
s = format (s, "NAT44_OUT2IN_WORKER_HANDOFF: %s %d", m, t->next_worker_index);
|
||||
|
||||
return s;
|
||||
}
|
||||
@ -115,10 +115,10 @@ typedef enum {
|
||||
* Create NAT session initiated by host from external network with static
|
||||
* mapping.
|
||||
*
|
||||
* @param sm SNAT main.
|
||||
* @param sm NAT main.
|
||||
* @param b0 Vlib buffer.
|
||||
* @param in2out In2out SNAT session key.
|
||||
* @param out2in Out2in SNAT session key.
|
||||
* @param in2out In2out NAT44 session key.
|
||||
* @param out2in Out2in NAT44 session key.
|
||||
* @param node Vlib node.
|
||||
*
|
||||
* @returns SNAT session if successfully created otherwise 0.
|
||||
@ -276,11 +276,11 @@ snat_out2in_error_t icmp_get_key(ip4_header_t *ip0,
|
||||
}
|
||||
|
||||
/**
|
||||
* Get address and port values to be used for packet SNAT translation
|
||||
* Get address and port values to be used for ICMP packet translation
|
||||
* and create session if needed
|
||||
*
|
||||
* @param[in,out] sm SNAT main
|
||||
* @param[in,out] node SNAT node runtime
|
||||
* @param[in,out] sm NAT main
|
||||
* @param[in,out] node NAT node runtime
|
||||
* @param[in] thread_index thread index
|
||||
* @param[in,out] b0 buffer containing packet to be translated
|
||||
* @param[out] p_proto protocol used for matching
|
||||
@ -387,10 +387,10 @@ out:
|
||||
}
|
||||
|
||||
/**
|
||||
* Get address and port values to be used for packet SNAT translation
|
||||
* Get address and port values to be used for ICMP packet translation
|
||||
*
|
||||
* @param[in] sm SNAT main
|
||||
* @param[in,out] node SNAT node runtime
|
||||
* @param[in] sm NAT main
|
||||
* @param[in,out] node NAT node runtime
|
||||
* @param[in] thread_index thread index
|
||||
* @param[in,out] b0 buffer containing packet to be translated
|
||||
* @param[out] p_proto protocol used for matching
|
||||
@ -1292,7 +1292,7 @@ snat_out2in_node_fn (vlib_main_t * vm,
|
||||
|
||||
VLIB_REGISTER_NODE (snat_out2in_node) = {
|
||||
.function = snat_out2in_node_fn,
|
||||
.name = "snat-out2in",
|
||||
.name = "nat44-out2in",
|
||||
.vector_size = sizeof (u32),
|
||||
.format_trace = format_snat_out2in_trace,
|
||||
.type = VLIB_NODE_TYPE_INTERNAL,
|
||||
@ -1779,7 +1779,7 @@ snat_det_out2in_node_fn (vlib_main_t * vm,
|
||||
|
||||
VLIB_REGISTER_NODE (snat_det_out2in_node) = {
|
||||
.function = snat_det_out2in_node_fn,
|
||||
.name = "snat-det-out2in",
|
||||
.name = "nat44-det-out2in",
|
||||
.vector_size = sizeof (u32),
|
||||
.format_trace = format_snat_out2in_trace,
|
||||
.type = VLIB_NODE_TYPE_INTERNAL,
|
||||
@ -1801,11 +1801,11 @@ VLIB_REGISTER_NODE (snat_det_out2in_node) = {
|
||||
VLIB_NODE_FUNCTION_MULTIARCH (snat_det_out2in_node, snat_det_out2in_node_fn);
|
||||
|
||||
/**
|
||||
* Get address and port values to be used for packet SNAT translation
|
||||
* Get address and port values to be used for ICMP packet translation
|
||||
* and create session if needed
|
||||
*
|
||||
* @param[in,out] sm SNAT main
|
||||
* @param[in,out] node SNAT node runtime
|
||||
* @param[in,out] sm NAT main
|
||||
* @param[in,out] node NAT node runtime
|
||||
* @param[in] thread_index thread index
|
||||
* @param[in,out] b0 buffer containing packet to be translated
|
||||
* @param[out] p_proto protocol used for matching
|
||||
@ -2089,7 +2089,7 @@ snat_out2in_worker_handoff_fn (vlib_main_t * vm,
|
||||
|
||||
VLIB_REGISTER_NODE (snat_out2in_worker_handoff_node) = {
|
||||
.function = snat_out2in_worker_handoff_fn,
|
||||
.name = "snat-out2in-worker-handoff",
|
||||
.name = "nat44-out2in-worker-handoff",
|
||||
.vector_size = sizeof (u32),
|
||||
.format_trace = format_snat_out2in_worker_handoff_trace,
|
||||
.type = VLIB_NODE_TYPE_INTERNAL,
|
||||
@ -2272,7 +2272,7 @@ snat_out2in_fast_node_fn (vlib_main_t * vm,
|
||||
|
||||
VLIB_REGISTER_NODE (snat_out2in_fast_node) = {
|
||||
.function = snat_out2in_fast_node_fn,
|
||||
.name = "snat-out2in-fast",
|
||||
.name = "nat44-out2in-fast",
|
||||
.vector_size = sizeof (u32),
|
||||
.format_trace = format_snat_out2in_fast_trace,
|
||||
.type = VLIB_NODE_TYPE_INTERNAL,
|
@ -1,41 +0,0 @@
|
||||
|
||||
# Copyright (c) <current-year> <your-organization>
|
||||
# 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.
|
||||
|
||||
vppapitestplugins_LTLIBRARIES += snat_test_plugin.la
|
||||
vppplugins_LTLIBRARIES += snat_plugin.la
|
||||
|
||||
snat_plugin_la_SOURCES = snat/snat.c \
|
||||
snat/snat_api.c \
|
||||
snat/in2out.c \
|
||||
snat/out2in.c \
|
||||
snat/snat_plugin.api.h \
|
||||
snat/snat_ipfix_logging.c \
|
||||
snat/snat_det.c \
|
||||
snat/nat64.c \
|
||||
snat/nat64_cli.c \
|
||||
snat/nat64_in2out.c \
|
||||
snat/nat64_out2in.c \
|
||||
snat/nat64_db.c
|
||||
|
||||
API_FILES += snat/snat.api
|
||||
|
||||
nobase_apiinclude_HEADERS += \
|
||||
snat/snat_all_api_h.h \
|
||||
snat/snat_msg_enum.h \
|
||||
snat/snat.api.h
|
||||
|
||||
snat_test_plugin_la_SOURCES = \
|
||||
snat/snat_test.c snat/snat_plugin.api.h
|
||||
|
||||
# vi:syntax=automake
|
@ -30,7 +30,7 @@ packet-generator new {
|
||||
}
|
||||
}
|
||||
|
||||
snat add address 172.16.1.3
|
||||
nat44 add address 172.16.1.3
|
||||
set int ip address pg0 10.0.0.1/24
|
||||
set int ip address pg1 172.16.1.1/24
|
||||
set int state pg0 up
|
||||
@ -38,4 +38,4 @@ set int state pg1 up
|
||||
set ip arp static pg0 10.0.0.3 abcd.abcd.abcd
|
||||
set ip arp static pg0 10.0.0.4 abcd.abcd.abcd
|
||||
set ip arp static pg1 172.16.1.2 cdef.abcd.abcd
|
||||
set int snat in pg0 out pg1
|
||||
set int nat44 in pg0 out pg1
|
@ -96,7 +96,7 @@ packet-generator new {
|
||||
}
|
||||
}
|
||||
|
||||
snat deterministic add in 10.0.0.0/21 out 1.1.1.2/32
|
||||
nat44 deterministic add in 10.0.0.0/21 out 1.1.1.2/32
|
||||
set int ip address pg0 10.0.0.1/24
|
||||
set int ip address pg1 172.16.1.1/24
|
||||
set int state pg0 up
|
||||
@ -104,5 +104,5 @@ set int state pg1 up
|
||||
set ip arp static pg0 10.0.0.3 abcd.abcd.abcd
|
||||
set ip arp static pg0 10.0.0.4 abcd.abcd.abcd
|
||||
set ip arp static pg1 172.16.1.2 cdef.abcd.abcd
|
||||
set int snat in pg0 out pg1
|
||||
set int nat44 in pg0 out pg1
|
||||
trace add pg-input 10
|
@ -32,13 +32,13 @@ packet-generator new {
|
||||
}
|
||||
}
|
||||
|
||||
snat add address 172.16.1.3
|
||||
snat add static mapping local 10.0.0.3 external 172.16.1.3
|
||||
nat44 add address 172.16.1.3
|
||||
nat44 add static mapping local 10.0.0.3 external 172.16.1.3
|
||||
set int ip address pg0 10.0.0.1/24
|
||||
set int ip address pg1 172.16.1.1/24
|
||||
set int state pg0 up
|
||||
set int state pg1 up
|
||||
set ip arp static pg0 10.0.0.3 abcd.abcd.abcd
|
||||
set ip arp static pg1 172.16.1.2 cdef.abcd.abcd
|
||||
set int snat in pg0 out pg1
|
||||
set int nat44 in pg0 out pg1
|
||||
trace add pg-input 10
|
@ -32,13 +32,13 @@ packet-generator new {
|
||||
}
|
||||
}
|
||||
|
||||
snat add address 172.16.1.3
|
||||
snat add static mapping local 10.0.0.3 3000 external 172.16.1.3 3000
|
||||
nat44 add address 172.16.1.3
|
||||
nat44 add static mapping local 10.0.0.3 3000 external 172.16.1.3 3000
|
||||
set int ip address pg0 10.0.0.1/24
|
||||
set int ip address pg1 172.16.1.1/24
|
||||
set int state pg0 up
|
||||
set int state pg1 up
|
||||
set ip arp static pg0 10.0.0.3 abcd.abcd.abcd
|
||||
set ip arp static pg1 172.16.1.2 cdef.abcd.abcd
|
||||
set int snat in pg0 out pg1
|
||||
set int nat44 in pg0 out pg1
|
||||
trace add pg-input 10
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user