l2: mark l2 fib uninitialized after clearing 02/29402/1
authorMatthew Smith <mgsmith@netgate.com>
Mon, 12 Oct 2020 20:04:39 +0000 (15:04 -0500)
committerMatthew Smith <mgsmith@netgate.com>
Mon, 12 Oct 2020 20:34:23 +0000 (15:34 -0500)
Type: fix

After clearing the l2fib with 'vppctl clear l2fib', a SEGV occurs the
next time a MAC address is learned.

In l2fib_clear_table(), the l2fib bihash is freed and then
l2fib_table_init() is called to reinitialize it. l2fib_table_init()
will not do anything if l2fib_main.mac_table_initialized is set to 1.
Reset the value of l2fib_main.mac_table_initialized to 0 before
calling l2fib_table_init().

Change-Id: I87f1a3f9a46c951f36c1c0a5ab795b0ec08c81a8
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
src/vnet/l2/l2_fib.c

index bb4d614..c28c23b 100644 (file)
@@ -388,6 +388,8 @@ l2fib_clear_table (void)
   if (mp->mac_table_initialized == 0)
     return;
 
+  mp->mac_table_initialized = 0;
+
   /* Remove all entries */
   BV (clib_bihash_free) (&mp->mac_table);
   l2fib_table_init ();