aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWojciech Dec <wdec@cisco.com>2017-01-03 10:27:03 +0100
committerWojciech Dec <wdec@cisco.com>2017-01-03 10:27:22 +0100
commitd63370ccb3941ef752e06c397f74e39abbd52ed3 (patch)
tree1a3989241992682d5ddb4f3dfac964a8c94d0c61 /src
parentb12794e1bfd07a5affe20d7e168381d09d8d51b5 (diff)
Fix crash on vhost-user deletion - VPP-571
Fixes VPP-571. VPP crashes when deleting created vhost interfaces which have not been configured with L3 or bridge-domain. Change-Id: I7fe6f2e52d4d5d77ec3c122758aa4bf43250b1d1 Signed-off-by: Wojciech Dec <wdec@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/interface.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/vnet/interface.c b/src/vnet/interface.c
index 78610ed460b..9454ac183b1 100644
--- a/src/vnet/interface.c
+++ b/src/vnet/interface.c
@@ -631,15 +631,18 @@ vnet_delete_sw_interface (vnet_main_t * vnm, u32 sw_if_index)
vnet_sw_interface_t *sw =
pool_elt_at_index (im->sw_interfaces, sw_if_index);
- /* Make sure the interface is in L3 mode (removed from L2 BD or XConnect) */
+ /* Check if the interface has config and is removed from L2 BD or XConnect */
vlib_main_t *vm = vlib_get_main ();
l2_input_config_t *config;
- config = vec_elt_at_index (l2input_main.configs, sw_if_index);
- if (config->xconnect)
- set_int_l2_mode (vm, vnm, MODE_L3, config->output_sw_if_index, 0, 0, 0,
- 0);
- if (config->xconnect || config->bridge)
- set_int_l2_mode (vm, vnm, MODE_L3, sw_if_index, 0, 0, 0, 0);
+ if (sw_if_index < vec_len (l2input_main.configs))
+ {
+ config = vec_elt_at_index (l2input_main.configs, sw_if_index);
+ if (config->xconnect)
+ set_int_l2_mode (vm, vnm, MODE_L3, config->output_sw_if_index, 0, 0,
+ 0, 0);
+ if (config->xconnect || config->bridge)
+ set_int_l2_mode (vm, vnm, MODE_L3, sw_if_index, 0, 0, 0, 0);
+ }
/* Bring down interface in case it is up. */
if (sw->flags != 0)