From: claudio Date: Mon, 8 Jan 2024 15:09:14 +0000 (+0000) Subject: Simplify the IMSG_CTL_KROUTE after the change in bgpd. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ee979483959e94545586a45f50c2740df04b4677;p=openbsd Simplify the IMSG_CTL_KROUTE after the change in bgpd. OK tb@ --- diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c index bd3a89861b9..388b08ca06e 100644 --- a/usr.sbin/bgpctl/bgpctl.c +++ b/usr.sbin/bgpctl/bgpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpctl.c,v 1.298 2023/11/20 14:41:55 claudio Exp $ */ +/* $OpenBSD: bgpctl.c,v 1.299 2024/01/08 15:09:14 claudio Exp $ */ /* * Copyright (c) 2003 Henning Brauer @@ -194,19 +194,13 @@ main(int argc, char *argv[]) break; case SHOW_FIB: if (!res->addr.aid) { - struct ibuf *msg; - sa_family_t af; - - af = aid2af(res->aid); - if ((msg = imsg_create(imsgbuf, IMSG_CTL_KROUTE, - res->rtableid, 0, sizeof(res->flags) + - sizeof(af))) == NULL) - errx(1, "imsg_create failure"); - if (imsg_add(msg, &res->flags, sizeof(res->flags)) == - -1 || - imsg_add(msg, &af, sizeof(af)) == -1) - errx(1, "imsg_add failure"); - imsg_close(imsgbuf, msg); + struct ctl_kroute_req req = { 0 }; + + req.af = aid2af(res->aid); + req.flags = res->flags; + + imsg_compose(imsgbuf, IMSG_CTL_KROUTE, res->rtableid, + 0, -1, &req, sizeof(req)); } else imsg_compose(imsgbuf, IMSG_CTL_KROUTE_ADDR, res->rtableid, 0, -1,