summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-02-10 18:30:48 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-02-10 18:30:48 +0000
commit669af21c09fe261cd22adead055b6253a4671e8a (patch)
tree263e3a666b43d4bd33bb19aeb723212478e18225
parent69b70ba469801499e8fa692600914070c7ff055b (diff)
ospfd does not need fd passing via the imsg framework so remove that code
and remove other unneeded functions that are only used in bgpd.
-rw-r--r--usr.sbin/ospfd/buffer.c80
-rw-r--r--usr.sbin/ospfd/control.c6
-rw-r--r--usr.sbin/ospfd/imsg.c46
-rw-r--r--usr.sbin/ospfd/lsreq.c5
-rw-r--r--usr.sbin/ospfd/lsupdate.c4
-rw-r--r--usr.sbin/ospfd/ospfd.c8
-rw-r--r--usr.sbin/ospfd/ospfd.h17
-rw-r--r--usr.sbin/ospfd/ospfe.c18
-rw-r--r--usr.sbin/ospfd/rde.c53
9 files changed, 59 insertions, 178 deletions
diff --git a/usr.sbin/ospfd/buffer.c b/usr.sbin/ospfd/buffer.c
index f2a3ad54fa6..636a8e519c6 100644
--- a/usr.sbin/ospfd/buffer.c
+++ b/usr.sbin/ospfd/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.7 2005/08/11 16:28:07 henning Exp $ */
+/* $OpenBSD: buffer.c,v 1.8 2006/02/10 18:30:47 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -44,7 +44,6 @@ buf_open(size_t len)
return (NULL);
}
buf->size = buf->max = len;
- buf->fd = -1;
return (buf);
}
@@ -129,32 +128,6 @@ buf_close(struct msgbuf *msgbuf, struct buf *buf)
return (1);
}
-int
-buf_write(int sock, struct buf *buf)
-{
- ssize_t n;
-
- if ((n = write(sock, buf->buf + buf->rpos,
- buf->size - buf->rpos)) == -1) {
- if (errno == EAGAIN || errno == ENOBUFS ||
- errno == EINTR) /* try later */
- return (0);
- else
- return (-1);
- }
-
- if (n == 0) { /* connection closed */
- errno = 0;
- return (-2);
- }
-
- if (buf->rpos + n < buf->size) { /* not all data written yet */
- buf->rpos += n;
- return (0);
- } else
- return (1);
-}
-
void
buf_free(struct buf *buf)
{
@@ -187,8 +160,6 @@ msgbuf_write(struct msgbuf *msgbuf)
int i = 0;
ssize_t n;
struct msghdr msg;
- struct cmsghdr *cmsg;
- char cmsgbuf[CMSG_SPACE(sizeof(int))];
bzero(&iov, sizeof(iov));
bzero(&msg, sizeof(msg));
@@ -198,23 +169,11 @@ msgbuf_write(struct msgbuf *msgbuf)
iov[i].iov_base = buf->buf + buf->rpos;
iov[i].iov_len = buf->size - buf->rpos;
i++;
- if (buf->fd != -1)
- break;
}
msg.msg_iov = iov;
msg.msg_iovlen = i;
- if (buf != NULL && buf->fd != -1) {
- msg.msg_control = (caddr_t)cmsgbuf;
- msg.msg_controllen = CMSG_LEN(sizeof(int));
- cmsg = CMSG_FIRSTHDR(&msg);
- cmsg->cmsg_len = CMSG_LEN(sizeof(int));
- cmsg->cmsg_level = SOL_SOCKET;
- cmsg->cmsg_type = SCM_RIGHTS;
- *(int *)CMSG_DATA(cmsg) = buf->fd;
- }
-
if ((n = sendmsg(msgbuf->fd, &msg, 0)) == -1) {
if (errno == EAGAIN || errno == ENOBUFS ||
errno == EINTR) /* try later */
@@ -243,39 +202,6 @@ msgbuf_write(struct msgbuf *msgbuf)
return (0);
}
-int
-msgbuf_writebound(struct msgbuf *msgbuf)
-{
- struct buf *buf;
- int n;
-
- if (!msgbuf_unbounded(msgbuf))
- return (1);
-
- buf = TAILQ_FIRST(&msgbuf->bufs);
- if ((n = buf_write(msgbuf->fd, buf)) < 0)
- return (n);
-
- if (n == 1) { /* everything written out */
- buf_dequeue(msgbuf, buf);
- return (1);
- } else
- return (0);
-}
-
-int
-msgbuf_unbounded(struct msgbuf *msgbuf)
-{
- struct buf *buf;
-
- /* return 1 if last buffer was not completely written. */
- buf = TAILQ_FIRST(&msgbuf->bufs);
- if (buf != NULL && buf->rpos != 0)
- return (1);
- else
- return (0);
-}
-
void
buf_enqueue(struct msgbuf *msgbuf, struct buf *buf)
{
@@ -287,10 +213,6 @@ void
buf_dequeue(struct msgbuf *msgbuf, struct buf *buf)
{
TAILQ_REMOVE(&msgbuf->bufs, buf, entry);
-
- if (buf->fd != -1)
- close(buf->fd);
-
msgbuf->queued--;
buf_free(buf);
}
diff --git a/usr.sbin/ospfd/control.c b/usr.sbin/ospfd/control.c
index 319ada77571..b832f4657d4 100644
--- a/usr.sbin/ospfd/control.c
+++ b/usr.sbin/ospfd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.12 2005/10/18 15:42:15 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.13 2006/02/10 18:30:47 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -241,7 +241,7 @@ control_dispatch_imsg(int fd, short event, void *bula)
memcpy(&ifidx, imsg.data, sizeof(ifidx));
ospfe_iface_ctl(c, ifidx);
imsg_compose(&c->ibuf, IMSG_CTL_END, 0,
- 0, -1, NULL, 0);
+ 0, NULL, 0);
}
break;
case IMSG_CTL_SHOW_DATABASE:
@@ -281,7 +281,7 @@ control_imsg_relay(struct imsg *imsg)
return (0);
}
- return (imsg_compose(&c->ibuf, imsg->hdr.type, 0, imsg->hdr.pid, -1,
+ return (imsg_compose(&c->ibuf, imsg->hdr.type, 0, imsg->hdr.pid,
imsg->data, imsg->hdr.len - IMSG_HEADER_SIZE));
}
diff --git a/usr.sbin/ospfd/imsg.c b/usr.sbin/ospfd/imsg.c
index b4270db7a2a..8fded0d56a9 100644
--- a/usr.sbin/ospfd/imsg.c
+++ b/usr.sbin/ospfd/imsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg.c,v 1.5 2006/02/01 18:31:47 norby Exp $ */
+/* $OpenBSD: imsg.c,v 1.6 2006/02/10 18:30:47 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -39,26 +39,13 @@ imsg_init(struct imsgbuf *ibuf, int fd, void (*handler)(int, short, void *))
TAILQ_INIT(&ibuf->fds);
}
-int
+ssize_t
imsg_read(struct imsgbuf *ibuf)
{
- struct msghdr msg;
- struct cmsghdr *cmsg;
- char cmsgbuf[CMSG_SPACE(sizeof(int) * 16)];
- struct iovec iov;
ssize_t n;
- int fd;
- struct imsg_fd *ifd;
-
- bzero(&msg, sizeof(msg));
- iov.iov_base = ibuf->r.buf + ibuf->r.wpos;
- iov.iov_len = sizeof(ibuf->r.buf) - ibuf->r.wpos;
- msg.msg_iov = &iov;
- msg.msg_iovlen = 1;
- msg.msg_control = cmsgbuf;
- msg.msg_controllen = sizeof(cmsgbuf);
-
- if ((n = recvmsg(ibuf->fd, &msg, 0)) == -1) {
+
+ if ((n = recv(ibuf->fd, ibuf->r.buf + ibuf->r.wpos,
+ sizeof(ibuf->r.buf) - ibuf->r.wpos, 0)) == -1) {
if (errno != EINTR && errno != EAGAIN) {
log_warn("imsg_read: pipe read error");
return (-1);
@@ -68,24 +55,10 @@ imsg_read(struct imsgbuf *ibuf)
ibuf->r.wpos += n;
- for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL;
- cmsg = CMSG_NXTHDR(&msg, cmsg)) {
- if (cmsg->cmsg_level == SOL_SOCKET &&
- cmsg->cmsg_type == SCM_RIGHTS) {
- fd = (*(int *)CMSG_DATA(cmsg));
- if ((ifd = calloc(1, sizeof(struct imsg_fd))) == NULL)
- fatal("imsg_read calloc");
- ifd->fd = fd;
- TAILQ_INSERT_TAIL(&ibuf->fds, ifd, entry);
- } else
- log_warn("imsg_read: got unexpected ctl data level %d "
- "type %d", cmsg->cmsg_level, cmsg->cmsg_type);
- }
-
return (n);
}
-int
+ssize_t
imsg_get(struct imsgbuf *ibuf, struct imsg *imsg)
{
size_t av, left, datalen;
@@ -124,7 +97,7 @@ imsg_get(struct imsgbuf *ibuf, struct imsg *imsg)
int
imsg_compose(struct imsgbuf *ibuf, enum imsg_type type, u_int32_t peerid,
- pid_t pid, int fd, void *data, u_int16_t datalen)
+ pid_t pid, void *data, u_int16_t datalen)
{
struct buf *wbuf;
int n;
@@ -135,14 +108,13 @@ imsg_compose(struct imsgbuf *ibuf, enum imsg_type type, u_int32_t peerid,
if (imsg_add(wbuf, data, datalen) == -1)
return (-1);
- wbuf->fd = fd;
-
if ((n = imsg_close(ibuf, wbuf)) < 0)
return (-1);
return (n);
}
+/* ARGSUSED */
struct buf *
imsg_create(struct imsgbuf *ibuf, enum imsg_type type, u_int32_t peerid,
pid_t pid, u_int16_t datalen)
@@ -157,7 +129,7 @@ imsg_create(struct imsgbuf *ibuf, enum imsg_type type, u_int32_t peerid,
return (NULL);
}
- hdr.len = datalen + IMSG_HEADER_SIZE;
+ hdr.len = (u_int16_t)(datalen + IMSG_HEADER_SIZE);
hdr.type = type;
hdr.peerid = peerid;
hdr.pid = pid;
diff --git a/usr.sbin/ospfd/lsreq.c b/usr.sbin/ospfd/lsreq.c
index 86076f77364..882d4cebd4a 100644
--- a/usr.sbin/ospfd/lsreq.c
+++ b/usr.sbin/ospfd/lsreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lsreq.c,v 1.11 2005/12/15 20:39:33 claudio Exp $ */
+/* $OpenBSD: lsreq.c,v 1.12 2006/02/10 18:30:47 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -107,8 +107,7 @@ recv_ls_req(struct nbr *nbr, char *buf, u_int16_t len)
case NBR_STA_XCHNG:
case NBR_STA_LOAD:
case NBR_STA_FULL:
- imsg_compose(ibuf_rde, IMSG_LS_REQ, nbr->peerid, 0, -1,
- buf, len);
+ imsg_compose(ibuf_rde, IMSG_LS_REQ, nbr->peerid, 0, buf, len);
break;
default:
fatalx("recv_ls_req: unknown neighbor state");
diff --git a/usr.sbin/ospfd/lsupdate.c b/usr.sbin/ospfd/lsupdate.c
index 9a4d3e95901..4d63b9c3bec 100644
--- a/usr.sbin/ospfd/lsupdate.c
+++ b/usr.sbin/ospfd/lsupdate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lsupdate.c,v 1.23 2006/01/05 15:10:57 norby Exp $ */
+/* $OpenBSD: lsupdate.c,v 1.24 2006/02/10 18:30:47 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -267,7 +267,7 @@ recv_ls_update(struct nbr *nbr, char *buf, u_int16_t len)
"neighbor ID %s", inet_ntoa(nbr->id));
return;
}
- imsg_compose(ibuf_rde, IMSG_LS_UPD, nbr->peerid, 0, -1,
+ imsg_compose(ibuf_rde, IMSG_LS_UPD, nbr->peerid, 0,
buf, ntohs(lsa.len));
buf += ntohs(lsa.len);
len -= ntohs(lsa.len);
diff --git a/usr.sbin/ospfd/ospfd.c b/usr.sbin/ospfd/ospfd.c
index ba91d7c7523..af298293c11 100644
--- a/usr.sbin/ospfd/ospfd.c
+++ b/usr.sbin/ospfd/ospfd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfd.c,v 1.26 2006/01/12 15:10:02 claudio Exp $ */
+/* $OpenBSD: ospfd.c,v 1.27 2006/02/10 18:30:47 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -425,15 +425,13 @@ main_dispatch_rde(int fd, short event, void *bula)
void
main_imsg_compose_ospfe(int type, pid_t pid, void *data, u_int16_t datalen)
{
-
- imsg_compose(ibuf_ospfe, type, 0, pid, -1, data, datalen);
+ imsg_compose(ibuf_ospfe, type, 0, pid, data, datalen);
}
void
main_imsg_compose_rde(int type, pid_t pid, void *data, u_int16_t datalen)
{
-
- imsg_compose(ibuf_rde, type, 0, pid, -1, data, datalen);
+ imsg_compose(ibuf_rde, type, 0, pid, data, datalen);
}
int
diff --git a/usr.sbin/ospfd/ospfd.h b/usr.sbin/ospfd/ospfd.h
index 7ae0e39d012..869042bfff7 100644
--- a/usr.sbin/ospfd/ospfd.h
+++ b/usr.sbin/ospfd/ospfd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfd.h,v 1.43 2006/02/09 20:47:20 norby Exp $ */
+/* $OpenBSD: ospfd.h,v 1.44 2006/02/10 18:30:47 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -67,7 +67,6 @@ struct buf {
size_t max;
size_t wpos;
size_t rpos;
- int fd;
};
struct msgbuf {
@@ -152,11 +151,6 @@ struct imsg {
void *data;
};
-struct imsg_fd {
- TAILQ_ENTRY(imsg_fd) entry;
- int fd;
-};
-
/* area */
struct vertex;
struct rde_nbr;
@@ -476,13 +470,10 @@ int buf_add(struct buf *, void *, size_t);
void *buf_reserve(struct buf *, size_t);
void *buf_seek(struct buf *, size_t, size_t);
int buf_close(struct msgbuf *, struct buf *);
-int buf_write(int, struct buf *);
void buf_free(struct buf *);
void msgbuf_init(struct msgbuf *);
void msgbuf_clear(struct msgbuf *);
int msgbuf_write(struct msgbuf *);
-int msgbuf_writebound(struct msgbuf *);
-int msgbuf_unbounded(struct msgbuf *msgbuf);
/* parse.y */
struct ospfd_conf *parse_config(char *, int);
@@ -490,9 +481,9 @@ int cmdline_symset(char *);
/* imsg.c */
void imsg_init(struct imsgbuf *, int, void (*)(int, short, void *));
-int imsg_read(struct imsgbuf *);
-int imsg_get(struct imsgbuf *, struct imsg *);
-int imsg_compose(struct imsgbuf *, enum imsg_type, u_int32_t, pid_t, int,
+ssize_t imsg_read(struct imsgbuf *);
+ssize_t imsg_get(struct imsgbuf *, struct imsg *);
+int imsg_compose(struct imsgbuf *, enum imsg_type, u_int32_t, pid_t,
void *, u_int16_t);
struct buf *imsg_create(struct imsgbuf *, enum imsg_type, u_int32_t, pid_t,
u_int16_t);
diff --git a/usr.sbin/ospfd/ospfe.c b/usr.sbin/ospfd/ospfe.c
index 33c2267792a..956d39953a9 100644
--- a/usr.sbin/ospfd/ospfe.c
+++ b/usr.sbin/ospfd/ospfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfe.c,v 1.37 2006/01/05 15:53:36 claudio Exp $ */
+/* $OpenBSD: ospfe.c,v 1.38 2006/02/10 18:30:47 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -225,14 +225,14 @@ ospfe_shutdown(void)
int
ospfe_imsg_compose_parent(int type, pid_t pid, void *data, u_int16_t datalen)
{
- return (imsg_compose(ibuf_main, type, 0, pid, -1, data, datalen));
+ return (imsg_compose(ibuf_main, type, 0, pid, data, datalen));
}
int
ospfe_imsg_compose_rde(int type, u_int32_t peerid, pid_t pid,
void *data, u_int16_t datalen)
{
- return (imsg_compose(ibuf_rde, type, peerid, pid, -1, data, datalen));
+ return (imsg_compose(ibuf_rde, type, peerid, pid, data, datalen));
}
void
@@ -828,8 +828,8 @@ orig_rtr_lsa(struct area *area)
&chksum, sizeof(chksum));
if (self)
- imsg_compose(ibuf_rde, IMSG_LS_UPD,
- self->peerid, 0, -1, buf->buf, buf->wpos);
+ imsg_compose(ibuf_rde, IMSG_LS_UPD, self->peerid, 0,
+ buf->buf, buf->wpos);
else
log_warnx("orig_rtr_lsa: empty area %s",
inet_ntoa(area->id));
@@ -891,7 +891,7 @@ orig_net_lsa(struct iface *iface)
memcpy(buf_seek(buf, LS_CKSUM_OFFSET, sizeof(chksum)),
&chksum, sizeof(chksum));
- imsg_compose(ibuf_rde, IMSG_LS_UPD, iface->self->peerid, 0, -1,
+ imsg_compose(ibuf_rde, IMSG_LS_UPD, iface->self->peerid, 0,
buf->buf, buf->wpos);
buf_free(buf);
@@ -915,7 +915,7 @@ ospfe_iface_ctl(struct ctl_conn *c, unsigned int idx)
if (idx == 0 || idx == iface->ifindex) {
ictl = if_to_ctl(iface);
imsg_compose(&c->ibuf, IMSG_CTL_SHOW_INTERFACE,
- 0, 0, -1, ictl, sizeof(struct ctl_iface));
+ 0, 0, ictl, sizeof(struct ctl_iface));
}
}
@@ -933,10 +933,10 @@ ospfe_nbr_ctl(struct ctl_conn *c)
if (iface->self != nbr) {
nctl = nbr_to_ctl(nbr);
imsg_compose(&c->ibuf,
- IMSG_CTL_SHOW_NBR, 0, 0, -1, nctl,
+ IMSG_CTL_SHOW_NBR, 0, 0, nctl,
sizeof(struct ctl_nbr));
}
}
- imsg_compose(&c->ibuf, IMSG_CTL_END, 0, 0, -1, NULL, 0);
+ imsg_compose(&c->ibuf, IMSG_CTL_END, 0, 0, NULL, 0);
}
diff --git a/usr.sbin/ospfd/rde.c b/usr.sbin/ospfd/rde.c
index 9d88bd33d49..e5ec6df2528 100644
--- a/usr.sbin/ospfd/rde.c
+++ b/usr.sbin/ospfd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.38 2006/02/10 13:00:49 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.39 2006/02/10 18:30:47 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -196,14 +196,14 @@ rde_shutdown(void)
int
rde_imsg_compose_parent(int type, pid_t pid, void *data, u_int16_t datalen)
{
- return (imsg_compose(ibuf_main, type, 0, pid, -1, data, datalen));
+ return (imsg_compose(ibuf_main, type, 0, pid, data, datalen));
}
int
rde_imsg_compose_ospfe(int type, u_int32_t peerid, pid_t pid, void *data,
u_int16_t datalen)
{
- return (imsg_compose(ibuf_ospfe, type, peerid, pid, -1, data, datalen));
+ return (imsg_compose(ibuf_ospfe, type, peerid, pid, data, datalen));
}
void
@@ -291,7 +291,7 @@ rde_dispatch_imsg(int fd, short event, void *bula)
lsa_snap(nbr->area, imsg.hdr.peerid);
imsg_compose(ibuf_ospfe, IMSG_DB_END, imsg.hdr.peerid,
- 0, -1, NULL, 0);
+ 0, NULL, 0);
break;
case IMSG_DD:
nbr = rde_nbr_find(imsg.hdr.peerid);
@@ -319,8 +319,8 @@ rde_dispatch_imsg(int fd, short event, void *bula)
*/
rde_req_list_add(nbr, &lsa_hdr);
imsg_compose(ibuf_ospfe, IMSG_DD,
- imsg.hdr.peerid, 0, -1,
- &lsa_hdr, sizeof(lsa_hdr));
+ imsg.hdr.peerid, 0, &lsa_hdr,
+ sizeof(lsa_hdr));
}
}
if (l != 0)
@@ -329,7 +329,7 @@ rde_dispatch_imsg(int fd, short event, void *bula)
"packet", imsg.hdr.peerid);
imsg_compose(ibuf_ospfe, IMSG_DD_END, imsg.hdr.peerid,
- 0, -1, NULL, 0);
+ 0, NULL, 0);
break;
case IMSG_LS_REQ:
nbr = rde_nbr_find(imsg.hdr.peerid);
@@ -347,12 +347,12 @@ rde_dispatch_imsg(int fd, short event, void *bula)
ntohl(req_hdr.type), req_hdr.ls_id,
req_hdr.adv_rtr)) == NULL) {
imsg_compose(ibuf_ospfe, IMSG_LS_BADREQ,
- imsg.hdr.peerid, 0, -1, NULL, 0);
+ imsg.hdr.peerid, 0, NULL, 0);
continue;
}
imsg_compose(ibuf_ospfe, IMSG_LS_UPD,
- imsg.hdr.peerid, 0, -1,
- v->lsa, ntohs(v->lsa->hdr.len));
+ imsg.hdr.peerid, 0, v->lsa,
+ ntohs(v->lsa->hdr.len));
}
if (l != 0)
log_warnx("rde_dispatch_imsg: peerid %lu, "
@@ -403,14 +403,14 @@ rde_dispatch_imsg(int fd, short event, void *bula)
rde_req_list_del(nbr, &lsa->hdr);
/* flood and perhaps ack LSA */
imsg_compose(ibuf_ospfe, IMSG_LS_FLOOD,
- imsg.hdr.peerid, 0, -1,
- lsa, ntohs(lsa->hdr.len));
+ imsg.hdr.peerid, 0, lsa,
+ ntohs(lsa->hdr.len));
/* reflood self originated LSA */
if (self && v)
imsg_compose(ibuf_ospfe, IMSG_LS_FLOOD,
- v->nbr->peerid, 0, -1,
- v->lsa, ntohs(v->lsa->hdr.len));
+ v->nbr->peerid, 0, v->lsa,
+ ntohs(v->lsa->hdr.len));
/* lsa not added so free it */
if (self)
free(lsa);
@@ -428,7 +428,7 @@ rde_dispatch_imsg(int fd, short event, void *bula)
*/
if (rde_req_list_exists(nbr, &lsa->hdr)) {
imsg_compose(ibuf_ospfe, IMSG_LS_BADREQ,
- imsg.hdr.peerid, 0, -1, NULL, 0);
+ imsg.hdr.peerid, 0, NULL, 0);
break;
}
@@ -443,12 +443,12 @@ rde_dispatch_imsg(int fd, short event, void *bula)
/* directly send current LSA, no ack */
imsg_compose(ibuf_ospfe, IMSG_LS_UPD,
- imsg.hdr.peerid, 0, -1,
- v->lsa, ntohs(v->lsa->hdr.len));
+ imsg.hdr.peerid, 0, v->lsa,
+ ntohs(v->lsa->hdr.len));
} else {
/* LSA equal send direct ack */
imsg_compose(ibuf_ospfe, IMSG_LS_ACK,
- imsg.hdr.peerid, 0, -1, &lsa->hdr,
+ imsg.hdr.peerid, 0, &lsa->hdr,
sizeof(lsa->hdr));
free(lsa);
}
@@ -502,7 +502,7 @@ rde_dispatch_imsg(int fd, short event, void *bula)
if (imsg.hdr.len == IMSG_HEADER_SIZE) {
LIST_FOREACH(area, &rdeconf->area_list, entry) {
imsg_compose(ibuf_ospfe, IMSG_CTL_AREA,
- 0, imsg.hdr.pid, -1, area,
+ 0, imsg.hdr.pid, area,
sizeof(*area));
lsa_dump(&area->lsa_tree, imsg.hdr.type,
imsg.hdr.pid);
@@ -513,7 +513,7 @@ rde_dispatch_imsg(int fd, short event, void *bula)
memcpy(&aid, imsg.data, sizeof(aid));
if ((area = area_find(rdeconf, aid)) != NULL) {
imsg_compose(ibuf_ospfe, IMSG_CTL_AREA,
- 0, imsg.hdr.pid, -1, area,
+ 0, imsg.hdr.pid, area,
sizeof(*area));
lsa_dump(&area->lsa_tree, imsg.hdr.type,
imsg.hdr.pid);
@@ -524,13 +524,12 @@ rde_dispatch_imsg(int fd, short event, void *bula)
}
}
imsg_compose(ibuf_ospfe, IMSG_CTL_END, 0, imsg.hdr.pid,
- -1, NULL, 0);
+ NULL, 0);
break;
case IMSG_CTL_SHOW_RIB:
LIST_FOREACH(area, &rdeconf->area_list, entry) {
imsg_compose(ibuf_ospfe, IMSG_CTL_AREA,
- 0, imsg.hdr.pid, -1, area,
- sizeof(*area));
+ 0, imsg.hdr.pid, area, sizeof(*area));
rt_dump(area->id, imsg.hdr.pid, RIB_RTR);
rt_dump(area->id, imsg.hdr.pid, RIB_NET);
@@ -539,14 +538,14 @@ rde_dispatch_imsg(int fd, short event, void *bula)
rt_dump(aid, imsg.hdr.pid, RIB_EXT);
imsg_compose(ibuf_ospfe, IMSG_CTL_END, 0, imsg.hdr.pid,
- -1, NULL, 0);
+ NULL, 0);
break;
case IMSG_CTL_SHOW_SUM:
rde_send_summary(imsg.hdr.pid);
LIST_FOREACH(area, &rdeconf->area_list, entry)
rde_send_summary_area(area, imsg.hdr.pid);
imsg_compose(ibuf_ospfe, IMSG_CTL_END, 0, imsg.hdr.pid,
- -1, NULL, 0);
+ NULL, 0);
break;
default:
log_debug("rde_dispatch_msg: unexpected imsg %d",
@@ -645,7 +644,7 @@ rde_send_change_kroute(struct rt_node *r)
kr.nexthop.s_addr = r->nexthop.s_addr;
kr.prefixlen = r->prefixlen;
- imsg_compose(ibuf_main, IMSG_KROUTE_CHANGE, 0, 0, -1, &kr, sizeof(kr));
+ imsg_compose(ibuf_main, IMSG_KROUTE_CHANGE, 0, 0, &kr, sizeof(kr));
}
void
@@ -658,7 +657,7 @@ rde_send_delete_kroute(struct rt_node *r)
kr.nexthop.s_addr = r->nexthop.s_addr;
kr.prefixlen = r->prefixlen;
- imsg_compose(ibuf_main, IMSG_KROUTE_DELETE, 0, 0, -1, &kr, sizeof(kr));
+ imsg_compose(ibuf_main, IMSG_KROUTE_DELETE, 0, 0, &kr, sizeof(kr));
}
void