From 99315118fcc057cd58a0ce3313742f3fff9a9323 Mon Sep 17 00:00:00 2001 From: claudio Date: Fri, 21 Sep 2018 05:13:35 +0000 Subject: [PATCH] Move setting of the PREFIXSET_FLAG_OPS higher up since prefixset_item rule is now also used by roa-set. Also set the prefix operation for roa-set items to OP_NONE since that what it actually needs to be. --- usr.sbin/bgpd/parse.y | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 931fa057468..66847b8a451 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.356 2018/09/21 04:55:27 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.357 2018/09/21 05:13:35 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -447,6 +447,8 @@ prefixset : PREFIXSET STRING '{' optnl { prefixset_l : prefixset_item { struct prefixset_item *psi; + if ($1->p.op != OP_NONE) + curpset->sflags |= PREFIXSET_FLAG_OPS; psi = RB_INSERT(prefixset_tree, &curpset->psitems, $1); if (psi != NULL) { if (cmd_opts & BGPD_OPT_VERBOSE2) @@ -459,6 +461,8 @@ prefixset_l : prefixset_item { } | prefixset_l comma prefixset_item { struct prefixset_item *psi; + if ($3->p.op != OP_NONE) + curpset->sflags |= PREFIXSET_FLAG_OPS; psi = RB_INSERT(prefixset_tree, &curpset->psitems, $3); if (psi != NULL) { if (cmd_opts & BGPD_OPT_VERBOSE2) @@ -481,8 +485,6 @@ prefixset_item : prefix prefixlenop { fatal(NULL); memcpy(&$$->p.addr, &$1.prefix, sizeof($$->p.addr)); $$->p.len = $1.len; - if ($2.op != OP_NONE) - curpset->sflags |= PREFIXSET_FLAG_OPS; if (merge_prefixspec(&$$->p, &$2) == -1) { free($$); YYERROR; @@ -4310,7 +4312,8 @@ add_roa_set(struct prefixset_item *npsi, u_int32_t as, u_int8_t max) struct prefixset_item *psi; struct roa_set rs; - /* no prefixlen option on this tree */ + /* no prefixlen option in this tree */ + npsi->p.op = OP_NONE; npsi->p.len_max = npsi->p.len_min = npsi->p.len; psi = RB_INSERT(prefixset_tree, &curroaset->psitems, npsi); if (psi == NULL) -- 2.20.1