From: Maria Matejka Date: Mon, 29 May 2023 17:32:26 +0000 (+0200) Subject: BFD: Fixed reconfiguration issues X-Git-Tag: v3.0.0~425 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ba9878b4f74a375d54a2d79a5ab80c7f1d0c466;p=thirdparty%2Fbird.git BFD: Fixed reconfiguration issues After converting BFD to the new IO loop system, reconfiguration never really worked. Sadly, we missed this case in our testing suite so it passed under the radar for quite a while. Thanks to Andrei Dinu for reporting and isolating this issue. --- diff --git a/proto/bfd/bfd.c b/proto/bfd/bfd.c index e373e4dd0..5980148b4 100644 --- a/proto/bfd/bfd.c +++ b/proto/bfd/bfd.c @@ -528,7 +528,7 @@ bfd_reconfigure_session(struct bfd_proto *p, struct bfd_session *s) if (EMPTY_LIST(s->request_list)) return; - birdloop_enter(p->p.loop); + ASSERT_DIE(birdloop_inside(p->p.loop)); struct bfd_request *req = SKIP_BACK(struct bfd_request, n, HEAD(s->request_list)); s->cf = bfd_merge_options(s->ifa->cf, &req->opts); @@ -541,8 +541,6 @@ bfd_reconfigure_session(struct bfd_proto *p, struct bfd_session *s) bfd_session_control_tx_timer(s, 0); - birdloop_leave(p->p.loop); - TRACE(D_EVENTS, "Session to %I reconfigured", s->addr); } @@ -614,7 +612,7 @@ bfd_free_iface(struct bfd_iface *ifa) } static void -bfd_reconfigure_iface(struct bfd_proto *p, struct bfd_iface *ifa, struct bfd_config *nc) +bfd_reconfigure_iface(struct bfd_proto *p UNUSED, struct bfd_iface *ifa, struct bfd_config *nc) { struct bfd_iface_config *new = bfd_find_iface_config(nc, ifa->iface); struct bfd_iface_config *old = ifa->cf; @@ -628,9 +626,7 @@ bfd_reconfigure_iface(struct bfd_proto *p, struct bfd_iface *ifa, struct bfd_con (new->passive != old->passive); /* This should be probably changed to not access ifa->cf from the BFD thread */ - birdloop_enter(p->p.loop); ifa->cf = new; - birdloop_leave(p->p.loop); } @@ -873,7 +869,12 @@ bfd_update_request(struct bfd_request *req, const struct bfd_options *opts) req->opts = *opts; if (s) - bfd_reconfigure_session(s->ifa->bfd, s); + { + struct bfd_proto *p = s->ifa->bfd; + birdloop_enter(p->p.loop); + bfd_reconfigure_session(p, s); + birdloop_leave(p->p.loop); + } } static void