l2: fix MAC learn counter update on adding MAC entry 44/24244/1
authorJohn Lo <[email protected]>
Tue, 7 Jan 2020 21:35:29 +0000 (16:35 -0500)
committerJohn Lo <[email protected]>
Wed, 8 Jan 2020 15:45:16 +0000 (15:45 +0000)
Type: fix

Signed-off-by: John Lo <[email protected]>
Change-Id: I711432f589ee4a4527cf795526d3b4031999f71d
(cherry picked from commit b2e73b1dcb8e9eb3bf74a96fff20a9b27f7e6d73)

src/vnet/l2/l2_fib.c

index 600d0c9..ea0aec5 100644 (file)
@@ -410,6 +410,7 @@ l2fib_add_entry (const u8 * mac, u32 bd_index,
 
   /* set up key */
   key.raw = l2fib_make_key (mac, bd_index);
+  kv.key = key.raw;
 
   /* check if entry already exist */
   if (BV (clib_bihash_search) (&fm->mac_table, &kv, &kv))
@@ -429,7 +430,6 @@ l2fib_add_entry (const u8 * mac, u32 bd_index,
   /* no aging for provisioned entry */
   l2fib_entry_result_set_AGE_NOT (&result);
 
-  kv.key = key.raw;
   kv.value = result.raw;
 
   BV (clib_bihash_add_del) (&fm->mac_table, &kv, 1 /* is_add */ );