aboutsummaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/vxlan/vxlan.c5
-rw-r--r--vnet/vnet/vxlan/vxlan.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/vnet/vnet/vxlan/vxlan.c b/vnet/vnet/vxlan/vxlan.c
index 75cbc6c6499..316f8cb1907 100644
--- a/vnet/vnet/vxlan/vxlan.c
+++ b/vnet/vnet/vxlan/vxlan.c
@@ -218,6 +218,9 @@ int vnet_vxlan_add_del_tunnel
t->hw_if_index = hw_if_index;
t->sw_if_index = sw_if_index = hi->sw_if_index;
+ vec_validate_init_empty (vxm->tunnel_index_by_sw_if_index, sw_if_index, ~0);
+ vxm->tunnel_index_by_sw_if_index[sw_if_index] = t - vxm->tunnels;
+
if (a->decap_next_index == VXLAN_INPUT_NEXT_L2_INPUT)
{
l2input_main_t * l2im = &l2input_main;
@@ -242,6 +245,8 @@ int vnet_vxlan_add_del_tunnel
set_int_l2_mode(vxm->vlib_main, vnm, MODE_L3, t->sw_if_index, 0, 0, 0, 0);
vec_add1 (vxm->free_vxlan_tunnel_hw_if_indices, t->hw_if_index);
+ vxm->tunnel_index_by_sw_if_index[t->sw_if_index] = ~0;
+
hash_unset (vxm->vxlan_tunnel_by_key, key.as_u64);
vec_free (t->rewrite);
diff --git a/vnet/vnet/vxlan/vxlan.h b/vnet/vnet/vxlan/vxlan.h
index 5c82a3dfd9d..b38e65de4c1 100644
--- a/vnet/vnet/vxlan/vxlan.h
+++ b/vnet/vnet/vxlan/vxlan.h
@@ -102,6 +102,9 @@ typedef struct {
u64 dummy_str [sizeof(ip4_vxlan_header_t)/sizeof(u64) + 2];
#define vxlan_dummy_rewrite ((u8 *) &vxlan_main.dummy_str[1])
+ /* Mapping from sw_if_index to tunnel index */
+ u32 * tunnel_index_by_sw_if_index;
+
/* convenience */
vlib_main_t * vlib_main;
vnet_main_t * vnet_main;