aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/l2/l2_bd.c
diff options
context:
space:
mode:
authorEyal Bari <ebari@cisco.com>2017-04-20 14:45:17 +0300
committerJohn Lo <loj@cisco.com>2017-05-03 13:48:11 +0000
commitafc47aa36f44d3f865c6e1e48f41eded366a85ac (patch)
tree8d9b9ef47ea524f965174d6b81260d1f418bb5d8 /src/vnet/l2/l2_bd.c
parente72be39cd0f498178fd62dfc0a0b0daa2b633f62 (diff)
L2FIB:flush interface learned macs on down
Change-Id: I80a723f55fcf2ecc3209a35e8297c88b45b1abfb Signed-off-by: Eyal Bari <ebari@cisco.com>
Diffstat (limited to 'src/vnet/l2/l2_bd.c')
-rw-r--r--src/vnet/l2/l2_bd.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/vnet/l2/l2_bd.c b/src/vnet/l2/l2_bd.c
index 4ebbb547134..4d540220a35 100644
--- a/src/vnet/l2/l2_bd.c
+++ b/src/vnet/l2/l2_bd.c
@@ -94,6 +94,8 @@ bd_delete (bd_main_t * bdm, u32 bd_index)
{
l2_bridge_domain_t *bd = &l2input_main.bd_configs[bd_index];
u32 bd_id = bd->bd_id;
+ l2fib_flush_bd_mac (vlib_get_main (), bd_index);
+
hash_unset (bdm->bd_index_by_bd_id, bd_id);
/* mark this index clear */
@@ -107,7 +109,6 @@ bd_delete (bd_main_t * bdm, u32 bd_index)
vec_free (bd->members);
hash_free (bd->mac_by_ip4);
hash_free (bd->mac_by_ip6);
- l2fib_flush_bd_mac (vlib_get_main (), bd_index);
return 0;
}
@@ -219,13 +220,9 @@ u32
bd_set_flags (vlib_main_t * vm, u32 bd_index, u32 flags, u32 enable)
{
- l2_bridge_domain_t *bd_config;
- u32 feature_bitmap = 0;
-
- vec_validate (l2input_main.bd_configs, bd_index);
- bd_config = vec_elt_at_index (l2input_main.bd_configs, bd_index);
-
+ l2_bridge_domain_t *bd_config = l2input_bd_config (bd_index);
bd_validate (bd_config);
+ u32 feature_bitmap = 0;
if (flags & L2_LEARN)
{
@@ -713,13 +710,13 @@ u32
bd_add_del_ip_mac (u32 bd_index,
u8 * ip_addr, u8 * mac_addr, u8 is_ip6, u8 is_add)
{
- l2input_main_t *l2im = &l2input_main;
- l2_bridge_domain_t *bd_cfg = l2input_bd_config_from_index (l2im, bd_index);
+ l2_bridge_domain_t *bd_cfg = l2input_bd_config (bd_index);
u64 new_mac = *(u64 *) mac_addr;
u64 *old_mac;
u16 *mac16 = (u16 *) & new_mac;
ASSERT (sizeof (uword) == sizeof (u64)); /* make sure uword is 8 bytes */
+ ASSERT (bd_is_valid (bd_cfg));
mac16[3] = 0; /* Clear last 2 unsed bytes of the 8-byte MAC address */
if (is_ip6)