]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Protocol: State announcements must be always processed before leaving the loop
authorKaterina Kubecova <katerina.kubecova@nic.cz>
Thu, 18 Sep 2025 09:21:41 +0000 (11:21 +0200)
committerMaria Matejka <mq@ucw.cz>
Mon, 22 Sep 2025 11:35:02 +0000 (13:35 +0200)
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.

nest/protocol.h

index d6f69a31e7a714d4482d5aa3294036dfe3803020..7219cdfd95b6d530143db5cf36d99bf80424a42d 100644 (file)
@@ -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); }