Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
bgpd: better limit for add-path send
To:
tech@openbsd.org
Date:
Tue, 12 May 2026 10:40:56 +0200

Download raw body.

Thread
Using USHRT_MAX as the maximum for add-path send plus and max is bad.
Such high limits make simply no sense and also trigger an issue in the
add-path path where currently a limit of 2000 paths is enforced.
On top of this the add-path send code scales linearly with the number of
paths it has to handle. So you really don't want to go too high with that
number. Because of this I selected a maximum of 100 and we can discuss to
adjust this if there is need.

To blast out all paths use 'add-path send all'. That is unlimited.
-- 
:wq Claudio

Index: bgpd.h
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/bgpd.h,v
diff -u -p -r1.541 bgpd.h
--- bgpd.h	7 May 2026 18:56:38 -0000	1.541
+++ bgpd.h	9 May 2026 20:46:59 -0000
@@ -56,6 +56,7 @@
 #define	MAX_RTSOCK_BUF			(2 * 1024 * 1024)
 #define	MAX_COMM_MATCH			3
 #define	MAX_ASPA_SPAS_COUNT		10000
+#define	MAX_ADDPATH_COUNT		100
 #define	MIN_HOLDTIME			3
 
 #define	BGPD_OPT_VERBOSE		0x0001
Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/parse.y,v
diff -u -p -r1.493 parse.y
--- parse.y	11 May 2026 18:41:06 -0000	1.493
+++ parse.y	12 May 2026 08:33:15 -0000
@@ -1801,9 +1801,9 @@ groupopts_l	: /* empty */
 
 addpathextra	: /* empty */		{ $$ = 0; }
 		| PLUS NUMBER		{
-			if ($2 < 1 || $2 > USHRT_MAX) {
+			if ($2 < 1 || $2 > MAX_ADDPATH_COUNT) {
 				yyerror("additional paths must be between "
-				    "%u and %u", 1, USHRT_MAX);
+				    "%u and %u", 1, MAX_ADDPATH_COUNT);
 				YYERROR;
 			}
 			$$ = $2;
@@ -1812,9 +1812,9 @@ addpathextra	: /* empty */		{ $$ = 0; }
 
 addpathmax	: /* empty */		{ $$ = 0; }
 		| MAX NUMBER		{
-			if ($2 < 1 || $2 > USHRT_MAX) {
+			if ($2 < 1 || $2 > MAX_ADDPATH_COUNT) {
 				yyerror("maximum additional paths must be "
-				    "between %u and %u", 1, USHRT_MAX);
+				    "between %u and %u", 1, MAX_ADDPATH_COUNT);
 				YYERROR;
 			}
 			$$ = $2;