diff options
Diffstat (limited to 'src/vnet/vxlan/vxlan.c')
-rw-r--r-- | src/vnet/vxlan/vxlan.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/src/vnet/vxlan/vxlan.c b/src/vnet/vxlan/vxlan.c index a26428673c5..ff796ec0673 100644 --- a/src/vnet/vxlan/vxlan.c +++ b/src/vnet/vxlan/vxlan.c @@ -919,12 +919,38 @@ VLIB_CLI_COMMAND (show_vxlan_tunnel_command, static) = { void vnet_int_vxlan_bypass_mode (u32 sw_if_index, u8 is_ip6, u8 is_enable) { + vxlan_main_t *vxm = &vxlan_main; + + if (pool_is_free_index (vxm->vnet_main->interface_main.sw_interfaces, + sw_if_index)) + return; + + is_enable = ! !is_enable; + if (is_ip6) - vnet_feature_enable_disable ("ip6-unicast", "ip6-vxlan-bypass", - sw_if_index, is_enable, 0, 0); + { + if (clib_bitmap_get (vxm->bm_ip6_bypass_enabled_by_sw_if, sw_if_index) + != is_enable) + { + vnet_feature_enable_disable ("ip6-unicast", "ip6-vxlan-bypass", + sw_if_index, is_enable, 0, 0); + vxm->bm_ip6_bypass_enabled_by_sw_if = + clib_bitmap_set (vxm->bm_ip6_bypass_enabled_by_sw_if, + sw_if_index, is_enable); + } + } else - vnet_feature_enable_disable ("ip4-unicast", "ip4-vxlan-bypass", - sw_if_index, is_enable, 0, 0); + { + if (clib_bitmap_get (vxm->bm_ip4_bypass_enabled_by_sw_if, sw_if_index) + != is_enable) + { + vnet_feature_enable_disable ("ip4-unicast", "ip4-vxlan-bypass", + sw_if_index, is_enable, 0, 0); + vxm->bm_ip4_bypass_enabled_by_sw_if = + clib_bitmap_set (vxm->bm_ip4_bypass_enabled_by_sw_if, + sw_if_index, is_enable); + } + } } @@ -1216,6 +1242,9 @@ vxlan_init (vlib_main_t * vm) vnet_flow_get_range (vxm->vnet_main, "vxlan", 1024 * 1024, &vxm->flow_id_start); + vxm->bm_ip4_bypass_enabled_by_sw_if = 0; + vxm->bm_ip6_bypass_enabled_by_sw_if = 0; + /* initialize the ip6 hash */ clib_bihash_init_16_8 (&vxm->vxlan4_tunnel_by_key, "vxlan4", VXLAN_HASH_NUM_BUCKETS, VXLAN_HASH_MEMORY_SIZE); |