From: Katerina Kubecova Date: Thu, 18 Sep 2025 09:21:41 +0000 (+0200) Subject: Protocol: State announcements must be always processed before leaving the loop X-Git-Tag: v3.0.5~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d153133b6938b3d5159bbf245807261648a0fb4b;p=thirdparty%2Fbird.git Protocol: State announcements must be always processed before leaving the loop When using PROTO_LOCKED_FROM_MAIN or other birdloop_enter, there may be deferred state announcements which have to be sent immediately, otherwise the main loop would try to execute them out of the appropriate locked context. --- diff --git a/nest/protocol.h b/nest/protocol.h index d6f69a31e..7219cdfd9 100644 --- a/nest/protocol.h +++ b/nest/protocol.h @@ -302,7 +302,8 @@ struct proto_reload_request { #define PROTO_LEAVE_FROM_MAIN(loop) ({ if (loop != &main_birdloop) birdloop_leave(loop); }) -#define PROTO_LOCKED_FROM_MAIN(p) for (struct birdloop *_proto_loop = PROTO_ENTER_FROM_MAIN(p); _proto_loop; PROTO_LEAVE_FROM_MAIN(_proto_loop), (_proto_loop = NULL)) +#define PROTO_LOCKED_FROM_MAIN(p) for (struct birdloop *_proto_loop = PROTO_ENTER_FROM_MAIN(p); _proto_loop; \ +proto_announce_state((p), (p)->ea_state), PROTO_LEAVE_FROM_MAIN(_proto_loop), (_proto_loop = NULL)) static inline struct domain_generic *proto_domain(struct proto *p) { return birdloop_domain(p->loop); }