From ba407c4d4a74236668786302e9a01540f48cb44e Mon Sep 17 00:00:00 2001 From: Peter Hessler Date: Fri, 26 May 2017 14:07:04 +0000 Subject: Allow nested {} in prefix lists. Diff from Denis Fondras, many thanks! OK claudio@ phessler@ --- usr.sbin/bgpd/parse.y | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index ddf1431441d..77fafc36797 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.298 2017/02/22 13:55:14 renato Exp $ */ +/* $OpenBSD: parse.y,v 1.299 2017/05/26 14:07:03 phessler Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -217,6 +217,7 @@ typedef struct { %type filter_set_opt %type filter_set filter_set_l %type filter_prefix filter_prefix_l filter_prefix_h +%type filter_prefix_m %type unaryop equalityop binaryop filter_as_type %type encspec %% @@ -1615,9 +1616,23 @@ filter_prefix_h : IPV4 prefixlenop { } } | PREFIX filter_prefix { $$ = $2; } - | PREFIX '{' filter_prefix_l '}' { $$ = $3; } + | PREFIX '{' filter_prefix_m '}' { $$ = $3; } ; +filter_prefix_m : filter_prefix_l + | '{' filter_prefix_l '}' { $$ = $2; } + | '{' filter_prefix_l '}' filter_prefix_m + { + struct filter_prefix_l *p; + + /* merge, both can be lists */ + for (p = $2; p != NULL && p->next != NULL; p = p->next) + ; /* nothing */ + if (p != NULL) + p->next = $4; + $$ = $2; + } + filter_prefix_l : filter_prefix { $$ = $1; } | filter_prefix_l comma filter_prefix { $3->next = $1; -- cgit v1.2.3