summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/parse.y
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-07-28 15:10:02 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-07-28 15:10:02 +0000
commit31333cce087d519da4fb43ed4d63ca68de7f50dc (patch)
tree5bfd5443616545c0dc841a0adcf34835504ce7ac /usr.sbin/bgpd/parse.y
parentc93e358e145b92b575b3dd18020a099dbacbad11 (diff)
allow prefix lists inside prefix lists
Diffstat (limited to 'usr.sbin/bgpd/parse.y')
-rw-r--r--usr.sbin/bgpd/parse.y22
1 files changed, 19 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index 6271ed7d682..4d2a5bb7f9f 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.125 2004/07/28 15:05:20 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.126 2004/07/28 15:10:01 henning Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -161,7 +161,8 @@ typedef struct {
%type <v.filter_as> filter_as_t filter_as_t_l filter_as_l_h
%type <v.prefixlen> prefixlenop
%type <v.filter_set> filter_set filter_set_l filter_set_opt
-%type <v.filter_prefix> filter_prefix filter_prefix_l filter_prefix_h
+%type <v.filter_prefix> filter_prefix filter_prefix_l
+%type <v.filter_prefix> filter_prefix_h filter_prefix_m
%type <v.u8> unaryop binaryop filter_as_type
%type <v.encspec> encspec;
%%
@@ -856,9 +857,24 @@ filter_peer : ANY {
;
filter_prefix_h : 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;