From: Theo Buehler Subject: Re: bgpd: better sync template clones in merge_peers To: tech@openbsd.org Date: Mon, 11 May 2026 21:23:46 +0200 On Mon, May 11, 2026 at 09:08:01PM +0200, Claudio Jeker wrote: > When introducing local_bgpid in the session code the case to update cloned > peers was missed. merge_peers only updates regular peers and templates. > > Note: session_template_clone() copies the template->conf into conf so all > the other fixups inside conf (holdtime, etc) get taken over. The problem > is that local_bgpid is not inside conf and so this was missed. > Another option to the diff below is to do the local_bgpid in > session_template_clone() by copying peer->template->local_bgpid into > peer->local_bgpid. It is a bit less direct than the diff below, not sure > if it is worth it. Your call. The below seems fine. If I understand correctly, it doesn't matter for the second session_template_clone() call where the local_peerip is copied from loose in the memcpy already. ok for this diff > > This should fix this oversight. > -- > :wq Claudio > > Index: session.c > =================================================================== > RCS file: /cvs/src/usr.sbin/bgpd/session.c,v > diff -u -p -r1.534 session.c > --- session.c 8 May 2026 12:03:50 -0000 1.534 > +++ session.c 11 May 2026 19:02:43 -0000 > @@ -1968,6 +1968,8 @@ merge_peers(struct bgpd_config *c, struc > session_template_clone(xp, NULL, xp->conf.id, > xp->conf.remote_as); > > + xp->local_bgpid = nc->bgpid; > + > if (xp->rdesession) > imsg_rde(IMSG_SESSION_ADD, > xp->conf.id, &xp->conf, >