Avoid crash when interface was deleted.
Change-Id: I2ac3031c13ca5ad3360495e1c4cb90b0002be5ff
Signed-off-by: Matus Fabian <matfabia@cisco.com>
if (m->addr_only)
s = format (s, "local %U external %U vrf %d",
format_ip4_address, &m->l_addr,
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,
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);
{
error = clib_error_return (0, "%s %U failed",
is_del ? "del" : "add",
{
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);
{
error = clib_error_return (0, "%s %U failed",
is_del ? "del" : "add",
{
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);
{
error = clib_error_return (0, "%s %U failed",
is_del ? "del" : "add",
{
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);
{
error = clib_error_return (0, "%s %U failed",
is_del ? "del" : "add",
{
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);
/* *INDENT-OFF* */
pool_foreach (i, sm->interfaces,
({
/* *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"));
(nat_interface_is_inside(i) &&
nat_interface_is_outside(i)) ? "in out" :
(nat_interface_is_inside(i) ? "in" : "out"));
pool_foreach (i, sm->output_feature_interfaces,
({
vlib_cli_output (vm, " %U output-feature %s",
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"));
(nat_interface_is_inside(i) &&
nat_interface_is_outside(i)) ? "in out" :
(nat_interface_is_inside(i) ? "in" : "out"));
vlib_cli_output (vm, "NAT44 pool address interfaces:");
vec_foreach (sw_if_index, sm->auto_add_sw_if_indices)
{
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, "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);
case VNET_API_ERROR_NO_SUCH_ENTRY:
error =
clib_error_return (0, "%U NAT64 feature not enabled.",
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.",
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.",
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;
goto done;
default:
break;
case VNET_API_ERROR_NO_SUCH_ENTRY:
error =
clib_error_return (0, "%U NAT64 feature not enabled.",
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.",
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.",
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;
goto done;
default:
break;
vlib_main_t *vm = ctx;
vnet_main_t *vnm = vnet_get_main ();
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");
(nat_interface_is_inside (i)
&& nat_interface_is_outside (i)) ? "in out" :
nat_interface_is_inside (i) ? "in" : "out");