VXLAN: Prevent duplicate bypass graph nodes.
Change-Id: I68cc509b594b09751ff5e0e09bbca187a4a88edd Signed-off-by: Jon Loeliger <jdl@netgate.com>
This commit is contained in:
@ -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);
|
||||
|
@ -172,6 +172,10 @@ typedef struct
|
||||
/* Mapping from sw_if_index to tunnel index */
|
||||
u32 *tunnel_index_by_sw_if_index;
|
||||
|
||||
/* graph node state */
|
||||
uword *bm_ip4_bypass_enabled_by_sw_if;
|
||||
uword *bm_ip6_bypass_enabled_by_sw_if;
|
||||
|
||||
/* convenience */
|
||||
vlib_main_t *vlib_main;
|
||||
vnet_main_t *vnet_main;
|
||||
|
Reference in New Issue
Block a user