Re: fix bgpd route-reflector without cluster id

2019-09-27 Thread clau...@openbsd.org
On Thu, Sep 26, 2019 at 07:38:51PM +, Rivo Nurges wrote:
> Hi!
> 
> Before bgpd.c:1.225 bgpd ran merge_config on startup and set the
> cluster-id to router-id when needed. This is not the case anymore and if 
> cluster-id is not explicitly specified its not picked up on startup
> causing bgp to use 0.0.0.0 as the cluster-id.
> 

I committed the fix but moved the code in parse.y a bit down to where the
filters are concatenated and optimised. That seemed like a better spot
to me.

Thanks for the report
-- 
:wq Claudio

PS: for some reasons your diff did not apply for me. It seems something
changed the spaces.



Re: fix bgpd route-reflector without cluster id

2019-09-26 Thread clau...@openbsd.org
On Thu, Sep 26, 2019 at 07:38:51PM +, Rivo Nurges wrote:
> Hi!
> 
> Before bgpd.c:1.225 bgpd ran merge_config on startup and set the
> cluster-id to router-id when needed. This is not the case anymore and if 
> cluster-id is not explicitly specified its not picked up on startup
> causing bgp to use 0.0.0.0 as the cluster-id.
> 

Indeed, this is correct. I will commit the diff later today.
Thanks for the report.

> Rivo
> 
> Index: usr.sbin/bgpd/config.c
> ===
> RCS file: /cvs/src/usr.sbin/bgpd/config.c,v
> retrieving revision 1.92
> diff -u -p -r1.92 config.c
> --- usr.sbin/bgpd/config.c13 Aug 2019 07:39:57 -  1.92
> +++ usr.sbin/bgpd/config.c26 Sep 2019 19:28:21 -
> @@ -201,8 +201,6 @@ merge_config(struct bgpd_config *xconf,
>   /*
>* 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 */
> Index: usr.sbin/bgpd/parse.y
> ===
> RCS file: /cvs/src/usr.sbin/bgpd/parse.y,v
> retrieving revision 1.401
> diff -u -p -r1.401 parse.y
> --- usr.sbin/bgpd/parse.y 13 Aug 2019 07:39:57 -  1.401
> +++ usr.sbin/bgpd/parse.y 26 Sep 2019 19:28:21 -
> @@ -3309,6 +3309,8 @@ parse_config(char *filename, struct peer
>   log_warnx("configuration error: AS not given");
>   errors++;
>   }
> + if ((conf->flags & BGPD_FLAG_REFLECTOR) && conf->clusterid == 0)
> + conf->clusterid = conf->bgpid;
> 
>   /* clear the globals */
>   curpeer = NULL;

-- 
:wq Claudio



fix bgpd route-reflector without cluster id

2019-09-26 Thread Rivo Nurges
Hi!

Before bgpd.c:1.225 bgpd ran merge_config on startup and set the cluster-id to 
router-id when needed. This is not the case anymore and if 
cluster-id is not explicitly specified its not picked up on startup causing bgp 
to use 0.0.0.0 as the cluster-id.

Rivo

Index: usr.sbin/bgpd/config.c
===
RCS file: /cvs/src/usr.sbin/bgpd/config.c,v
retrieving revision 1.92
diff -u -p -r1.92 config.c
--- usr.sbin/bgpd/config.c  13 Aug 2019 07:39:57 -  1.92
+++ usr.sbin/bgpd/config.c  26 Sep 2019 19:28:21 -
@@ -201,8 +201,6 @@ merge_config(struct bgpd_config *xconf,
/*
 * 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 */
Index: usr.sbin/bgpd/parse.y
===
RCS file: /cvs/src/usr.sbin/bgpd/parse.y,v
retrieving revision 1.401
diff -u -p -r1.401 parse.y
--- usr.sbin/bgpd/parse.y   13 Aug 2019 07:39:57 -  1.401
+++ usr.sbin/bgpd/parse.y   26 Sep 2019 19:28:21 -
@@ -3309,6 +3309,8 @@ parse_config(char *filename, struct peer
log_warnx("configuration error: AS not given");
errors++;
}
+   if ((conf->flags & BGPD_FLAG_REFLECTOR) && conf->clusterid == 0)
+   conf->clusterid = conf->bgpid;

/* clear the globals */
curpeer = NULL;