summaryrefslogtreecommitdiffstats
path: root/src/plugins/snat/snat_test.c
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2017-02-14 23:33:43 -0800
committerOle Trøan <otroan@employees.org>2017-02-15 13:24:37 +0000
commite22e546f6c907e8e86d2c4cb82200ed627c7c4e5 (patch)
tree489a80241cc2828a17188fb366588c6c0e3e5a35 /src/plugins/snat/snat_test.c
parentaeeac3bf4429235c952ce54abad7d3729be6a2f5 (diff)
SNAT: add static mappings with unresolved external interface address to snat_static_mapping_dump
Change-Id: Ib560b397700fe058ad1e2970989d98e3debf54aa Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/snat/snat_test.c')
-rw-r--r--src/plugins/snat/snat_test.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/plugins/snat/snat_test.c b/src/plugins/snat/snat_test.c
index a8cb8cc0eb5..136c1c49e78 100644
--- a/src/plugins/snat/snat_test.c
+++ b/src/plugins/snat/snat_test.c
@@ -310,12 +310,26 @@ static void vl_api_snat_static_mapping_details_t_handler
snat_test_main_t * sm = &snat_test_main;
vat_main_t *vam = sm->vat_main;
- if (mp->addr_only)
+ if (mp->addr_only && mp->external_sw_if_index != ~0)
+ fformat (vam->ofp, "%15U%6s%15d%6s%11d%6d\n",
+ format_ip4_address, &mp->local_ip_address, "",
+ ntohl (mp->external_sw_if_index), "",
+ ntohl (mp->vrf_id),
+ mp->protocol);
+ else if (mp->addr_only && mp->external_sw_if_index == ~0)
fformat (vam->ofp, "%15U%6s%15U%6s%11d%6d\n",
format_ip4_address, &mp->local_ip_address, "",
format_ip4_address, &mp->external_ip_address, "",
ntohl (mp->vrf_id),
mp->protocol);
+ else if (!mp->addr_only && mp->external_sw_if_index != ~0)
+ fformat (vam->ofp, "%15U%6d%15d%6d%11d%6d\n",
+ format_ip4_address, &mp->local_ip_address,
+ ntohs (mp->local_port),
+ ntohl (mp->external_sw_if_index),
+ ntohs (mp->external_port),
+ ntohl (mp->vrf_id),
+ mp->protocol);
else
fformat (vam->ofp, "%15U%6d%15U%6d%11d%6d\n",
format_ip4_address, &mp->local_ip_address,
@@ -340,8 +354,8 @@ static int api_snat_static_mapping_dump(vat_main_t * vam)
}
fformat (vam->ofp, "%21s%21s\n", "local", "external");
- fformat (vam->ofp, "%15s%6s%15s%6s%11s%6s\n", "address", "port", "address",
- "port", "vrf", "proto");
+ fformat (vam->ofp, "%15s%6s%15s%6s%11s%6s\n", "address", "port",
+ "address/if_idx", "port", "vrf", "proto");
M(SNAT_STATIC_MAPPING_DUMP, mp);
S(mp);