aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2017-02-27 21:00:02 +0100
committerAndrew Yourtchenko <ayourtch@gmail.com>2017-02-27 21:06:20 +0100
commit32dfd77df0240d26eebe7dd2058b36d66289bda8 (patch)
treee00c70337ce9b3bdc1e535b8ec5964b8ab2e3be7
parent149745f95eec5b2e88685d0b08993d0f977f5935 (diff)
Clean up the L2 interface configs when creating the interfaces
Without the cleanup in the L2 input/output configs, the creation of an interface with sw_if_index belonging to a previously deleted interface will use the stale vlan tag push-pop configuration from that interface, resulting in loss of connectivity when the host receives tagged packets but expects untagged ones. Change-Id: Ic186390ef3a41277f57847ed2962848b98379092 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
-rw-r--r--vnet/vnet/interface.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/vnet/vnet/interface.c b/vnet/vnet/interface.c
index 78610ed460b..0ed4cf6987b 100644
--- a/vnet/vnet/interface.c
+++ b/vnet/vnet/interface.c
@@ -41,6 +41,7 @@
#include <vnet/plugin/plugin.h>
#include <vnet/fib/ip6_fib.h>
#include <vnet/adj/adj.h>
+#include <vnet/l2/l2_output.h>
#define VNET_INTERFACE_SET_FLAGS_HELPER_IS_CREATE (1 << 0)
#define VNET_INTERFACE_SET_FLAGS_HELPER_WANT_REDISTRIBUTE (1 << 1)
@@ -582,6 +583,15 @@ vnet_create_sw_interface_no_callbacks (vnet_main_t * vnm,
vnet_interface_counter_unlock (im);
}
+ /* Wipe any stale l2 input config data. */
+ if (sw_if_index < vec_len (l2input_main.configs))
+ memset (vec_elt_at_index (l2input_main.configs, sw_if_index),
+ 0, sizeof (l2_input_config_t));
+
+ /* Wipe any stale l2 output config data. */
+ if (sw_if_index < vec_len (l2output_main.configs))
+ memset (vec_elt_at_index (l2output_main.configs, sw_if_index),
+ 0, sizeof (l2_output_config_t));
return sw_if_index;
}