summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2023-04-13 15:51:17 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2023-04-13 15:51:17 +0000
commitd81c67e74c291a197789109c2dedbd0a15e4d3bf (patch)
treef7c23900b62e4a4c7935e6298439e3051f6beac2 /usr.sbin/bgpd
parent13cf12edd900da526df00cce45f28594430e0398 (diff)
Simplify how IMSG_CTL_SHOW_RIB_COMMUNITIES is constructed. This can just
call imsg_compose() and be done with it. OK tb@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/rde.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index 6327dd2d5f7..e3f6891d7d9 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.600 2023/04/07 13:49:03 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.601 2023/04/13 15:51:16 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -2730,16 +2730,10 @@ rde_dump_rib_as(struct prefix *p, struct rde_aspath *asp, pid_t pid, int flags,
struct rde_community *comm = prefix_communities(p);
size_t len = comm->nentries * sizeof(struct community);
if (comm->nentries > 0) {
- if ((wbuf = imsg_create(ibuf_se_ctl,
- IMSG_CTL_SHOW_RIB_COMMUNITIES, 0, pid,
- len)) == NULL)
- return;
- if ((bp = ibuf_reserve(wbuf, len)) == NULL) {
- ibuf_free(wbuf);
+ if (imsg_compose(ibuf_se_ctl,
+ IMSG_CTL_SHOW_RIB_COMMUNITIES, 0, pid, -1,
+ comm->communities, len) == -1)
return;
- }
- memcpy(bp, comm->communities, len);
- imsg_close(ibuf_se_ctl, wbuf);
}
for (l = 0; l < asp->others_len; l++) {
if ((a = asp->others[l]) == NULL)