summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2019-09-27 10:26:33 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2019-09-27 10:26:33 +0000
commit020bd7faa45272d05dc5cb6136932dfda43426ee (patch)
tree76f2c67df33d5d4c8d2046d54533c2995b724ac6 /usr.sbin
parentf6ac2c0b10e31971013faa92a811072edcb1f9be (diff)
Move the code to initialize the cluster-id from merge_config() to
parse_config(). The first is not called on startup which results in bgpd using 0.0.0.0 as cluster-id. Found and fix provided by Rivo Nurges (Rivo dot Nurges at smit dot ee) Thanks and OK claudio@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/config.c4
-rw-r--r--usr.sbin/bgpd/parse.y6
2 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/config.c b/usr.sbin/bgpd/config.c
index 026712ce4ef..cb43afb81fe 100644
--- a/usr.sbin/bgpd/config.c
+++ b/usr.sbin/bgpd/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.92 2019/08/13 07:39:57 claudio Exp $ */
+/* $OpenBSD: config.c,v 1.93 2019/09/27 10:26:32 claudio Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@@ -201,8 +201,6 @@ merge_config(struct bgpd_config *xconf, struct bgpd_config *conf)
/*
* merge the freshly parsed conf into the running xconf
*/
- if ((conf->flags & BGPD_FLAG_REFLECTOR) && conf->clusterid == 0)
- conf->clusterid = conf->bgpid;
/* adjust FIB priority if changed */
/* if xconf is uninitialized we get RTP_NONE */
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index d872cc9c94a..b91def2cfcd 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.401 2019/08/13 07:39:57 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.402 2019/09/27 10:26:32 claudio Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -3331,6 +3331,10 @@ errors:
free_config(conf);
return (NULL);
} else {
+ /* update clusterid in case it was not set explicitly */
+ if ((conf->flags & BGPD_FLAG_REFLECTOR) && conf->clusterid == 0)
+ conf->clusterid = conf->bgpid;
+
/*
* Concatenate filter list and static group and peer filtersets
* together. Static group sets come first then peer sets