From 30c514b4244e4e81cff042a60a3a071b76750484 Mon Sep 17 00:00:00 2001 From: claudio Date: Tue, 19 May 2026 12:23:41 +0000 Subject: [PATCH] Improve add-path send parser. Error out if max is used with best. Unify error messages. OK tb@ --- usr.sbin/bgpd/parse.y | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 29b851fa058..a18cf0367b9 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.499 2026/05/19 11:39:08 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.500 2026/05/19 12:23:41 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -2014,7 +2014,7 @@ peeropts : REMOTEAS as4number { if (!strcmp($4, "no")) { free($4); if ($5 != 0 || $6 != 0 || $7 != 0) { - yyerror("no additional option allowed " + yyerror("cannot use additional options " "for 'add-path send no'"); YYERROR; } @@ -2022,13 +2022,18 @@ peeropts : REMOTEAS as4number { } else if (!strcmp($4, "all")) { free($4); if ($5 != 0 || $6 != 0) { - yyerror("no additional option allowed " + yyerror("cannot use additional options " "for 'add-path send all'"); YYERROR; } mode = ADDPATH_EVAL_ALL; } else if (!strcmp($4, "best")) { free($4); + if ($6 != 0) { + yyerror("cannot use max option " + "for 'add-path send best'"); + YYERROR; + } mode = ADDPATH_EVAL_BEST; } else if (!strcmp($4, "ecmp")) { free($4);