aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2018-11-06 23:17:31 -0800
committerMatus Fabian <matfabia@cisco.com>2018-11-07 11:33:28 +0000
commit06eaab0ea805e46191acd3aea9423b05ebcbed5c (patch)
tree5ed995dd89e6e5789842fe3054f6d0975c15eb73
parent12806a3cf083976286146684afd97213c78ec70a (diff)
NAT44: fix undesired dependency between static mapping and address from the pool (VPP-1485)
Change-Id: Iaa404361eac2a6612dcdaba3f73bae41a35c5446 Signed-off-by: Matus Fabian <matfabia@cisco.com>
-rwxr-xr-xsrc/plugins/nat/nat.c7
-rw-r--r--src/plugins/nat/nat_format.c3
2 files changed, 9 insertions, 1 deletions
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c
index 2ebd6834d92..73db65e2d78 100755
--- a/src/plugins/nat/nat.c
+++ b/src/plugins/nat/nat.c
@@ -558,6 +558,10 @@ is_snat_address_used_in_static_mapping (snat_main_t * sm, ip4_address_t addr)
/* *INDENT-OFF* */
pool_foreach (m, sm->static_mappings,
({
+ if (is_addr_only_static_mapping (m) ||
+ is_out2in_only_static_mapping (m) ||
+ is_identity_static_mapping (m))
+ continue;
if (m->external_addr.as_u32 == addr.as_u32)
return 1;
}));
@@ -954,6 +958,9 @@ snat_add_static_mapping (ip4_address_t l_addr, ip4_address_t e_addr,
if (identity_nat)
{
+ if (vrf_id == ~0)
+ vrf_id = sm->inside_vrf_id;
+
for (i = 0; i < vec_len (m->locals); i++)
{
if (m->locals[i].vrf_id == vrf_id)
diff --git a/src/plugins/nat/nat_format.c b/src/plugins/nat/nat_format.c
index 5ce00dcb1d0..8e5ac4cade4 100644
--- a/src/plugins/nat/nat_format.c
+++ b/src/plugins/nat/nat_format.c
@@ -226,7 +226,8 @@ format_snat_static_mapping (u8 * s, va_list * args)
s = format (s, "identity mapping %U",
format_ip4_address, &m->local_addr);
else
- s = format (s, "identity mapping %U:%d",
+ s = format (s, "identity mapping %U %U:%d",
+ format_snat_protocol, m->proto,
format_ip4_address, &m->local_addr, m->local_port);
/* *INDENT-OFF* */