summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenno <benno@openbsd.org>2017-05-27 18:04:07 +0000
committerbenno <benno@openbsd.org>2017-05-27 18:04:07 +0000
commit041fb0746a29c69abc23b0e0116a20b9ace57bfe (patch)
tree729dcd6e10f3e9f87693b0dc235f607f67b05ef7
parentUse copyin32(9) to atomically copy the futex from user space. (diff)
downloadwireguard-openbsd-041fb0746a29c69abc23b0e0116a20b9ace57bfe.tar.xz
wireguard-openbsd-041fb0746a29c69abc23b0e0116a20b9ace57bfe.zip
allow only one network <prefix> statement per for the same prefix.
ok florian@ phessler@
-rw-r--r--usr.sbin/bgpd/parse.y11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index 0ccc8be5a27..0b8bea69e66 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.303 2017/05/27 10:33:15 phessler Exp $ */
+/* $OpenBSD: parse.y,v 1.304 2017/05/27 18:04:07 benno Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -677,7 +677,7 @@ mrtdump : DUMP STRING inout STRING optnumber {
;
network : NETWORK prefix filter_set {
- struct network *n;
+ struct network *n, *m;
if ((n = calloc(1, sizeof(struct network))) == NULL)
fatal("new_network");
@@ -686,6 +686,13 @@ network : NETWORK prefix filter_set {
n->net.prefixlen = $2.len;
filterset_move($3, &n->net.attrset);
free($3);
+ TAILQ_FOREACH(m, netconf, entry) {
+ if (n->net.prefixlen == m->net.prefixlen &&
+ prefix_compare(&n->net.prefix,
+ &m->net.prefix, n->net.prefixlen) == 0)
+ yyerror("duplicate prefix "
+ "in network statement");
+ }
TAILQ_INSERT_TAIL(netconf, n, entry);
}