diff options
Diffstat (limited to 'usr.sbin/bgpd/parse.y')
-rw-r--r-- | usr.sbin/bgpd/parse.y | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index ea47a659b1a..2fc507e86a6 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.456 2024/03/18 14:54:52 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.457 2024/03/20 09:35:46 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -1894,7 +1894,7 @@ peeropts : REMOTEAS as4number { uint16_t afi; if ($3 == SAFI_NONE) { - for (aid = 0; aid < AID_MAX; aid++) { + for (aid = AID_MIN; aid < AID_MAX; aid++) { if (aid2afi(aid, &afi, &safi) == -1 || afi != $2) continue; @@ -1927,11 +1927,11 @@ peeropts : REMOTEAS as4number { int8_t *ap = curpeer->conf.capabilities.add_path; uint8_t i; - for (i = 0; i < AID_MAX; i++) + for (i = AID_MIN; i < AID_MAX; i++) if ($4) - *ap++ |= CAPA_AP_RECV; + ap[i] |= CAPA_AP_RECV; else - *ap++ &= ~CAPA_AP_RECV; + ap[i] &= ~CAPA_AP_RECV; } | ANNOUNCE ADDPATH SEND STRING addpathextra addpathmax { int8_t *ap = curpeer->conf.capabilities.add_path; @@ -1945,9 +1945,7 @@ peeropts : REMOTEAS as4number { "for 'add-path send no'"); YYERROR; } - for (i = 0; i < AID_MAX; i++) - *ap++ &= ~CAPA_AP_SEND; - break; + mode = ADDPATH_EVAL_NONE; } else if (!strcmp($4, "all")) { free($4); if ($5 != 0 || $6 != 0) { @@ -1971,8 +1969,12 @@ peeropts : REMOTEAS as4number { free($4); YYERROR; } - for (i = 0; i < AID_MAX; i++) - *ap++ |= CAPA_AP_SEND; + for (i = AID_MIN; i < AID_MAX; i++) { + if (mode != ADDPATH_EVAL_NONE) + ap[i] |= CAPA_AP_SEND; + else + ap[i] &= ~CAPA_AP_SEND; + } curpeer->conf.eval.mode = mode; curpeer->conf.eval.extrapaths = $5; curpeer->conf.eval.maxpaths = $6; @@ -4611,7 +4613,6 @@ struct peer * alloc_peer(void) { struct peer *p; - uint8_t i; if ((p = calloc(1, sizeof(struct peer))) == NULL) fatal("new_peer"); @@ -4622,8 +4623,6 @@ alloc_peer(void) p->conf.distance = 1; p->conf.export_type = EXPORT_UNSET; p->conf.announce_capa = 1; - for (i = 0; i < AID_MAX; i++) - p->conf.capabilities.mp[i] = 0; p->conf.capabilities.refresh = 1; p->conf.capabilities.grestart.restart = 1; p->conf.capabilities.as4byte = 1; |