Download raw body.
bgpd: don't fatal when parent closes imsg socket
On Wed, Oct 29, 2025 at 04:04:41PM +0100, Claudio Jeker wrote:
> The RTR and RDE process fatal when the parent closes the imsg connection.
> This is not ideal since that happens when one of the other processes dies
> and the parent exits. So this kind of hides the real reason further up in
> the log.
>
> The SE already does the right thing so just use that idiom and quit the
> main event loop ASAP and exit out.
ok tb
>
> --
> :wq Claudio
>
> Index: rde.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
> diff -u -p -r1.658 rde.c
> --- rde.c 29 Oct 2025 10:34:23 -0000 1.658
> +++ rde.c 29 Oct 2025 14:58:30 -0000
> @@ -272,9 +272,11 @@ rde_main(int debug, int verbose)
> fatal("poll error");
> }
>
> - if (handle_pollfd(&pfd[PFD_PIPE_MAIN], ibuf_main) == -1)
> - fatalx("Lost connection to parent");
> - else
> + if (handle_pollfd(&pfd[PFD_PIPE_MAIN], ibuf_main) == -1) {
> + log_warnx("RDE: Lost connection to parent");
> + rde_quit = 1;
> + continue;
> + } else
> rde_dispatch_imsg_parent(ibuf_main);
>
> if (handle_pollfd(&pfd[PFD_PIPE_SESSION], ibuf_se) == -1) {
> Index: rtr.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgpd/rtr.c,v
> diff -u -p -r1.31 rtr.c
> --- rtr.c 14 Apr 2025 14:50:29 -0000 1.31
> +++ rtr.c 29 Oct 2025 14:58:30 -0000
> @@ -264,9 +264,11 @@ rtr_main(int debug, int verbose)
> fatal("poll error");
> }
>
> - if (handle_pollfd(&pfd[PFD_PIPE_MAIN], ibuf_main) == -1)
> - fatalx("Lost connection to parent");
> - else
> + if (handle_pollfd(&pfd[PFD_PIPE_MAIN], ibuf_main) == -1) {
> + log_warnx("RTR: Lost connection to parent");
> + rtr_quit = 1;
> + continue;
> + } else
> rtr_dispatch_imsg_parent(ibuf_main);
>
> if (handle_pollfd(&pfd[PFD_PIPE_RDE], ibuf_rde) == -1) {
>
bgpd: don't fatal when parent closes imsg socket