summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat44-ei/nat44_ei_in2out.c
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2020-12-21 18:20:00 +0100
committerOle Tr�an <otroan@employees.org>2021-01-11 09:26:28 +0000
commit68d7c546fa7e6c801031f2922c9be067d64e0f59 (patch)
tree91c772be339c023da07cf0ad832370340b096667 /src/plugins/nat/nat44-ei/nat44_ei_in2out.c
parent0bc78d80363efc22d07171473933d1b0016440e4 (diff)
nat: refactor and split fo EI/ED features p.2
Patch n. 2 aimed at moving EI features out of NAT44 plugin & split of EI/ED functions. Type: refactor Change-Id: Ida20c1c084449b146344b6c3d8442f49efb6f3fa Signed-off-by: Filip Varga <fivarga@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat44-ei/nat44_ei_in2out.c')
-rw-r--r--src/plugins/nat/nat44-ei/nat44_ei_in2out.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/plugins/nat/nat44-ei/nat44_ei_in2out.c b/src/plugins/nat/nat44-ei/nat44_ei_in2out.c
index 1c341318957..892518fff97 100644
--- a/src/plugins/nat/nat44-ei/nat44_ei_in2out.c
+++ b/src/plugins/nat/nat44-ei/nat44_ei_in2out.c
@@ -29,6 +29,7 @@
#include <nat/nat_inlines.h>
#include <nat/lib/nat_syslog.h>
#include <nat/nat44-ei/nat44_ei_inlines.h>
+#include <nat/nat44-ei/nat44_ei.h>
#include <vppinfra/hash.h>
#include <vppinfra/error.h>
@@ -130,10 +131,10 @@ snat_not_translate (snat_main_t * sm, vlib_node_runtime_t * node,
ip4_address_t placeholder_addr;
u16 placeholder_port;
u32 placeholder_fib_index;
- if (!snat_static_mapping_match
- (sm, ip0->dst_address, udp0->dst_port, sm->outside_fib_index,
- proto0, &placeholder_addr, &placeholder_port,
- &placeholder_fib_index, 1, 0, 0, 0, 0, 0, 0))
+ if (!nat44_ei_static_mapping_match (ip0->dst_address, udp0->dst_port,
+ sm->outside_fib_index, proto0,
+ &placeholder_addr, &placeholder_port,
+ &placeholder_fib_index, 1, 0, 0))
return 0;
}
else
@@ -270,9 +271,9 @@ slow_path (snat_main_t * sm, vlib_buffer_t * b0,
}
/* First try to match static mapping by local address and port */
- if (snat_static_mapping_match
- (sm, i2o_addr, i2o_port, rx_fib_index0, nat_proto, &sm_addr,
- &sm_port, &sm_fib_index, 0, 0, 0, 0, 0, &identity_nat, 0))
+ if (nat44_ei_static_mapping_match (i2o_addr, i2o_port, rx_fib_index0,
+ nat_proto, &sm_addr, &sm_port,
+ &sm_fib_index, 0, 0, &identity_nat))
{
/* Try to create dynamic translation */
if (sm->alloc_addr_and_port (
@@ -592,9 +593,9 @@ icmp_match_in2out_fast (snat_main_t * sm, vlib_node_runtime_t * node,
u16 sm_port;
u32 sm_fib_index;
- if (snat_static_mapping_match
- (sm, *addr, *port, *fib_index, *proto, &sm_addr, &sm_port,
- &sm_fib_index, 0, &is_addr_only, 0, 0, 0, 0, 0))
+ if (nat44_ei_static_mapping_match (*addr, *port, *fib_index, *proto,
+ &sm_addr, &sm_port, &sm_fib_index, 0,
+ &is_addr_only, 0))
{
if (PREDICT_FALSE (snat_not_translate_fast (sm, node, sw_if_index0, ip0,
IP_PROTOCOL_ICMP,
@@ -1831,9 +1832,9 @@ VLIB_NODE_FN (snat_in2out_fast_node) (vlib_main_t * vm,
goto trace0;
}
- if (snat_static_mapping_match
- (sm, ip0->src_address, udp0->src_port, rx_fib_index0, proto0,
- &sm0_addr, &sm0_port, &sm0_fib_index, 0, 0, 0, 0, 0, 0, 0))
+ if (nat44_ei_static_mapping_match (
+ ip0->src_address, udp0->src_port, rx_fib_index0, proto0,
+ &sm0_addr, &sm0_port, &sm0_fib_index, 0, 0, 0))
{
b0->error = node->errors[SNAT_IN2OUT_ERROR_NO_TRANSLATION];
next0 = SNAT_IN2OUT_NEXT_DROP;