summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/relayd/ca.c4
-rw-r--r--usr.sbin/relayd/check_script.c5
-rw-r--r--usr.sbin/relayd/config.c33
-rw-r--r--usr.sbin/relayd/control.c5
-rw-r--r--usr.sbin/relayd/hce.c7
-rw-r--r--usr.sbin/relayd/pfe.c28
-rw-r--r--usr.sbin/relayd/pfe_route.c6
-rw-r--r--usr.sbin/relayd/proc.c26
-rw-r--r--usr.sbin/relayd/relay.c24
-rw-r--r--usr.sbin/relayd/relay_udp.c6
-rw-r--r--usr.sbin/relayd/relayd.c14
-rw-r--r--usr.sbin/relayd/relayd.h10
-rw-r--r--usr.sbin/relayd/snmp.c13
13 files changed, 92 insertions, 89 deletions
diff --git a/usr.sbin/relayd/ca.c b/usr.sbin/relayd/ca.c
index 977151b0b6e..a1c4eda7d85 100644
--- a/usr.sbin/relayd/ca.c
+++ b/usr.sbin/relayd/ca.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ca.c,v 1.14 2015/10/10 00:16:23 benno Exp $ */
+/* $OpenBSD: ca.c,v 1.15 2015/12/02 13:41:27 reyk Exp $ */
/*
* Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
@@ -217,7 +217,7 @@ ca_dispatch_relay(int fd, struct privsep_proc *p, struct imsg *imsg)
}
proc_composev_imsg(env->sc_ps, PROC_RELAY, cko.cko_proc,
- imsg->hdr.type, -1, iov, c);
+ imsg->hdr.type, -1, -1, iov, c);
free(to);
RSA_free(rsa);
diff --git a/usr.sbin/relayd/check_script.c b/usr.sbin/relayd/check_script.c
index 217dc89f024..c9990e0add0 100644
--- a/usr.sbin/relayd/check_script.c
+++ b/usr.sbin/relayd/check_script.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: check_script.c,v 1.18 2015/01/22 17:42:09 reyk Exp $ */
+/* $OpenBSD: check_script.c,v 1.19 2015/12/02 13:41:27 reyk Exp $ */
/*
* Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -52,8 +52,7 @@ check_script(struct relayd *env, struct host *host)
fatalx("invalid script path");
memcpy(&scr.timeout, &table->conf.timeout, sizeof(scr.timeout));
- proc_compose_imsg(env->sc_ps, PROC_PARENT, 0, IMSG_SCRIPT,
- -1, &scr, sizeof(scr));
+ proc_compose(env->sc_ps, PROC_PARENT, IMSG_SCRIPT, &scr, sizeof(scr));
}
void
diff --git a/usr.sbin/relayd/config.c b/usr.sbin/relayd/config.c
index 2992df0fc24..32852cf182b 100644
--- a/usr.sbin/relayd/config.c
+++ b/usr.sbin/relayd/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.25 2015/05/02 13:15:24 claudio Exp $ */
+/* $OpenBSD: config.c,v 1.26 2015/12/02 13:41:27 reyk Exp $ */
/*
* Copyright (c) 2011 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -220,8 +220,7 @@ config_setreset(struct relayd *env, u_int reset)
if ((reset & ps->ps_what[id]) == 0 ||
id == privsep_process)
continue;
- proc_compose_imsg(ps, id, -1, IMSG_CTL_RESET, -1,
- &reset, sizeof(reset));
+ proc_compose(ps, id, IMSG_CTL_RESET, &reset, sizeof(reset));
}
return (0);
@@ -279,8 +278,7 @@ config_getcfg(struct relayd *env, struct imsg *imsg)
}
if (privsep_process != PROC_PARENT)
- proc_compose_imsg(env->sc_ps, PROC_PARENT, -1,
- IMSG_CFG_DONE, -1, NULL, 0);
+ proc_compose(env->sc_ps, PROC_PARENT, IMSG_CFG_DONE, NULL, 0);
return (0);
}
@@ -313,10 +311,10 @@ config_settable(struct relayd *env, struct table *tb)
iov[c++].iov_len = strlen(tb->sendbuf);
}
- proc_composev_imsg(ps, id, -1, IMSG_CFG_TABLE, -1, iov, c);
+ proc_composev(ps, id, IMSG_CFG_TABLE, iov, c);
TAILQ_FOREACH(host, &tb->hosts, entry) {
- proc_compose_imsg(ps, id, -1, IMSG_CFG_HOST, -1,
+ proc_compose(ps, id, IMSG_CFG_HOST,
&host->conf, sizeof(host->conf));
}
}
@@ -415,12 +413,12 @@ config_setrdr(struct relayd *env, struct rdr *rdr)
DPRINTF("%s: sending rdr %s to %s", __func__,
rdr->conf.name, ps->ps_title[id]);
- proc_compose_imsg(ps, id, -1, IMSG_CFG_RDR, -1,
+ proc_compose(ps, id, IMSG_CFG_RDR,
&rdr->conf, sizeof(rdr->conf));
TAILQ_FOREACH(virt, &rdr->virts, entry) {
virt->rdrid = rdr->conf.id;
- proc_compose_imsg(ps, id, -1, IMSG_CFG_VIRT, -1,
+ proc_compose(ps, id, IMSG_CFG_VIRT,
virt, sizeof(*virt));
}
}
@@ -503,11 +501,11 @@ config_setrt(struct relayd *env, struct router *rt)
DPRINTF("%s: sending router %s to %s tbl %d", __func__,
rt->rt_conf.name, ps->ps_title[id], rt->rt_conf.gwtable);
- proc_compose_imsg(ps, id, -1, IMSG_CFG_ROUTER, -1,
+ proc_compose(ps, id, IMSG_CFG_ROUTER,
&rt->rt_conf, sizeof(rt->rt_conf));
TAILQ_FOREACH(nr, &rt->rt_netroutes, nr_entry) {
- proc_compose_imsg(ps, id, -1, IMSG_CFG_ROUTE, -1,
+ proc_compose(ps, id, IMSG_CFG_ROUTE,
&nr->nr_conf, sizeof(nr->nr_conf));
}
}
@@ -608,7 +606,7 @@ config_setproto(struct relayd *env, struct protocol *proto)
iov[c++].iov_len = strlen(proto->style);
}
- proc_composev_imsg(ps, id, -1, IMSG_CFG_PROTO, -1, iov, c);
+ proc_composev(ps, id, IMSG_CFG_PROTO, iov, c);
}
return (0);
@@ -659,8 +657,7 @@ config_setrule(struct relayd *env, struct protocol *proto)
rule->rule_ctl.kvlen[i].value = -1;
}
- proc_composev_imsg(ps, id, -1,
- IMSG_CFG_RULE, -1, iov, c);
+ proc_composev(ps, id, IMSG_CFG_RULE, iov, c);
}
}
@@ -837,11 +834,10 @@ config_setrelay(struct relayd *env, struct relay *rlay)
if ((fd = dup(rlay->rl_s)) == -1)
return (-1);
proc_composev_imsg(ps, id, n,
- IMSG_CFG_RELAY, fd, iov, c);
+ IMSG_CFG_RELAY, -1, fd, iov, c);
}
} else {
- proc_composev_imsg(ps, id, -1, IMSG_CFG_RELAY, -1,
- iov, c);
+ proc_composev(ps, id, IMSG_CFG_RELAY, iov, c);
}
if ((what & CONFIG_TABLES) == 0)
@@ -858,8 +854,7 @@ config_setrelay(struct relayd *env, struct relay *rlay)
iov[c].iov_base = &crt;
iov[c++].iov_len = sizeof(crt);
- proc_composev_imsg(ps, id, -1,
- IMSG_CFG_RELAY_TABLE, -1, iov, c);
+ proc_composev(ps, id, IMSG_CFG_RELAY_TABLE, iov, c);
}
}
diff --git a/usr.sbin/relayd/control.c b/usr.sbin/relayd/control.c
index 44ad48655bf..bb0a40474e9 100644
--- a/usr.sbin/relayd/control.c
+++ b/usr.sbin/relayd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.50 2015/11/28 09:52:07 reyk Exp $ */
+/* $OpenBSD: control.c,v 1.51 2015/12/02 13:41:27 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -357,8 +357,7 @@ control_dispatch_imsg(int fd, short event, void *arg)
proc_forward_imsg(env->sc_ps, &imsg, PROC_PARENT, -1);
break;
case IMSG_CTL_POLL:
- proc_compose_imsg(env->sc_ps, PROC_HCE, -1,
- IMSG_CTL_POLL, -1, NULL, 0);
+ proc_compose(env->sc_ps, PROC_HCE, IMSG_CTL_POLL, NULL, 0);
imsg_compose_event(&c->iev, IMSG_CTL_OK,
0, 0, -1, NULL, 0);
break;
diff --git a/usr.sbin/relayd/hce.c b/usr.sbin/relayd/hce.c
index 0c520a27577..78832dfadd5 100644
--- a/usr.sbin/relayd/hce.c
+++ b/usr.sbin/relayd/hce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hce.c,v 1.70 2015/11/28 18:10:12 benno Exp $ */
+/* $OpenBSD: hce.c,v 1.71 2015/12/02 13:41:27 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -133,7 +133,7 @@ hce_launch_checks(int fd, short event, void *arg)
/*
* notify pfe checks are done and schedule next check
*/
- proc_compose_imsg(env->sc_ps, PROC_PFE, -1, IMSG_SYNC, -1, NULL, 0);
+ proc_compose(env->sc_ps, PROC_PFE, IMSG_SYNC, NULL, 0);
TAILQ_FOREACH(table, env->sc_tables, entry) {
TAILQ_FOREACH(host, &table->hosts, entry) {
if ((host->flags & F_CHECK_DONE) == 0)
@@ -243,8 +243,7 @@ hce_notify_done(struct host *host, enum host_error he)
if (msg)
log_debug("%s: %s (%s)", __func__, host->conf.name, msg);
- proc_compose_imsg(env->sc_ps, PROC_PFE, -1, IMSG_HOST_STATUS,
- -1, &st, sizeof(st));
+ proc_compose(env->sc_ps, PROC_PFE, IMSG_HOST_STATUS, &st, sizeof(st));
if (host->up != host->last_up)
logopt = RELAYD_OPT_LOGUPDATE;
else
diff --git a/usr.sbin/relayd/pfe.c b/usr.sbin/relayd/pfe.c
index 5462ecf6099..8f2c11943bc 100644
--- a/usr.sbin/relayd/pfe.c
+++ b/usr.sbin/relayd/pfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfe.c,v 1.81 2015/11/29 01:20:33 benno Exp $ */
+/* $OpenBSD: pfe.c,v 1.82 2015/12/02 13:41:27 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -130,8 +130,8 @@ pfe_dispatch_hce(int fd, struct privsep_proc *p, struct imsg *imsg)
break;
/* Forward to relay engine(s) */
- proc_compose_imsg(env->sc_ps, PROC_RELAY, -1,
- IMSG_HOST_STATUS, -1, &st, sizeof(st));
+ proc_compose(env->sc_ps, PROC_RELAY,
+ IMSG_HOST_STATUS, &st, sizeof(st));
if ((table = table_find(env, host->conf.tableid))
== NULL)
@@ -244,7 +244,7 @@ pfe_dispatch_relay(int fd, struct privsep_proc *p, struct imsg *imsg)
if (natlook(env, &cnl) != 0)
cnl.in = -1;
proc_compose_imsg(env->sc_ps, PROC_RELAY, cnl.proc,
- IMSG_NATLOOK, -1, &cnl, sizeof(cnl));
+ IMSG_NATLOOK, -1, -1, &cnl, sizeof(cnl));
break;
case IMSG_STATISTICS:
IMSG_SIZE_CHECK(imsg, &crs);
@@ -421,7 +421,7 @@ show_sessions(struct ctl_conn *c)
* Request all the running sessions from the process
*/
proc_compose_imsg(env->sc_ps, PROC_RELAY, proc,
- IMSG_CTL_SESSION, -1, &cid, sizeof(cid));
+ IMSG_CTL_SESSION, -1, -1, &cid, sizeof(cid));
c->waiting++;
}
}
@@ -509,11 +509,11 @@ disable_table(struct ctl_conn *c, struct ctl_id *id)
table->up = 0;
TAILQ_FOREACH(host, &table->hosts, entry)
host->up = HOST_UNKNOWN;
- proc_compose_imsg(env->sc_ps, PROC_HCE, -1, IMSG_TABLE_DISABLE, -1,
+ proc_compose(env->sc_ps, PROC_HCE, IMSG_TABLE_DISABLE,
&table->conf.id, sizeof(table->conf.id));
/* Forward to relay engine(s) */
- proc_compose_imsg(env->sc_ps, PROC_RELAY, -1, IMSG_TABLE_DISABLE, -1,
+ proc_compose(env->sc_ps, PROC_RELAY, IMSG_TABLE_DISABLE,
&table->conf.id, sizeof(table->conf.id));
log_debug("%s: table %d", __func__, table->conf.id);
@@ -545,11 +545,11 @@ enable_table(struct ctl_conn *c, struct ctl_id *id)
table->up = 0;
TAILQ_FOREACH(host, &table->hosts, entry)
host->up = HOST_UNKNOWN;
- proc_compose_imsg(env->sc_ps, PROC_HCE, -1, IMSG_TABLE_ENABLE, -1,
+ proc_compose(env->sc_ps, PROC_HCE, IMSG_TABLE_ENABLE,
&table->conf.id, sizeof(table->conf.id));
/* Forward to relay engine(s) */
- proc_compose_imsg(env->sc_ps, PROC_RELAY, -1, IMSG_TABLE_ENABLE, -1,
+ proc_compose(env->sc_ps, PROC_RELAY, IMSG_TABLE_ENABLE,
&table->conf.id, sizeof(table->conf.id));
log_debug("%s: table %d", __func__, table->conf.id);
@@ -590,11 +590,11 @@ disable_host(struct ctl_conn *c, struct ctl_id *id, struct host *host)
host->check_cnt = 0;
host->up_cnt = 0;
- proc_compose_imsg(env->sc_ps, PROC_HCE, -1, IMSG_HOST_DISABLE, -1,
+ proc_compose(env->sc_ps, PROC_HCE, IMSG_HOST_DISABLE,
&host->conf.id, sizeof(host->conf.id));
/* Forward to relay engine(s) */
- proc_compose_imsg(env->sc_ps, PROC_RELAY, -1, IMSG_HOST_DISABLE, -1,
+ proc_compose(env->sc_ps, PROC_RELAY, IMSG_HOST_DISABLE,
&host->conf.id, sizeof(host->conf.id));
log_debug("%s: host %d", __func__, host->conf.id);
@@ -630,11 +630,11 @@ enable_host(struct ctl_conn *c, struct ctl_id *id, struct host *host)
host->flags &= ~(F_DEL);
host->flags &= ~(F_ADD);
- proc_compose_imsg(env->sc_ps, PROC_HCE, -1, IMSG_HOST_ENABLE, -1,
+ proc_compose(env->sc_ps, PROC_HCE, IMSG_HOST_ENABLE,
&host->conf.id, sizeof (host->conf.id));
/* Forward to relay engine(s) */
- proc_compose_imsg(env->sc_ps, PROC_RELAY, -1, IMSG_HOST_ENABLE, -1,
+ proc_compose(env->sc_ps, PROC_RELAY, IMSG_HOST_ENABLE,
&host->conf.id, sizeof(host->conf.id));
log_debug("%s: host %d", __func__, host->conf.id);
@@ -749,7 +749,7 @@ pfe_sync(void)
demote.level, table->conf.name, table->conf.demote_group);
(void)strlcpy(demote.group, table->conf.demote_group,
sizeof(demote.group));
- proc_compose_imsg(env->sc_ps, PROC_PARENT, -1, IMSG_DEMOTE, -1,
+ proc_compose(env->sc_ps, PROC_PARENT, IMSG_DEMOTE,
&demote, sizeof(demote));
}
}
diff --git a/usr.sbin/relayd/pfe_route.c b/usr.sbin/relayd/pfe_route.c
index fa5336425d6..731060e2746 100644
--- a/usr.sbin/relayd/pfe_route.c
+++ b/usr.sbin/relayd/pfe_route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfe_route.c,v 1.9 2015/01/22 17:42:09 reyk Exp $ */
+/* $OpenBSD: pfe_route.c,v 1.10 2015/12/02 13:41:27 reyk Exp $ */
/*
* Copyright (c) 2009 - 2011 Reyk Floeter <reyk@openbsd.org>
@@ -97,8 +97,8 @@ sync_routes(struct relayd *env, struct router *rt)
memcpy(&crt.host, &host->conf, sizeof(host->conf));
memcpy(&crt.rt, &rt->rt_conf, sizeof(rt->rt_conf));
- proc_compose_imsg(env->sc_ps, PROC_PARENT, -1,
- IMSG_RTMSG, -1, &crt, sizeof(crt));
+ proc_compose(env->sc_ps, PROC_PARENT,
+ IMSG_RTMSG, &crt, sizeof(crt));
}
}
}
diff --git a/usr.sbin/relayd/proc.c b/usr.sbin/relayd/proc.c
index ab283e7615b..5d93bc1a041 100644
--- a/usr.sbin/relayd/proc.c
+++ b/usr.sbin/relayd/proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.c,v 1.24 2015/11/28 09:52:07 reyk Exp $ */
+/* $OpenBSD: proc.c,v 1.25 2015/12/02 13:41:27 reyk Exp $ */
/*
* Copyright (c) 2010 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -576,14 +576,14 @@ proc_range(struct privsep *ps, enum privsep_procid id, int *n, int *m)
int
proc_compose_imsg(struct privsep *ps, enum privsep_procid id, int n,
- uint16_t type, int fd, void *data, uint16_t datalen)
+ uint16_t type, uint32_t peerid, int fd, void *data, uint16_t datalen)
{
int m;
proc_range(ps, id, &n, &m);
for (; n < m; n++) {
if (imsg_compose_event(&ps->ps_ievs[id][n],
- type, -1, 0, fd, data, datalen) == -1)
+ type, peerid, 0, fd, data, datalen) == -1)
return (-1);
}
@@ -591,26 +591,40 @@ proc_compose_imsg(struct privsep *ps, enum privsep_procid id, int n,
}
int
+proc_compose(struct privsep *ps, enum privsep_procid id,
+ uint16_t type, void *data, uint16_t datalen)
+{
+ return (proc_compose_imsg(ps, id, -1, type, -1, -1, data, datalen));
+}
+
+int
proc_composev_imsg(struct privsep *ps, enum privsep_procid id, int n,
- uint16_t type, int fd, const struct iovec *iov, int iovcnt)
+ uint16_t type, uint32_t peerid, int fd, const struct iovec *iov, int iovcnt)
{
int m;
proc_range(ps, id, &n, &m);
for (; n < m; n++)
if (imsg_composev_event(&ps->ps_ievs[id][n],
- type, -1, 0, fd, iov, iovcnt) == -1)
+ type, peerid, 0, fd, iov, iovcnt) == -1)
return (-1);
return (0);
}
int
+proc_composev(struct privsep *ps, enum privsep_procid id,
+ uint16_t type, const struct iovec *iov, int iovcnt)
+{
+ return (proc_composev_imsg(ps, id, -1, type, -1, -1, iov, iovcnt));
+}
+
+int
proc_forward_imsg(struct privsep *ps, struct imsg *imsg,
enum privsep_procid id, int n)
{
return (proc_compose_imsg(ps, id, n, imsg->hdr.type,
- imsg->fd, imsg->data, IMSG_DATA_SIZE(imsg)));
+ imsg->hdr.peerid, imsg->fd, imsg->data, IMSG_DATA_SIZE(imsg)));
}
struct imsgbuf *
diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c
index 1bbc05b5c97..a6ffe040ba5 100644
--- a/usr.sbin/relayd/relay.c
+++ b/usr.sbin/relayd/relay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay.c,v 1.199 2015/11/28 09:52:07 reyk Exp $ */
+/* $OpenBSD: relay.c,v 1.200 2015/12/02 13:41:27 reyk Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -340,14 +340,13 @@ relay_init(struct privsep *ps, struct privsep_proc *p, void *arg)
void
relay_session_publish(struct rsession *s)
{
- proc_compose_imsg(env->sc_ps, PROC_PFE, -1, IMSG_SESS_PUBLISH, -1,
- s, sizeof(*s));
+ proc_compose(env->sc_ps, PROC_PFE, IMSG_SESS_PUBLISH, s, sizeof(*s));
}
void
relay_session_unpublish(struct rsession *s)
{
- proc_compose_imsg(env->sc_ps, PROC_PFE, -1, IMSG_SESS_UNPUBLISH, -1,
+ proc_compose(env->sc_ps, PROC_PFE, IMSG_SESS_UNPUBLISH,
&s->se_id, sizeof(s->se_id));
}
@@ -396,7 +395,7 @@ relay_statistics(int fd, short events, void *arg)
crs.id = rlay->rl_conf.id;
crs.proc = proc_id;
- proc_compose_imsg(env->sc_ps, PROC_PFE, -1, IMSG_STATISTICS, -1,
+ proc_compose(env->sc_ps, PROC_PFE, IMSG_STATISTICS,
&crs, sizeof(crs));
for (con = SPLAY_ROOT(&rlay->rl_sessions);
@@ -1153,7 +1152,7 @@ relay_accept(int fd, short event, void *arg)
return;
}
- proc_compose_imsg(env->sc_ps, PROC_PFE, -1, IMSG_NATLOOK, -1,
+ proc_compose(env->sc_ps, PROC_PFE, IMSG_NATLOOK,
cnl, sizeof(*cnl));
/* Schedule timeout */
@@ -1390,8 +1389,8 @@ relay_bindanyreq(struct rsession *con, in_port_t port, int proto)
bnd.bnd_port = port;
bnd.bnd_proto = proto;
bcopy(&con->se_in.ss, &bnd.bnd_ss, sizeof(bnd.bnd_ss));
- proc_compose_imsg(env->sc_ps, PROC_PARENT, -1, IMSG_BINDANY,
- -1, &bnd, sizeof(bnd));
+ proc_compose(env->sc_ps, PROC_PARENT, IMSG_BINDANY,
+ &bnd, sizeof(bnd));
/* Schedule timeout */
evtimer_set(&con->se_ev, relay_bindany, con);
@@ -1835,13 +1834,12 @@ relay_dispatch_pfe(int fd, struct privsep_proc *p, struct imsg *imsg)
&rlay->rl_sessions) {
memcpy(&se, con, sizeof(se));
se.se_cid = cid;
- proc_compose_imsg(env->sc_ps, p->p_id, -1,
- IMSG_CTL_SESSION,
- -1, &se, sizeof(se));
+ proc_compose(env->sc_ps, p->p_id,
+ IMSG_CTL_SESSION, &se, sizeof(se));
}
}
- proc_compose_imsg(env->sc_ps, p->p_id, -1, IMSG_CTL_END,
- -1, &cid, sizeof(cid));
+ proc_compose(env->sc_ps, p->p_id, IMSG_CTL_END,
+ &cid, sizeof(cid));
break;
default:
return (-1);
diff --git a/usr.sbin/relayd/relay_udp.c b/usr.sbin/relayd/relay_udp.c
index 94d85d9670e..e4167eb352c 100644
--- a/usr.sbin/relayd/relay_udp.c
+++ b/usr.sbin/relayd/relay_udp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay_udp.c,v 1.40 2015/11/28 09:52:07 reyk Exp $ */
+/* $OpenBSD: relay_udp.c,v 1.41 2015/12/02 13:41:27 reyk Exp $ */
/*
* Copyright (c) 2007 - 2013 Reyk Floeter <reyk@openbsd.org>
@@ -303,8 +303,8 @@ relay_udp_server(int fd, short sig, void *arg)
cnl->proto = IPPROTO_UDP;
bcopy(&con->se_in.ss, &cnl->src, sizeof(cnl->src));
bcopy(&rlay->rl_conf.ss, &cnl->dst, sizeof(cnl->dst));
- proc_compose_imsg(env->sc_ps, PROC_PFE, -1,
- IMSG_NATLOOK, -1, cnl, sizeof(*cnl));
+ proc_compose(env->sc_ps, PROC_PFE,
+ IMSG_NATLOOK, cnl, sizeof(*cnl));
/* Schedule timeout */
evtimer_set(&con->se_ev, relay_natlook, con);
diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c
index 588edb14cd9..97186aeac8f 100644
--- a/usr.sbin/relayd/relayd.c
+++ b/usr.sbin/relayd/relayd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.c,v 1.148 2015/11/29 01:20:33 benno Exp $ */
+/* $OpenBSD: relayd.c,v 1.149 2015/12/02 13:41:27 reyk Exp $ */
/*
* Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -345,8 +345,8 @@ parent_configure(struct relayd *env)
} else
s = -1;
- proc_compose_imsg(env->sc_ps, id, -1, IMSG_CFG_DONE, s,
- &cf, sizeof(cf));
+ proc_compose_imsg(env->sc_ps, id, -1, IMSG_CFG_DONE, -1,
+ s, &cf, sizeof(cf));
}
ret = 0;
@@ -405,8 +405,7 @@ parent_configure_done(struct relayd *env)
if (id == privsep_process)
continue;
- proc_compose_imsg(env->sc_ps, id, -1, IMSG_CTL_START,
- -1, NULL, 0);
+ proc_compose(env->sc_ps, id, IMSG_CTL_START, NULL, 0);
}
}
}
@@ -489,8 +488,7 @@ parent_dispatch_hce(int fd, struct privsep_proc *p, struct imsg *imsg)
IMSG_SIZE_CHECK(imsg, &scr);
bcopy(imsg->data, &scr, sizeof(scr));
scr.retval = script_exec(env, &scr);
- proc_compose_imsg(ps, PROC_HCE, -1, IMSG_SCRIPT,
- -1, &scr, sizeof(scr));
+ proc_compose(ps, PROC_HCE, IMSG_SCRIPT, &scr, sizeof(scr));
break;
case IMSG_CFG_DONE:
parent_configure_done(env);
@@ -528,7 +526,7 @@ parent_dispatch_relay(int fd, struct privsep_proc *p, struct imsg *imsg)
}
s = bindany(&bnd);
proc_compose_imsg(ps, PROC_RELAY, bnd.bnd_proc,
- IMSG_BINDANY, s, &bnd.bnd_id, sizeof(bnd.bnd_id));
+ IMSG_BINDANY, -1, s, &bnd.bnd_id, sizeof(bnd.bnd_id));
break;
case IMSG_CFG_DONE:
parent_configure_done(env);
diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h
index 71b4995fec8..6ff019ecd30 100644
--- a/usr.sbin/relayd/relayd.h
+++ b/usr.sbin/relayd/relayd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.h,v 1.219 2015/11/29 01:20:33 benno Exp $ */
+/* $OpenBSD: relayd.h,v 1.220 2015/12/02 13:41:27 reyk Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -1357,11 +1357,15 @@ pid_t proc_run(struct privsep *, struct privsep_proc *,
void (*)(struct privsep *, struct privsep_proc *, void *), void *);
void proc_range(struct privsep *, enum privsep_procid, int *, int *);
int proc_compose_imsg(struct privsep *, enum privsep_procid, int,
- u_int16_t, int, void *, u_int16_t);
+ u_int16_t, u_int32_t, int, void *, u_int16_t);
+int proc_compose(struct privsep *, enum privsep_procid,
+ uint16_t, void *, uint16_t);
int proc_composev_imsg(struct privsep *, enum privsep_procid, int,
- u_int16_t, int, const struct iovec *, int);
+ u_int16_t, u_int32_t, int, const struct iovec *, int);
int proc_forward_imsg(struct privsep *, struct imsg *,
enum privsep_procid, int);
+int proc_composev(struct privsep *, enum privsep_procid,
+ uint16_t, const struct iovec *, int);
struct imsgbuf *
proc_ibuf(struct privsep *, enum privsep_procid, int);
struct imsgev *
diff --git a/usr.sbin/relayd/snmp.c b/usr.sbin/relayd/snmp.c
index e889b0a43b7..6c3d3a69458 100644
--- a/usr.sbin/relayd/snmp.c
+++ b/usr.sbin/relayd/snmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snmp.c,v 1.24 2015/11/28 09:52:07 reyk Exp $ */
+/* $OpenBSD: snmp.c,v 1.25 2015/12/02 13:41:27 reyk Exp $ */
/*
* Copyright (c) 2008 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -134,8 +134,7 @@ snmp_init(struct relayd *env, enum privsep_procid id)
snmp_procid = id;
- proc_compose_imsg(env->sc_ps, snmp_procid, -1,
- IMSG_SNMPSOCK, -1, NULL, 0);
+ proc_compose(env->sc_ps, snmp_procid, IMSG_SNMPSOCK, NULL, 0);
}
void
@@ -158,7 +157,7 @@ snmp_setsock(struct relayd *env, enum privsep_procid id)
s = -1;
}
done:
- proc_compose_imsg(env->sc_ps, id, -1, IMSG_SNMPSOCK, s, NULL, 0);
+ proc_compose_imsg(env->sc_ps, id, -1, IMSG_SNMPSOCK, -1, s, NULL, 0);
}
int
@@ -243,8 +242,7 @@ snmp_sock(int fd, short event, void *arg)
env->sc_snmp = -1;
snmp_agentx = NULL;
reopen:
- proc_compose_imsg(env->sc_ps, snmp_procid, -1,
- IMSG_SNMPSOCK, -1, NULL, 0);
+ proc_compose(env->sc_ps, snmp_procid, IMSG_SNMPSOCK, NULL, 0);
return;
}
@@ -272,8 +270,7 @@ snmp_agentx_process(struct agentx_handle *h, struct agentx_pdu *pdu, void *arg)
snmp_agentx_free(snmp_agentx);
env->sc_snmp = -1;
snmp_agentx = NULL;
- proc_compose_imsg(env->sc_ps, snmp_procid, -1,
- IMSG_SNMPSOCK, -1, NULL, 0);
+ proc_compose(env->sc_ps, snmp_procid, IMSG_SNMPSOCK, NULL, 0);
break;
case AGENTX_GET_BULK: