From 7298f77d02417c373df4920568f882ceee606e9b Mon Sep 17 00:00:00 2001 From: benno Date: Sat, 8 Sep 2018 09:18:34 +0000 Subject: [PATCH] add a check for curly braces in a macro being used inside a filter rule with curly braces --- regress/usr.sbin/bgpd/config/Makefile | 4 +-- regress/usr.sbin/bgpd/config/bgpd.conf.3.in | 25 +++++++++++++++++ regress/usr.sbin/bgpd/config/bgpd.conf.3.ok | 31 +++++++++++++++++++++ 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 regress/usr.sbin/bgpd/config/bgpd.conf.3.in create mode 100644 regress/usr.sbin/bgpd/config/bgpd.conf.3.ok diff --git a/regress/usr.sbin/bgpd/config/Makefile b/regress/usr.sbin/bgpd/config/Makefile index adaac5344b7..4181cbbf9c4 100644 --- a/regress/usr.sbin/bgpd/config/Makefile +++ b/regress/usr.sbin/bgpd/config/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.1 2018/09/07 08:38:35 claudio Exp $ +# $OpenBSD: Makefile,v 1.2 2018/09/08 09:18:34 benno Exp $ -BGPDTESTS=1 2 +BGPDTESTS=1 2 3 REGRESS_TARGETS = config diff --git a/regress/usr.sbin/bgpd/config/bgpd.conf.3.in b/regress/usr.sbin/bgpd/config/bgpd.conf.3.in new file mode 100644 index 00000000000..1348a1f7688 --- /dev/null +++ b/regress/usr.sbin/bgpd/config/bgpd.conf.3.in @@ -0,0 +1,25 @@ +# $OpenBSD: bgpd.conf.3.in,v 1.1 2018/09/08 09:18:34 benno Exp $ +# in filter commands, test curly braces inside curly braces + +AS 1 + +somepeer_v6 = "2001:DB8::1" + +somenets_v6 = "{ \ + 2001:DB8:100::/64 \ + 2001:DB8:200::/64 \ + 2001:DB8:300::/64 \ + }" + +somemore_v6 = "{ \ + 2001:DB8:400::/64 \ + 2001:DB8:500::/64 \ + }" + +neighbor $somepeer_v6 { + remote-as 64496 + descr "v6SOMEPEER" +} + +allow from $somepeer_v6 prefix $somenets_v6 +allow from $somepeer_v6 prefix { $somenets_v6 $somemore_v6 } diff --git a/regress/usr.sbin/bgpd/config/bgpd.conf.3.ok b/regress/usr.sbin/bgpd/config/bgpd.conf.3.ok new file mode 100644 index 00000000000..912771bb9aa --- /dev/null +++ b/regress/usr.sbin/bgpd/config/bgpd.conf.3.ok @@ -0,0 +1,31 @@ +somepeer_v6 = "2001:DB8::1" +somenets_v6 = "{ 2001:DB8:100::/64 2001:DB8:200::/64 2001:DB8:300::/64 }" +somemore_v6 = "{ 2001:DB8:400::/64 2001:DB8:500::/64 }" +AS 1 +router-id 127.0.0.1 +socket "/var/run/bgpd.sock.0" +holdtime min 3 +fib-priority 48 + + +rde rib Adj-RIB-In no evaluate +rde rib Adj-RIB-Out no evaluate +rde rib Loc-RIB rtable 0 fib-update yes + + +neighbor 2001:db8::1 { + descr "v6SOMEPEER" + remote-as 64496 + enforce neighbor-as yes + enforce local-as yes + announce IPv6 unicast +} + +allow from 2001:db8::1 prefix 2001:db8:300::/64 +allow from 2001:db8::1 prefix 2001:db8:200::/64 +allow from 2001:db8::1 prefix 2001:db8:100::/64 +allow from 2001:db8::1 prefix 2001:db8:300::/64 +allow from 2001:db8::1 prefix 2001:db8:200::/64 +allow from 2001:db8::1 prefix 2001:db8:100::/64 +allow from 2001:db8::1 prefix 2001:db8:500::/64 +allow from 2001:db8::1 prefix 2001:db8:400::/64 -- 2.20.1