fib: fix mpls db label overflow 05/35405/1
authorDmitry Valter <d-valter@yandex-team.ru>
Tue, 22 Feb 2022 06:40:22 +0000 (06:40 +0000)
committerDmitry Valter <dvalter@protonmail.com>
Tue, 22 Feb 2022 06:40:22 +0000 (06:40 +0000)
mpls fib DB size was 2^20 instead of intended 2^21.
Therefore large mpls labels caused DB to overflow and write
to other tables or some random objects. Or crash with ASAN.
Sometimes.

Type: fix

Signed-off-by: Dmitry Valter <d-valter@yandex-team.ru>
Change-Id: I6db65680037a266fe47e8213464a0c16de63c06c

src/vnet/fib/mpls_fib.h

index e7ea5d5..e9fee99 100644 (file)
@@ -31,7 +31,7 @@
  * Type exposure is to allow the DP fast/inlined access
  */
 #define MPLS_FIB_KEY_SIZE 21
-#define MPLS_FIB_DB_SIZE (1 << (MPLS_FIB_KEY_SIZE-1))
+#define MPLS_FIB_DB_SIZE (1 << MPLS_FIB_KEY_SIZE)
 
 /**
  * There are no options for controlling the MPLS flow hash,