diff options
author | Matus Fabian <matfabia@cisco.com> | 2018-01-26 05:07:23 -0800 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2018-01-30 09:22:24 +0000 |
commit | 6898507b421667a883d87cc879e800fa40b83929 (patch) | |
tree | 82d5396d1ac63cae3abeafabbbd68638c74c59ce /src/plugins/nat/nat44_cli.c | |
parent | db14f5aff69311d13a0a90baa3567e92f3faa783 (diff) |
NAT: replace format_vnet_sw_interface_name with format_vnet_sw_if_index_name (VPP-1149)
Avoid crash when interface was deleted.
Change-Id: I2ac3031c13ca5ad3360495e1c4cb90b0002be5ff
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat44_cli.c')
-rw-r--r-- | src/plugins/nat/nat44_cli.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/src/plugins/nat/nat44_cli.c b/src/plugins/nat/nat44_cli.c index 5114615eb57..f61f59b8d6a 100644 --- a/src/plugins/nat/nat44_cli.c +++ b/src/plugins/nat/nat44_cli.c @@ -371,9 +371,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; } } @@ -383,9 +382,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; } } @@ -404,9 +402,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; } } @@ -416,9 +413,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; } } @@ -445,8 +441,8 @@ nat44_show_interfaces_command_fn (vlib_main_t * vm, unformat_input_t * input, /* *INDENT-OFF* */ 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")); @@ -455,8 +451,8 @@ nat44_show_interfaces_command_fn (vlib_main_t * vm, unformat_input_t * input, 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")); @@ -830,14 +826,14 @@ nat44_show_interface_address_command_fn (vlib_main_t * vm, vlib_cli_output (vm, "NAT44 pool address 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); } vlib_cli_output (vm, "NAT44 twice-nat pool address 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); } /* *INDENT-ON* */ |