aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat
diff options
context:
space:
mode:
authorMilan Lenco <milan.lenco@pantheon.tech>2018-05-02 14:22:22 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2018-05-03 21:22:03 +0000
commitdbc38ee7e53ca9bf7e6912a950a802c2db87f47d (patch)
tree4b91b8d4af607fca2b9996b7794b63a75ed5ede0 /src/plugins/nat
parentbd4d645791a4d58dbdb0b5dc1b1527b11599c332 (diff)
NAT: fix bin API dump of static mappings.
Static mappings with equal local and external IPs but different ports were dumped as identity mappings. Change-Id: Ifea7cef5b78aea4c2eb31cf1620185eeef2681e5 Signed-off-by: Milan Lenco <milan.lenco@pantheon.tech>
Diffstat (limited to 'src/plugins/nat')
-rw-r--r--src/plugins/nat/nat_api.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/nat/nat_api.c b/src/plugins/nat/nat_api.c
index 417d2984011..4c815f0bc13 100644
--- a/src/plugins/nat/nat_api.c
+++ b/src/plugins/nat/nat_api.c
@@ -876,7 +876,9 @@ vl_api_nat44_static_mapping_dump_t_handler (vl_api_nat44_static_mapping_dump_t
/* *INDENT-OFF* */
pool_foreach (m, sm->static_mappings,
({
- if (!vec_len(m->locals) && (m->local_addr.as_u32 != m->external_addr.as_u32))
+ if (!vec_len (m->locals) &&
+ ((m->local_port != m->external_port)
+ || (m->local_addr.as_u32 != m->external_addr.as_u32)))
send_nat44_static_mapping_details (m, reg, mp->context);
}));
/* *INDENT-ON* */
@@ -1034,7 +1036,8 @@ static void
/* *INDENT-OFF* */
pool_foreach (m, sm->static_mappings,
({
- if (!vec_len(m->locals) && (m->local_addr.as_u32 == m->external_addr.as_u32))
+ if (!vec_len (m->locals) && (m->local_port == m->external_port)
+ && (m->local_addr.as_u32 == m->external_addr.as_u32))
send_nat44_identity_mapping_details (m, reg, mp->context);
}));
/* *INDENT-ON* */