summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat_format.c
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2018-10-11 04:28:48 -0700
committerDamjan Marion <dmarion@me.com>2018-10-12 00:00:42 +0000
commit82b4ceb8e66020f41fd6faf9765614f9dc5a3163 (patch)
tree0711773a8abbf2d7f1b285b429d8a385c2d44eed /src/plugins/nat/nat_format.c
parente9b558282293ee28c5eef7cb507dbe3f4a81e5af (diff)
NAT44: identity NAT fix (VPP-1441)
Change-Id: Ic4affc54d15d08b9b730f6ec6146ee053b28b4b6 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat_format.c')
-rw-r--r--src/plugins/nat/nat_format.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/plugins/nat/nat_format.c b/src/plugins/nat/nat_format.c
index a4b62b6e977..5ce00dcb1d0 100644
--- a/src/plugins/nat/nat_format.c
+++ b/src/plugins/nat/nat_format.c
@@ -220,6 +220,23 @@ format_snat_static_mapping (u8 * s, va_list * args)
snat_static_mapping_t *m = va_arg (*args, snat_static_mapping_t *);
nat44_lb_addr_port_t *local;
+ if (is_identity_static_mapping (m))
+ {
+ if (is_addr_only_static_mapping (m))
+ s = format (s, "identity mapping %U",
+ format_ip4_address, &m->local_addr);
+ else
+ s = format (s, "identity mapping %U:%d",
+ format_ip4_address, &m->local_addr, m->local_port);
+
+ /* *INDENT-OFF* */
+ vec_foreach (local, m->locals)
+ s = format (s, " vrf %d", local->vrf_id);
+ /* *INDENT-ON* */
+
+ return s;
+ }
+
if (is_addr_only_static_mapping (m))
s = format (s, "local %U external %U vrf %d %s %s",
format_ip4_address, &m->local_addr,
@@ -230,7 +247,7 @@ format_snat_static_mapping (u8 * s, va_list * args)
is_out2in_only_static_mapping (m) ? "out2in-only" : "");
else
{
- if (vec_len (m->locals))
+ if (is_lb_static_mapping (m))
{
s = format (s, "%U external %U:%d %s %s",
format_snat_protocol, m->proto,