diff options
author | Peter Hessler <phessler@cvs.openbsd.org> | 2017-05-26 14:07:04 +0000 |
---|---|---|
committer | Peter Hessler <phessler@cvs.openbsd.org> | 2017-05-26 14:07:04 +0000 |
commit | ba407c4d4a74236668786302e9a01540f48cb44e (patch) | |
tree | a0a3c90bba99bb25167a5a7ba4d4413dab2a389a | |
parent | 5f828a835e3858c7fcb67734aa40b852410be515 (diff) |
Allow nested {} in prefix lists.
Diff from Denis Fondras, many thanks!
OK claudio@ phessler@
-rw-r--r-- | usr.sbin/bgpd/parse.y | 19 |
1 files 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 <henning@openbsd.org> @@ -217,6 +217,7 @@ typedef struct { %type <v.filter_set> filter_set_opt %type <v.filter_set_head> filter_set filter_set_l %type <v.filter_prefix> filter_prefix filter_prefix_l filter_prefix_h +%type <v.filter_prefix> filter_prefix_m %type <v.u8> unaryop equalityop binaryop filter_as_type %type <v.encspec> 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; |