diff options
-rw-r--r-- | src/vnet/l2/l2_bd.c | 13 | ||||
-rw-r--r-- | src/vnet/l2/l2_fib.c | 8 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/vnet/l2/l2_bd.c b/src/vnet/l2/l2_bd.c index 4d540220a35..351e6987446 100644 --- a/src/vnet/l2/l2_bd.c +++ b/src/vnet/l2/l2_bd.c @@ -94,8 +94,11 @@ 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); + u64 mac_addr; + ip6_address_t *ip6_addr_key; + /* flush non-static MACs in BD and removed bd_id from hash table */ + l2fib_flush_bd_mac (vlib_get_main (), bd_index); hash_unset (bdm->bd_index_by_bd_id, bd_id); /* mark this index clear */ @@ -105,9 +108,15 @@ bd_delete (bd_main_t * bdm, u32 bd_index) bd->bd_id = ~0; bd->feature_bitmap = 0; - /* free memory used by BD and flush non-static MACs in BD */ + /* free memory used by BD */ vec_free (bd->members); hash_free (bd->mac_by_ip4); + /* *INDENT-OFF* */ + hash_foreach_mem (ip6_addr_key, mac_addr, bd->mac_by_ip6, + ({ + clib_mem_free (ip6_addr_key); /* free memory used for ip6 addr key */ + })); + /* *INDENT-ON* */ hash_free (bd->mac_by_ip6); return 0; diff --git a/src/vnet/l2/l2_fib.c b/src/vnet/l2/l2_fib.c index d8fcc319567..028a73269f9 100644 --- a/src/vnet/l2/l2_fib.c +++ b/src/vnet/l2/l2_fib.c @@ -215,7 +215,9 @@ show_l2fib (vlib_main_t * vm, if (total_entries == 0) vlib_cli_output (vm, "no l2fib entries"); else - vlib_cli_output (vm, "%lld l2fib entries", total_entries); + vlib_cli_output (vm, + "%lld l2fib entries with %d learned (or non-static) entries", + total_entries, l2learn_main.global_learn_count); if (raw) vlib_cli_output (vm, "Raw Hash Table:\n%U\n", @@ -347,7 +349,7 @@ l2fib_add_entry (u64 mac, BV (clib_bihash_add_del) (&mp->mac_table, &kv, 1 /* is_add */ ); /* increment counter if dynamically learned mac */ - if (result.fields.static_mac) + if (result.fields.static_mac == 0) { l2learn_main.global_learn_count++; } @@ -635,7 +637,7 @@ l2fib_del_entry (u64 mac, u32 bd_index) result.raw = kv.value; /* decrement counter if dynamically learned mac */ - if (result.fields.static_mac) + if (result.fields.static_mac == 0) { if (l2learn_main.global_learn_count > 0) { |