X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fnat%2Fnat_format.c;h=5ce00dcb1d0450382eba3a63ffb303ad530df74b;hb=82b4ceb8e66020f41fd6faf9765614f9dc5a3163;hp=279d6664933b8c3529eece2d6020e10a0e4529dd;hpb=ab395ec884d0ec9279893b1695379e97acd1f24d;p=vpp.git diff --git a/src/plugins/nat/nat_format.c b/src/plugins/nat/nat_format.c index 279d6664933..5ce00dcb1d0 100644 --- a/src/plugins/nat/nat_format.c +++ b/src/plugins/nat/nat_format.c @@ -220,24 +220,41 @@ 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 (m->addr_only) + 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, format_ip4_address, &m->external_addr, m->vrf_id, m->twice_nat == TWICE_NAT ? "twice-nat" : m->twice_nat == TWICE_NAT_SELF ? "self-twice-nat" : "", - m->out2in_only ? "out2in-only" : ""); + 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, format_ip4_address, &m->external_addr, m->external_port, m->twice_nat == TWICE_NAT ? "twice-nat" : m->twice_nat == TWICE_NAT_SELF ? "self-twice-nat" : "", - m->out2in_only ? "out2in-only" : ""); + is_out2in_only_static_mapping (m) ? "out2in-only" : ""); vec_foreach (local, m->locals) s = format (s, "\n local %U:%d vrf %d probability %d\%", format_ip4_address, &local->addr, local->port, @@ -251,7 +268,7 @@ format_snat_static_mapping (u8 * s, va_list * args) m->vrf_id, m->twice_nat == TWICE_NAT ? "twice-nat" : m->twice_nat == TWICE_NAT_SELF ? "self-twice-nat" : "", - m->out2in_only ? "out2in-only" : ""); + is_out2in_only_static_mapping (m) ? "out2in-only" : ""); } return s; }