diff options
author | Jon Loeliger <jdl@netgate.com> | 2019-01-03 12:56:02 -0600 |
---|---|---|
committer | John Lo <loj@cisco.com> | 2019-01-09 04:13:15 +0000 |
commit | e3034cdc74f9fe153259a55c03846495d3f9f088 (patch) | |
tree | d24cdf96937d623dbcff3749f67bb770f1e86b97 /src/vnet/vxlan/vxlan.c | |
parent | 95eec06e9d2b552593c35c42455edc494565759a (diff) |
VXLAN: Prevent duplicate bypass graph nodes.
Change-Id: I68cc509b594b09751ff5e0e09bbca187a4a88edd
Signed-off-by: Jon Loeliger <jdl@netgate.com>
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); |