diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2019-06-01 09:54:20 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2019-06-01 09:54:20 +0000 |
commit | 914ec0b5716bbd83f15ba135ed97b2d25528f167 (patch) | |
tree | 94a488ac69da14052bb077ff375bd5cc838fea04 /usr.sbin/relayd | |
parent | bcad84f4ba2b2e4b2fccbdc33fe964e5dd46ba06 (diff) |
Make sure that the IMSG_CTL_RESET message is sent immediately.
This fixes an issue that might better be solved in imsg itself.
The problem is that IMSG_CTL_RESET does not include an fd while the
following messages (IMSG_CFG_RELAY and IMSG_CFG_RELAY_FD) do contain
fds. If the receiver gets them in one buffer (via recvmsg), the first
fd might be wrongly associated to the IMSG_CTL_RESET message. This is
theoretically taken care of by the imsg API, so it is either a bug in
relayd's API usage or in imsg itself.
"sure" claudio@ as a temporary fix.
Diffstat (limited to 'usr.sbin/relayd')
-rw-r--r-- | usr.sbin/relayd/config.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/relayd/config.c b/usr.sbin/relayd/config.c index 50b03744b72..ce1eb2bfe0d 100644 --- a/usr.sbin/relayd/config.c +++ b/usr.sbin/relayd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.38 2019/05/31 15:25:57 reyk Exp $ */ +/* $OpenBSD: config.c,v 1.39 2019/06/01 09:54:19 reyk Exp $ */ /* * Copyright (c) 2011 - 2014 Reyk Floeter <reyk@openbsd.org> @@ -237,6 +237,14 @@ config_setreset(struct relayd *env, u_int reset) id == privsep_process) continue; proc_compose(ps, id, IMSG_CTL_RESET, &reset, sizeof(reset)); + + /* + * XXX Make sure that the reset message is sent + * immediately by flushing the imsg output buffer, before + * sending any other imsg that potentially include an fd. + * This should better be fixed in the imsg API itself. + */ + proc_flush_imsg(ps, id, -1); } return (0); |