diff options
author | 2018-02-25 23:41:42 -0800 | |
---|---|---|
committer | 2018-02-27 06:09:49 +0000 | |
commit | ebbb56fad6f0f86629e65c89641896d2dc8caa2c (patch) | |
tree | a04bd846350b28e4c81d393641799e20c208e2ad /src | |
parent | 4f4964fab4a91a85b25c6e5c3fffeb304c6b93f5 (diff) |
NAT: replace format_vnet_sw_interface_name with format_vnet_sw_if_index_name (VPP-1149)
Change-Id: I860468bdc21c6ee07f63c8854592c46ca631ebc2
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/nat/nat.c | 43 | ||||
-rw-r--r-- | src/plugins/nat/nat64_cli.c | 28 |
2 files changed, 32 insertions, 39 deletions
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c index 7e69a684819..1ba3b378785 100644 --- a/src/plugins/nat/nat.c +++ b/src/plugins/nat/nat.c @@ -2142,9 +2142,8 @@ snat_feature_command_fn (vlib_main_t * vm, { error = clib_error_return (0, "%s %U failed", is_del ? "del" : "add", - format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, - sw_if_index)); + format_vnet_sw_if_index_name, vnm, + sw_if_index); goto done; } } @@ -2154,9 +2153,8 @@ snat_feature_command_fn (vlib_main_t * vm, { error = clib_error_return (0, "%s %U failed", is_del ? "del" : "add", - format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, - sw_if_index)); + format_vnet_sw_if_index_name, vnm, + sw_if_index); goto done; } } @@ -2174,9 +2172,8 @@ snat_feature_command_fn (vlib_main_t * vm, { error = clib_error_return (0, "%s %U failed", is_del ? "del" : "add", - format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, - sw_if_index)); + format_vnet_sw_if_index_name, vnm, + sw_if_index); goto done; } } @@ -2186,9 +2183,8 @@ snat_feature_command_fn (vlib_main_t * vm, { error = clib_error_return (0, "%s %U failed", is_del ? "del" : "add", - format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, - sw_if_index)); + format_vnet_sw_if_index_name, vnm, + sw_if_index); goto done; } } @@ -3155,16 +3151,14 @@ u8 * format_snat_static_map_to_resolve (u8 * s, va_list * args) if (m->addr_only) s = format (s, "local %U external %U vrf %d", format_ip4_address, &m->l_addr, - format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, m->sw_if_index), + format_vnet_sw_if_index_name, vnm, m->sw_if_index, m->vrf_id); else s = format (s, "%U local %U:%d external %U:%d vrf %d", format_snat_protocol, m->proto, format_ip4_address, &m->l_addr, m->l_port, - format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, m->sw_if_index), m->e_port, - m->vrf_id); + format_vnet_sw_if_index_name, vnm, m->sw_if_index, + m->e_port, m->vrf_id); return s; } @@ -3243,8 +3237,8 @@ show_snat_command_fn (vlib_main_t * vm, { pool_foreach (i, sm->interfaces, ({ - vlib_cli_output (vm, "%U %s", format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, i->sw_if_index), + vlib_cli_output (vm, "%U %s", format_vnet_sw_if_index_name, vnm, + i->sw_if_index, (nat_interface_is_inside(i) && nat_interface_is_outside(i)) ? "in out" : (nat_interface_is_inside(i) ? "in" : "out")); @@ -3253,8 +3247,7 @@ show_snat_command_fn (vlib_main_t * vm, pool_foreach (i, sm->output_feature_interfaces, ({ vlib_cli_output (vm, "%U output-feature %s", - format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, i->sw_if_index), + format_vnet_sw_if_index_name, vnm, i->sw_if_index, (nat_interface_is_inside(i) && nat_interface_is_outside(i)) ? "in out" : (nat_interface_is_inside(i) ? "in" : "out")); @@ -3265,8 +3258,8 @@ show_snat_command_fn (vlib_main_t * vm, vlib_cli_output (vm, "NAT44 pool addresses interfaces:"); vec_foreach (sw_if_index, sm->auto_add_sw_if_indices) { - vlib_cli_output (vm, "%U", format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, *sw_if_index)); + vlib_cli_output (vm, "%U", format_vnet_sw_if_index_name, vnm, + *sw_if_index); } } @@ -3275,8 +3268,8 @@ show_snat_command_fn (vlib_main_t * vm, vlib_cli_output (vm, "NAT44 twice-nat pool addresses interfaces:"); vec_foreach (sw_if_index, sm->auto_add_sw_if_indices_twice_nat) { - vlib_cli_output (vm, "%U", format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, *sw_if_index)); + vlib_cli_output (vm, "%U", format_vnet_sw_if_index_name, vnm, + *sw_if_index); } } diff --git a/src/plugins/nat/nat64_cli.c b/src/plugins/nat/nat64_cli.c index d1acca963a1..5b46feddb49 100644 --- a/src/plugins/nat/nat64_cli.c +++ b/src/plugins/nat/nat64_cli.c @@ -181,22 +181,22 @@ nat64_interface_feature_command_fn (vlib_main_t * vm, case VNET_API_ERROR_NO_SUCH_ENTRY: error = clib_error_return (0, "%U NAT64 feature not enabled.", - format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, sw_if_index)); + format_vnet_sw_if_index_name, vnm, + sw_if_index); goto done; case VNET_API_ERROR_VALUE_EXIST: error = clib_error_return (0, "%U NAT64 feature already enabled.", - format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, sw_if_index)); + format_vnet_sw_if_index_name, vnm, + vnm, sw_if_index); goto done; case VNET_API_ERROR_INVALID_VALUE: case VNET_API_ERROR_INVALID_VALUE_2: error = clib_error_return (0, "%U NAT64 feature enable/disable failed.", - format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, sw_if_index)); + format_vnet_sw_if_index_name, vnm, + sw_if_index); goto done; default: break; @@ -216,22 +216,22 @@ nat64_interface_feature_command_fn (vlib_main_t * vm, case VNET_API_ERROR_NO_SUCH_ENTRY: error = clib_error_return (0, "%U NAT64 feature not enabled.", - format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, sw_if_index)); + format_vnet_sw_if_index_name, vnm, + sw_if_index); goto done; case VNET_API_ERROR_VALUE_EXIST: error = clib_error_return (0, "%U NAT64 feature already enabled.", - format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, sw_if_index)); + format_vnet_sw_if_index_name, vnm, + sw_if_index); goto done; case VNET_API_ERROR_INVALID_VALUE: case VNET_API_ERROR_INVALID_VALUE_2: error = clib_error_return (0, "%U NAT64 feature enable/disable failed.", - format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, sw_if_index)); + format_vnet_sw_if_index_name, vnm, + sw_if_index); goto done; default: break; @@ -254,8 +254,8 @@ nat64_cli_interface_walk (snat_interface_t * i, void *ctx) vlib_main_t *vm = ctx; vnet_main_t *vnm = vnet_get_main (); - vlib_cli_output (vm, " %U %s", format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, i->sw_if_index), + vlib_cli_output (vm, " %U %s", format_vnet_sw_if_index_name, vnm, + i->sw_if_index, (nat_interface_is_inside (i) && nat_interface_is_outside (i)) ? "in out" : nat_interface_is_inside (i) ? "in" : "out"); |