On Sat, May 27, 2017 at 06:55:52PM +0200, Sebastian Benoit wrote: > Sebastian Benoit(be...@openbsd.org) on 2017.05.27 18:35:06 +0200: > > > > in a bgpd.conf config with > > > > network 2a00:15a8:6:100::/56 set ext-community soo 23:42 > > network 2a00:15a8:6:100::/56 > > > > the second line "overwrites" the first line. > > > > this prints a warning, because i wasted 30 minutes wondering why i could not > > see the community on the wire... > > as noted by flrian and claudio, now with yyerror: > > $ bgpd -n > /etc/bgpd.conf:46: duplicate prefix in network statement > $ bgpctl reload > reload request sent. > config file has errors, reload failed > > ok?
OK > diff --git usr.sbin/bgpd/parse.y usr.sbin/bgpd/parse.y > index 64a257d9882..a7285256d01 100644 > --- usr.sbin/bgpd/parse.y > +++ usr.sbin/bgpd/parse.y > @@ -678,7 +678,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"); > @@ -687,6 +687,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)) > + yyerror("duplicate prefix " > + "in network statement"); > + } > > TAILQ_INSERT_TAIL(netconf, n, entry); > } > -- :wq Claudio