summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-09-16 17:36:30 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-09-16 17:36:30 +0000
commit7744c2a5861ec0155d946082214e3df104d5bd55 (patch)
treec9fdda2bd918ffbef7c51992d7c8ea41ed68dd46 /usr.sbin
parent7a3af50607a1ab6f9cbd52b9d0e81f24a47ba672 (diff)
imsg API cleanup:
-kill imsg_compose_pid, imsg_compose_fdpass and imsg_create_pid -extend the original imsg_compose/_create API to take pid & fd too -make imsg_compose do imsg_create + imsg_add + imsg_close instead of duplicating the code -adjust all callers to the new API ok claudio
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/bgpd.c22
-rw-r--r--usr.sbin/bgpd/bgpd.h11
-rw-r--r--usr.sbin/bgpd/control.c4
-rw-r--r--usr.sbin/bgpd/imsg.c93
-rw-r--r--usr.sbin/bgpd/mrt.c4
-rw-r--r--usr.sbin/bgpd/rde.c43
-rw-r--r--usr.sbin/bgpd/session.c14
7 files changed, 64 insertions, 127 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c
index 5355de60b48..35882b6bd07 100644
--- a/usr.sbin/bgpd/bgpd.c
+++ b/usr.sbin/bgpd/bgpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.c,v 1.107 2004/09/16 00:25:12 henning Exp $ */
+/* $OpenBSD: bgpd.c,v 1.108 2004/09/16 17:36:29 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -388,32 +388,32 @@ reconfigure(char *conffile, struct bgpd_config *conf, struct mrt_head *mrt_l,
prepare_listeners(conf);
- if (imsg_compose(ibuf_se, IMSG_RECONF_CONF, 0,
+ if (imsg_compose(ibuf_se, IMSG_RECONF_CONF, 0, 0, -1,
conf, sizeof(struct bgpd_config)) == -1)
return (-1);
- if (imsg_compose(ibuf_rde, IMSG_RECONF_CONF, 0,
+ if (imsg_compose(ibuf_rde, IMSG_RECONF_CONF, 0, 0, -1,
conf, sizeof(struct bgpd_config)) == -1)
return (-1);
for (p = *peer_l; p != NULL; p = p->next)
- if (imsg_compose(ibuf_se, IMSG_RECONF_PEER, p->conf.id,
+ if (imsg_compose(ibuf_se, IMSG_RECONF_PEER, p->conf.id, 0, -1,
&p->conf, sizeof(struct peer_config)) == -1)
return (-1);
while ((n = TAILQ_FIRST(&net_l)) != NULL) {
- if (imsg_compose(ibuf_rde, IMSG_NETWORK_ADD, 0,
+ if (imsg_compose(ibuf_rde, IMSG_NETWORK_ADD, 0, 0, -1,
&n->net, sizeof(struct network_config)) == -1)
return (-1);
TAILQ_REMOVE(&net_l, n, entry);
free(n);
}
while ((r = TAILQ_FIRST(rules_l)) != NULL) {
- if (imsg_compose(ibuf_rde, IMSG_RECONF_FILTER, 0,
+ if (imsg_compose(ibuf_rde, IMSG_RECONF_FILTER, 0, 0, -1,
r, sizeof(struct filter_rule)) == -1)
return (-1);
TAILQ_REMOVE(rules_l, r, entry);
free(r);
}
while ((la = TAILQ_FIRST(conf->listen_addrs)) != NULL) {
- if (imsg_compose_fdpass(ibuf_se, IMSG_RECONF_LISTENER, la->fd,
+ if (imsg_compose(ibuf_se, IMSG_RECONF_LISTENER, 0, 0, la->fd,
la, sizeof(struct listen_addr)) == -1)
return (-1);
TAILQ_REMOVE(conf->listen_addrs, la, entry);
@@ -422,8 +422,8 @@ reconfigure(char *conffile, struct bgpd_config *conf, struct mrt_head *mrt_l,
free(conf->listen_addrs);
conf->listen_addrs = NULL;
- if (imsg_compose(ibuf_se, IMSG_RECONF_DONE, 0, NULL, 0) == -1 ||
- imsg_compose(ibuf_rde, IMSG_RECONF_DONE, 0, NULL, 0) == -1)
+ if (imsg_compose(ibuf_se, IMSG_RECONF_DONE, 0, 0, -1, NULL, 0) == -1 ||
+ imsg_compose(ibuf_rde, IMSG_RECONF_DONE, 0, 0, -1, NULL, 0) == -1)
return (-1);
/* mrt changes can be sent out of bound */
@@ -568,7 +568,7 @@ send_nexthop_update(struct kroute_nexthop *msg)
free(gw);
- if (imsg_compose(ibuf_rde, IMSG_NEXTHOP_UPDATE, 0,
+ if (imsg_compose(ibuf_rde, IMSG_NEXTHOP_UPDATE, 0, 0, -1,
msg, sizeof(struct kroute_nexthop)) == -1)
quit = 1;
}
@@ -576,5 +576,5 @@ send_nexthop_update(struct kroute_nexthop *msg)
void
send_imsg_session(int type, pid_t pid, void *data, u_int16_t datalen)
{
- imsg_compose_pid(ibuf_se, type, pid, data, datalen);
+ imsg_compose(ibuf_se, type, 0, pid, -1, data, datalen);
}
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index be066486916..9a21378907e 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.141 2004/08/20 15:49:02 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.142 2004/09/16 17:36:29 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -595,11 +595,10 @@ int host(const char *, struct bgpd_addr *, u_int8_t *);
void imsg_init(struct imsgbuf *, int);
int imsg_read(struct imsgbuf *);
int imsg_get(struct imsgbuf *, struct imsg *);
-int imsg_compose(struct imsgbuf *, int, u_int32_t, void *, u_int16_t);
-int imsg_compose_pid(struct imsgbuf *, int, pid_t, void *, u_int16_t);
-int imsg_compose_fdpass(struct imsgbuf *, int, int, void *, u_int16_t);
-struct buf *imsg_create(struct imsgbuf *, int, u_int32_t, u_int16_t);
-struct buf *imsg_create_pid(struct imsgbuf *, int, pid_t, u_int16_t);
+int imsg_compose(struct imsgbuf *, int, u_int32_t, pid_t, int,
+ void *, u_int16_t);
+struct buf *imsg_create(struct imsgbuf *, int, u_int32_t, pid_t,
+ u_int16_t);
int imsg_add(struct buf *, void *, u_int16_t);
int imsg_close(struct imsgbuf *, struct buf *);
void imsg_free(struct imsg *);
diff --git a/usr.sbin/bgpd/control.c b/usr.sbin/bgpd/control.c
index c08906e9322..1058aae6a8c 100644
--- a/usr.sbin/bgpd/control.c
+++ b/usr.sbin/bgpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.37 2004/08/24 12:43:34 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.38 2004/09/16 17:36:29 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -307,6 +307,6 @@ control_imsg_relay(struct imsg *imsg)
if ((c = control_connbypid(imsg->hdr.pid)) == NULL)
return (0);
- return (imsg_compose_pid(&c->ibuf, imsg->hdr.type, imsg->hdr.pid,
+ return (imsg_compose(&c->ibuf, imsg->hdr.type, 0, imsg->hdr.pid, -1,
imsg->data, imsg->hdr.len - IMSG_HEADER_SIZE));
}
diff --git a/usr.sbin/bgpd/imsg.c b/usr.sbin/bgpd/imsg.c
index 9235a78a84e..dd1eb7eb746 100644
--- a/usr.sbin/bgpd/imsg.c
+++ b/usr.sbin/bgpd/imsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg.c,v 1.30 2004/08/19 10:40:14 henning Exp $ */
+/* $OpenBSD: imsg.c,v 1.31 2004/09/16 17:36:29 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -26,11 +26,6 @@
#include "bgpd.h"
-int imsg_compose_core(struct imsgbuf *, int, u_int32_t, void *,
- u_int16_t, pid_t, int);
-struct buf *imsg_create_core(struct imsgbuf *, int, u_int32_t, u_int16_t,
- pid_t);
-
void
imsg_init(struct imsgbuf *ibuf, int fd)
{
@@ -127,93 +122,34 @@ imsg_get(struct imsgbuf *ibuf, struct imsg *imsg)
}
int
-imsg_compose(struct imsgbuf *ibuf, int type, u_int32_t peerid, void *data,
- u_int16_t datalen)
-{
- return (imsg_compose_core(ibuf, type, peerid, data, datalen,
- ibuf->pid, -1));
-}
-
-int
-imsg_compose_pid(struct imsgbuf *ibuf, int type, pid_t pid, void *data,
- u_int16_t datalen)
-{
- return (imsg_compose_core(ibuf, type, 0, data, datalen, pid, -1));
-}
-
-int
-imsg_compose_fdpass(struct imsgbuf *ibuf, int type, int fd, void *data,
- u_int16_t datalen)
-{
- return (imsg_compose_core(ibuf, type, 0, data, datalen, ibuf->pid, fd));
-}
-
-int
-imsg_compose_core(struct imsgbuf *ibuf, int type, u_int32_t peerid, void *data,
- u_int16_t datalen, pid_t pid, int fd)
+imsg_compose(struct imsgbuf *ibuf, int type, u_int32_t peerid, pid_t pid,
+ int fd, void *data, u_int16_t datalen)
{
struct buf *wbuf;
- struct imsg_hdr hdr;
int n;
- if (datalen + IMSG_HEADER_SIZE > MAX_IMSGSIZE) {
- log_warnx("imsg_compose_core: len %u > MAX_IMSGSIZE; "
- "type %u peerid %lu", datalen + IMSG_HEADER_SIZE,
- type, peerid);
+ if ((wbuf = imsg_create(ibuf, type, peerid, pid, datalen)) == NULL)
return (-1);
- }
- hdr.len = datalen + IMSG_HEADER_SIZE;
- hdr.type = type;
- hdr.peerid = peerid;
- hdr.pid = pid;
- wbuf = buf_open(hdr.len);
- if (wbuf == NULL) {
- log_warn("imsg_compose: buf_open");
- return (-1);
- }
- if (buf_add(wbuf, &hdr, sizeof(hdr)) == -1) {
- log_warnx("imsg_compose: buf_add error");
- buf_free(wbuf);
+ if (imsg_add(wbuf, data, datalen) == -1)
return (-1);
- }
- if (datalen)
- if (buf_add(wbuf, data, datalen) == -1) {
- log_warnx("imsg_compose: buf_add error");
- buf_free(wbuf);
- return (-1);
- }
wbuf->fd = fd;
- if ((n = buf_close(&ibuf->w, wbuf)) < 0) {
- log_warnx("imsg_compose: buf_add error");
- buf_free(wbuf);
+ if ((n = imsg_close(ibuf, wbuf)) < 0)
return (-1);
- }
- return (n);
-}
-struct buf *
-imsg_create(struct imsgbuf *ibuf, int type, u_int32_t peerid, u_int16_t dlen)
-{
- return (imsg_create_core(ibuf, type, peerid, dlen, ibuf->pid));
-}
-
-struct buf *
-imsg_create_pid(struct imsgbuf *ibuf, int type, pid_t pid, u_int16_t datalen)
-{
- return (imsg_create_core(ibuf, type, 0, datalen, pid));
+ return (n);
}
struct buf *
-imsg_create_core(struct imsgbuf *ibuf, int type, u_int32_t peerid,
- u_int16_t datalen, pid_t pid)
+imsg_create(struct imsgbuf *ibuf, int type, u_int32_t peerid,
+ pid_t pid, u_int16_t datalen)
{
struct buf *wbuf;
struct imsg_hdr hdr;
- if (datalen + IMSG_HEADER_SIZE > MAX_IMSGSIZE) {
+ if (datalen > MAX_IMSGSIZE - IMSG_HEADER_SIZE) {
log_warnx("imsg_create_core: len %u > MAX_IMSGSIZE; "
"type %u peerid %lu", datalen + IMSG_HEADER_SIZE,
type, peerid);
@@ -224,16 +160,13 @@ imsg_create_core(struct imsgbuf *ibuf, int type, u_int32_t peerid,
hdr.type = type;
hdr.peerid = peerid;
hdr.pid = pid;
- wbuf = buf_open(hdr.len);
- if (wbuf == NULL) {
+ if ((wbuf = buf_open(hdr.len)) == NULL) {
log_warn("imsg_create: buf_open");
return (NULL);
}
- if (buf_add(wbuf, &hdr, sizeof(hdr)) == -1) {
- log_warnx("imsg_create: buf_add error");
- buf_free(wbuf);
+ if (imsg_add(wbuf, &hdr, sizeof(hdr)) == -1)
return (NULL);
- }
+
return (wbuf);
}
diff --git a/usr.sbin/bgpd/mrt.c b/usr.sbin/bgpd/mrt.c
index f214782554e..b9db71fca52 100644
--- a/usr.sbin/bgpd/mrt.c
+++ b/usr.sbin/bgpd/mrt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mrt.c,v 1.44 2004/08/13 14:03:20 claudio Exp $ */
+/* $OpenBSD: mrt.c,v 1.45 2004/09/16 17:36:29 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -598,7 +598,7 @@ mrt_open(struct mrt *mrt, time_t now)
i = mrt->type == MRT_TABLE_DUMP ? 0 : 1;
- if (imsg_compose_fdpass(mrt_imsgbuf[i], type, mrt->fd,
+ if (imsg_compose(mrt_imsgbuf[i], type, 0, 0, mrt->fd,
mrt, sizeof(struct mrt)) == -1)
log_warn("mrt_open");
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index 1d19ae83417..406dba8fc72 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.143 2004/09/16 00:25:12 henning Exp $ */
+/* $OpenBSD: rde.c,v 1.144 2004/09/16 17:36:29 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -336,7 +336,8 @@ rde_dispatch_imsg_session(struct imsgbuf *ibuf)
}
pid = imsg.hdr.pid;
pt_dump(network_dump_upcall, &pid, AF_UNSPEC);
- imsg_compose_pid(ibuf_se, IMSG_CTL_END, pid, NULL, 0);
+ imsg_compose(ibuf_se, IMSG_CTL_END, 0, pid, -1,
+ NULL, 0);
break;
case IMSG_CTL_SHOW_RIB:
if (imsg.hdr.len != IMSG_HEADER_SIZE) {
@@ -345,7 +346,8 @@ rde_dispatch_imsg_session(struct imsgbuf *ibuf)
}
pid = imsg.hdr.pid;
pt_dump(rde_dump_upcall, &pid, AF_UNSPEC);
- imsg_compose_pid(ibuf_se, IMSG_CTL_END, pid, NULL, 0);
+ imsg_compose(ibuf_se, IMSG_CTL_END, 0, pid, -1,
+ NULL, 0);
break;
case IMSG_CTL_SHOW_RIB_AS:
if (imsg.hdr.len - IMSG_HEADER_SIZE !=
@@ -355,7 +357,8 @@ rde_dispatch_imsg_session(struct imsgbuf *ibuf)
}
pid = imsg.hdr.pid;
rde_dump_as(imsg.data, pid);
- imsg_compose_pid(ibuf_se, IMSG_CTL_END, pid, NULL, 0);
+ imsg_compose(ibuf_se, IMSG_CTL_END, 0, pid, -1,
+ NULL, 0);
break;
case IMSG_CTL_SHOW_RIB_PREFIX:
if (imsg.hdr.len - IMSG_HEADER_SIZE !=
@@ -365,7 +368,8 @@ rde_dispatch_imsg_session(struct imsgbuf *ibuf)
}
pid = imsg.hdr.pid;
rde_dump_prefix(imsg.data, pid);
- imsg_compose_pid(ibuf_se, IMSG_CTL_END, pid, NULL, 0);
+ imsg_compose(ibuf_se, IMSG_CTL_END, 0, pid, -1,
+ NULL, 0);
break;
case IMSG_CTL_SHOW_NEIGHBOR:
if (imsg.hdr.len - IMSG_HEADER_SIZE !=
@@ -377,12 +381,12 @@ rde_dispatch_imsg_session(struct imsgbuf *ibuf)
peer = peer_get(p.conf.id);
if (peer != NULL)
p.stats.prefix_cnt = peer->prefix_cnt;
- imsg_compose_pid(ibuf_se, IMSG_CTL_SHOW_NEIGHBOR,
- imsg.hdr.pid, &p, sizeof(struct peer));
+ imsg_compose(ibuf_se, IMSG_CTL_SHOW_NEIGHBOR, 0,
+ imsg.hdr.pid, -1, &p, sizeof(struct peer));
break;
case IMSG_CTL_END:
- imsg_compose_pid(ibuf_se, IMSG_CTL_END, imsg.hdr.pid,
- NULL, 0);
+ imsg_compose(ibuf_se, IMSG_CTL_END, 0, imsg.hdr.pid,
+ -1, NULL, 0);
break;
default:
break;
@@ -1316,7 +1320,7 @@ rde_update_err(struct rde_peer *peer, u_int8_t error, u_int8_t suberr,
{
struct buf *wbuf;
- if ((wbuf = imsg_create(ibuf_se, IMSG_UPDATE_ERR, peer->conf.id,
+ if ((wbuf = imsg_create(ibuf_se, IMSG_UPDATE_ERR, peer->conf.id, 0,
size + sizeof(error) + sizeof(suberr))) == NULL)
fatal("imsg_create error");
if (imsg_add(wbuf, &error, sizeof(error)) == -1 ||
@@ -1438,7 +1442,7 @@ rde_dump_rib_as(struct prefix *p, pid_t pid)
rib.flags |= F_RIB_ELIGIBLE;
rib.aspath_len = aspath_length(p->aspath->aspath);
- if ((wbuf = imsg_create_pid(ibuf_se, IMSG_CTL_SHOW_RIB, pid,
+ if ((wbuf = imsg_create(ibuf_se, IMSG_CTL_SHOW_RIB, 0, pid,
sizeof(rib) + rib.aspath_len)) == NULL)
return;
if (imsg_add(wbuf, &rib, sizeof(rib)) == -1 ||
@@ -1467,7 +1471,7 @@ rde_dump_rib_prefix(struct prefix *p, pid_t pid)
if (p->aspath->nexthop == NULL ||
p->aspath->nexthop->state == NEXTHOP_REACH)
prefix.flags |= F_RIB_ELIGIBLE;
- if (imsg_compose_pid(ibuf_se, IMSG_CTL_SHOW_RIB_PREFIX, pid,
+ if (imsg_compose(ibuf_se, IMSG_CTL_SHOW_RIB_PREFIX, 0, pid, -1,
&prefix, sizeof(prefix)) == -1)
log_warnx("rde_dump_as: imsg_compose error");
}
@@ -1592,7 +1596,7 @@ rde_send_kroute(struct prefix *new, struct prefix *old)
if (p->aspath->flags & F_NEXTHOP_BLACKHOLE)
kr.flags |= F_BLACKHOLE;
- if (imsg_compose(ibuf_main, type, 0, &kr, sizeof(kr)) == -1)
+ if (imsg_compose(ibuf_main, type, 0, 0, -1, &kr, sizeof(kr)) == -1)
fatal("imsg_compose error");
}
@@ -1615,14 +1619,15 @@ rde_send_pftable(const char *table, struct bgpd_addr *addr,
if (imsg_compose(ibuf_main,
del ? IMSG_PFTABLE_REMOVE : IMSG_PFTABLE_ADD,
- 0, &pfm, sizeof(pfm)) == -1)
+ 0, 0, -1, &pfm, sizeof(pfm)) == -1)
fatal("imsg_compose error");
}
void
rde_send_pftable_commit(void)
{
- if (imsg_compose(ibuf_main, IMSG_PFTABLE_COMMIT, 0, NULL, 0) == -1)
+ if (imsg_compose(ibuf_main, IMSG_PFTABLE_COMMIT, 0, 0, -1, NULL, 0) ==
+ -1)
fatal("imsg_compose error");
}
@@ -1642,7 +1647,7 @@ rde_send_nexthop(struct bgpd_addr *next, int valid)
size = sizeof(struct bgpd_addr);
- if (imsg_compose(ibuf_main, type, 0, next,
+ if (imsg_compose(ibuf_main, type, 0, 0, -1, next,
sizeof(struct bgpd_addr)) == -1)
fatal("imsg_compose error");
}
@@ -1710,7 +1715,7 @@ rde_update_queue_runner(void)
/* finally send message to SE */
if (imsg_compose(ibuf_se, IMSG_UPDATE, peer->conf.id,
- queue_buf, wpos) == -1)
+ 0, -1, queue_buf, wpos) == -1)
fatal("imsg_compose error");
sent++;
}
@@ -1985,8 +1990,8 @@ network_dump_upcall(struct pt_entry *pt, void *ptr)
k.prefixlen = p->prefix->prefixlen;
if (p->peer == &peerself)
k.flags = F_KERNEL;
- if (imsg_compose_pid(ibuf_se, IMSG_CTL_SHOW_NETWORK, pid,
- &k, sizeof(k)) == -1)
+ if (imsg_compose(ibuf_se, IMSG_CTL_SHOW_NETWORK, 0, pid,
+ -1, &k, sizeof(k)) == -1)
log_warnx("network_dump_upcall: "
"imsg_compose error");
}
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 30f4a4237d8..15cf0e7d94e 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.190 2004/09/16 00:25:12 henning Exp $ */
+/* $OpenBSD: session.c,v 1.191 2004/09/16 17:36:29 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -1807,7 +1807,7 @@ parse_update(struct peer *peer)
p += MSGSIZE_HEADER; /* header is already checked */
datalen -= MSGSIZE_HEADER;
- if (imsg_compose(ibuf_rde, IMSG_UPDATE, peer->conf.id, p,
+ if (imsg_compose(ibuf_rde, IMSG_UPDATE, peer->conf.id, 0, -1, p,
datalen) == -1)
return (-1);
@@ -1834,7 +1834,7 @@ parse_refresh(struct peer *peer)
/* afi/safi unchecked - unrecognized values will be ignored anyway */
- if (imsg_compose(ibuf_rde, IMSG_REFRESH, peer->conf.id, &r,
+ if (imsg_compose(ibuf_rde, IMSG_REFRESH, peer->conf.id, 0, -1, &r,
sizeof(r)) == -1)
return (-1);
@@ -2442,7 +2442,7 @@ void
session_down(struct peer *peer)
{
peer->stats.last_updown = time(NULL);
- if (imsg_compose(ibuf_rde, IMSG_SESSION_DOWN, peer->conf.id,
+ if (imsg_compose(ibuf_rde, IMSG_SESSION_DOWN, peer->conf.id, 0, -1,
NULL, 0) == -1)
fatalx("imsg_compose error");
}
@@ -2481,7 +2481,7 @@ session_up(struct peer *peer)
memcpy(&sup.conf, &peer->conf, sizeof(sup.conf));
peer->stats.last_updown = time(NULL);
- if (imsg_compose(ibuf_rde, IMSG_SESSION_UP, peer->conf.id,
+ if (imsg_compose(ibuf_rde, IMSG_SESSION_UP, peer->conf.id, 0, -1,
&sup, sizeof(sup)) == -1)
fatalx("imsg_compose error");
}
@@ -2489,13 +2489,13 @@ session_up(struct peer *peer)
int
imsg_compose_parent(int type, pid_t pid, void *data, u_int16_t datalen)
{
- return (imsg_compose_pid(ibuf_main, type, pid, data, datalen));
+ return (imsg_compose(ibuf_main, type, 0, pid, -1, data, datalen));
}
int
imsg_compose_rde(int type, pid_t pid, void *data, u_int16_t datalen)
{
- return (imsg_compose_pid(ibuf_rde, type, pid, data, datalen));
+ return (imsg_compose(ibuf_rde, type, 0, pid, -1, data, datalen));
}
static struct sockaddr *