summaryrefslogtreecommitdiffstats
path: root/vnet/vnet/l2/l2_input.c
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2016-10-27 11:17:02 -0400
committerDave Barach <openvpp@barachs.net>2016-10-27 17:29:10 +0000
commit0fc9bc1206cd71da79c6cf22e1633eedde2eeeac (patch)
tree6bc7c9f2d529b4e5978d7e00fec62a09ce6c29fa /vnet/vnet/l2/l2_input.c
parent218170be70aee7e26e327392af9b637354c33b2a (diff)
Fix potential L2 forwarding crash with stale L2FIB entry (VPP-516)
On moving interface between L2 and L3 forwarding modes, adjust the l2-output node next index for the sw_if_index of the interface so packet output via stale MAC entries in L2 FIB will be dropped. Change-Id: I25afd7a617edb4ae35ce296bac33e62683edad9a Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'vnet/vnet/l2/l2_input.c')
-rw-r--r--vnet/vnet/l2/l2_input.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/vnet/vnet/l2/l2_input.c b/vnet/vnet/l2/l2_input.c
index 171ba7344f1..9515250decf 100644
--- a/vnet/vnet/l2/l2_input.c
+++ b/vnet/vnet/l2/l2_input.c
@@ -606,22 +606,29 @@ set_int_l2_mode (vlib_main_t * vm, vnet_main_t * vnet_main, u32 mode, u32 sw_if_
l2_if_adjust--;
}
+ /*
+ * 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;
+
/* Initialize the l2-input configuration for the interface */
if (mode == MODE_L3)
{
+ /* Set L2 config to BD index 0 so that if any packet accidentally
+ * came in on L2 path, it will be dropped in BD 0 */
config->xconnect = 0;
config->bridge = 0;
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;
+ /* Make sure any L2-output packet to this interface now in L3 mode is
+ * dropped. This may happen if L2 FIB MAC entry is stale */
+ l2om->next_nodes.output_node_index_vec[sw_if_index] =
+ L2OUTPUT_NEXT_BAD_INTF;
}
else if (mode == MODE_L2_CLASSIFY)
{