MAP: Prevent duplicate MAP-E/T graph nodes.
Change-Id: I6031f3f9cfa048a901a8424d33d47679115c2eb3 Signed-off-by: Jon Loeliger <jdl@netgate.com>
This commit is contained in:
@ -2256,6 +2256,9 @@ map_init (vlib_main_t * vm)
|
||||
mm->ip6_prefix_tbl = lpm_table_init (LPM_TYPE_KEY128);
|
||||
mm->ip6_src_prefix_tbl = lpm_table_init (LPM_TYPE_KEY128);
|
||||
|
||||
mm->bm_trans_enabled_by_sw_if = 0;
|
||||
mm->bm_encap_enabled_by_sw_if = 0;
|
||||
|
||||
error = map_plugin_api_hookup (vm);
|
||||
|
||||
return error;
|
||||
|
@ -321,6 +321,10 @@ typedef struct {
|
||||
/* Counters */
|
||||
u32 ip6_reass_buffered_counter;
|
||||
|
||||
/* Graph node state */
|
||||
uword *bm_trans_enabled_by_sw_if;
|
||||
uword *bm_encap_enabled_by_sw_if;
|
||||
|
||||
/* Lookup tables */
|
||||
lpm_t *ip4_prefix_tbl;
|
||||
lpm_t *ip6_prefix_tbl;
|
||||
|
@ -600,12 +600,36 @@ vl_api_map_param_get_t_handler (vl_api_map_param_get_t * mp)
|
||||
int
|
||||
map_if_enable_disable (bool is_enable, u32 sw_if_index, bool is_translation)
|
||||
{
|
||||
map_main_t *mm = &map_main;
|
||||
|
||||
if (pool_is_free_index (mm->vnet_main->interface_main.sw_interfaces,
|
||||
sw_if_index))
|
||||
return VNET_API_ERROR_INVALID_SW_IF_INDEX;
|
||||
|
||||
is_enable = ! !is_enable;
|
||||
|
||||
if (is_translation)
|
||||
{
|
||||
if (clib_bitmap_get (mm->bm_trans_enabled_by_sw_if, sw_if_index)
|
||||
== is_enable)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (clib_bitmap_get (mm->bm_encap_enabled_by_sw_if, sw_if_index)
|
||||
== is_enable)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (is_translation == false)
|
||||
{
|
||||
vnet_feature_enable_disable ("ip4-unicast", "ip4-map", sw_if_index,
|
||||
is_enable ? 1 : 0, 0, 0);
|
||||
vnet_feature_enable_disable ("ip6-unicast", "ip6-map", sw_if_index,
|
||||
is_enable ? 1 : 0, 0, 0);
|
||||
mm->bm_encap_enabled_by_sw_if =
|
||||
clib_bitmap_set (mm->bm_encap_enabled_by_sw_if, sw_if_index,
|
||||
is_enable);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -613,7 +637,11 @@ map_if_enable_disable (bool is_enable, u32 sw_if_index, bool is_translation)
|
||||
is_enable ? 1 : 0, 0, 0);
|
||||
vnet_feature_enable_disable ("ip6-unicast", "ip6-map-t", sw_if_index,
|
||||
is_enable ? 1 : 0, 0, 0);
|
||||
mm->bm_trans_enabled_by_sw_if =
|
||||
clib_bitmap_set (mm->bm_trans_enabled_by_sw_if, sw_if_index,
|
||||
is_enable);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user