summaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2016-07-21 14:54:05 -0400
committerDave Barach <openvpp@barachs.net>2016-07-21 20:08:40 +0000
commit93a46917275e41b457b794e40a1f906ec3123d5d (patch)
tree0af6af995eeac5d083914298358a6487482af095 /vnet
parent32f7bc1fac3388ff7c5c8ae260c11534dc7455e6 (diff)
As interface is set to L3 mode, reset its output_node_index for l2-output
As an interface is changed from L2 bridging/xconenct to L3 mode, reset the output_node_index for l2-output for the interface's sw_if_index. The reset needs to be done in case the sw_if_index of this interface is freed and reused for another interface type afterwards. Otherwise, the stale output node may be used by l2-output for this sw_if_index and result in undesirable behavior including the possibility of VPP crash. Change-Id: Idd91d288c7643f0a1975a6787fcc330d03a7fac7 Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/l2/l2_input.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/vnet/vnet/l2/l2_input.c b/vnet/vnet/l2/l2_input.c
index dd3a8b756e4..532caf9c7d8 100644
--- a/vnet/vnet/l2/l2_input.c
+++ b/vnet/vnet/l2/l2_input.c
@@ -518,6 +518,7 @@ u32 set_int_l2_mode (vlib_main_t * vm,
u32 xc_sw_if_index) // peer interface for xconnect
{
l2input_main_t * mp = &l2input_main;
+ l2output_main_t * l2om = &l2output_main;
vnet_main_t * vnm = vnet_get_main();
vnet_hw_interface_t * hi;
l2_output_config_t * out_config;
@@ -567,6 +568,12 @@ u32 set_int_l2_mode (vlib_main_t * vm,
config->shg = 0;
config->bd_index = 0;
config->feature_bitmap = L2INPUT_FEAT_DROP;
+ // Directs the l2 output path to work out the interface
+ // output next-arc itself. Needed when recycling a sw_if_index.
+ vec_validate_init_empty(l2om->next_nodes.output_node_index_vec,
+ sw_if_index, ~0);
+ l2om->next_nodes.output_node_index_vec[sw_if_index] = ~0;
+
} else if (mode == MODE_L2_CLASSIFY) {
config->xconnect = 1;
config->bridge = 0;