aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2018-01-23 06:07:01 -0800
committerOle Trøan <otroan@employees.org>2018-01-24 07:46:54 +0000
commitd95c39e87bf9d21b2a9d4c49fdf7ebca2a5eab3d (patch)
treee2e12e4cedacd24446d8991f6de5998122c67846 /src/plugins
parent6cd396cec3a768711d582e1df209a6e94aa4726e (diff)
NAT44: asymmetrical static mapping and one-armed NAT (VPP-1138)
One-armed NAT should work for asymmetrical static mappings without adding external address to the NAT44 pool. Change-Id: Ie886b75b55c3b552d1029a50bd967625fde80f09 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/nat/nat.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c
index bedf4e5d386..56904ef7e04 100644
--- a/src/plugins/nat/nat.c
+++ b/src/plugins/nat/nat.c
@@ -387,7 +387,7 @@ nat44_classify_node_fn_inline (vlib_main_t * vm,
if (ip0->dst_address.as_u32 == ap->addr.as_u32)
{
next0 = NAT44_CLASSIFY_NEXT_OUT2IN;
- break;
+ goto enqueue0;
}
}
@@ -401,8 +401,17 @@ nat44_classify_node_fn_inline (vlib_main_t * vm,
if (!clib_bihash_search_8_8 (&sm->static_mapping_by_external, &kv0, &value0))
{
next0 = NAT44_CLASSIFY_NEXT_OUT2IN;
+ goto enqueue0;
}
+ udp_header_t * udp0 = ip4_next_header (ip0);
+ m_key0.port = clib_net_to_host_u16 (udp0->dst_port);
+ m_key0.protocol = ip_proto_to_snat_proto (ip0->protocol);
+ kv0.key = m_key0.as_u64;
+ if (!clib_bihash_search_8_8 (&sm->static_mapping_by_external, &kv0, &value0))
+ next0 = NAT44_CLASSIFY_NEXT_OUT2IN;
}
+
+ enqueue0:
/* verify speculative enqueue, maybe switch current next frame */
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
to_next, n_left_to_next,