Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: bgpd: don't fatal in rde_dump_ctx_new() for bad imsg types in the adj-rib-out case
To:
tech@openbsd.org
Date:
Wed, 13 May 2026 15:59:16 +0200

Download raw body.

Thread
On Wed, May 13, 2026 at 03:44:45PM +0200, Claudio Jeker wrote:
> In rde_dump_ctx_new() the adj-rib-out case only covers some of the
> possible imsg types rde_dump_ctx_new() can be called with. So ship back an
> error instead of the fatalx call.
> 
> The error could be refined but I think "operation not supported" is fine
> for now.

ok tb

> -- 
> :wq Claudio
> 
> Index: rde.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
> diff -u -p -r1.699 rde.c
> --- rde.c	12 May 2026 20:27:31 -0000	1.699
> +++ rde.c	13 May 2026 12:10:46 -0000
> @@ -3385,7 +3385,12 @@ rde_dump_ctx_new(struct ctl_show_rib_req
>  			free(ctx);
>  			return;
>  		default:
> -			fatalx("%s: unsupported imsg type", __func__);
> +			log_warnx("%s: bad imsg type %d", __func__, req->type);
> +			error = CTL_RES_OPNOTSUPP;
> +			imsg_compose(ibuf_se_ctl, IMSG_CTL_RESULT, 0, pid, -1,
> +			    &error, sizeof(error));
> +			free(ctx);
> +			return;
>  		}
>  
>  		LIST_INSERT_HEAD(&rde_dump_h, ctx, entry);
>