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...

ok?

(benno_bgpd_parse_duplicate_net.diff)

diff --git usr.sbin/bgpd/parse.y usr.sbin/bgpd/parse.y
index 64a257d9882..2ad3010309c 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))
+                                       logit(LOG_NOTICE, "duplicate prefix "
+                                           "in network statement\n");
+                       }
 
                        TAILQ_INSERT_TAIL(netconf, n, entry);
                }

Reply via email to