summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2017-05-29 13:10:40 +0000
committerclaudio <claudio@openbsd.org>2017-05-29 13:10:40 +0000
commit12d81493d6097ee024017813add85fa87c02c818 (patch)
tree7a6c5b857205977aea81e0942c4e5672f65d3bfd
parentChange the mmap(2)-based binary history file with lots of magic and a (diff)
downloadwireguard-openbsd-12d81493d6097ee024017813add85fa87c02c818.tar.xz
wireguard-openbsd-12d81493d6097ee024017813add85fa87c02c818.zip
After some consideration, revert last commit and don't abuse rde_dump_done.
IMSG_CTL_SHOW_RIB_PREFIX case is not using rib_dump_r and so should not use rde_dump_done, instead send the IMSG_CTL_END msg and free the ctx directly. This is easier to understand.
-rw-r--r--usr.sbin/bgpd/rde.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index 3c27e06e1ca..f98da41438d 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.367 2017/05/29 12:48:11 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.368 2017/05/29 13:10:40 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -2419,7 +2419,9 @@ rde_dump_ctx_new(struct ctl_show_rib_request *req, pid_t pid,
re = rib_get(rib, &req->prefix, req->prefixlen);
if (re)
rde_dump_upcall(re, ctx);
- rde_dump_done(ctx);
+ imsg_compose(ibuf_se_ctl, IMSG_CTL_END, 0, ctx->req.pid,
+ -1, NULL, 0);
+ free(ctx);
return;
default:
fatalx("rde_dump_ctx_new: unsupported imsg type");
@@ -2476,12 +2478,7 @@ rde_dump_done(void *arg)
imsg_compose(ibuf_se_ctl, IMSG_CTL_END, 0, ctx->req.pid,
-1, NULL, 0);
- /*
- * ctx is not linked for IMSG_CTL_SHOW_RIB_PREFIX because it
- * does not need to use rib_dump_r
- */
- if (ctx->req.type != IMSG_CTL_SHOW_RIB_PREFIX)
- LIST_REMOVE(ctx, entry);
+ LIST_REMOVE(ctx, entry);
free(ctx);
}