diff options
Diffstat (limited to 'usr.sbin/dvmrpd')
-rw-r--r-- | usr.sbin/dvmrpd/ask_nbrs2.c | 12 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/buffer.c | 66 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/dvmrpe.c | 4 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/dvmrpe.h | 4 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/graft.c | 12 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/graft_ack.c | 12 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/igmp.c | 10 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/imsg.c | 22 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/imsg.h | 42 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/kmroute.c | 6 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/nbrs2.c | 12 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/packet.c | 8 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/probe.c | 16 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/prune.c | 14 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/report.c | 26 |
15 files changed, 133 insertions, 133 deletions
diff --git a/usr.sbin/dvmrpd/ask_nbrs2.c b/usr.sbin/dvmrpd/ask_nbrs2.c index 2080a0a253b..378ae6f5265 100644 --- a/usr.sbin/dvmrpd/ask_nbrs2.c +++ b/usr.sbin/dvmrpd/ask_nbrs2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ask_nbrs2.c,v 1.1 2006/06/01 14:12:20 norby Exp $ */ +/* $OpenBSD: ask_nbrs2.c,v 1.2 2010/05/26 13:56:07 nicm Exp $ */ /* * Copyright (c) 2006 Esben Norby <norby@openbsd.org> @@ -37,7 +37,7 @@ int send_ask_nbrs2(struct iface *iface, struct in_addr addr, void *data, int len) { struct sockaddr_in dst; - struct buf *buf; + struct ibuf *buf; struct dvmrp_hdr *dvmrp_hdr; int ret = 0; @@ -47,7 +47,7 @@ send_ask_nbrs2(struct iface *iface, struct in_addr addr, void *data, int len) if (iface->passive) return (0); - if ((buf = buf_open(iface->mtu - sizeof(struct ip))) == NULL) + if ((buf = ibuf_open(iface->mtu - sizeof(struct ip))) == NULL) fatal("send_ask_nbrs2"); /* DVMRP header */ @@ -59,15 +59,15 @@ send_ask_nbrs2(struct iface *iface, struct in_addr addr, void *data, int len) dst.sin_addr.s_addr = addr.s_addr; /* update chksum */ - dvmrp_hdr = buf_seek(buf, 0, sizeof(dvmrp_hdr)); + dvmrp_hdr = ibuf_seek(buf, 0, sizeof(dvmrp_hdr)); dvmrp_hdr->chksum = in_cksum(buf->buf, buf->wpos); ret = send_packet(iface, buf->buf, buf->wpos, &dst); - buf_free(buf); + ibuf_free(buf); return (ret); fail: log_warn("send_ask_nbrs2"); - buf_free(buf); + ibuf_free(buf); return (-1); } diff --git a/usr.sbin/dvmrpd/buffer.c b/usr.sbin/dvmrpd/buffer.c index adba24d73d2..c4e5f208ce5 100644 --- a/usr.sbin/dvmrpd/buffer.c +++ b/usr.sbin/dvmrpd/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.5 2009/09/15 10:54:59 jacekm Exp $ */ +/* $OpenBSD: buffer.c,v 1.6 2010/05/26 13:56:07 nicm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -28,16 +28,16 @@ #include "imsg.h" -int buf_realloc(struct buf *, size_t); -void buf_enqueue(struct msgbuf *, struct buf *); -void buf_dequeue(struct msgbuf *, struct buf *); +int ibuf_realloc(struct ibuf *, size_t); +void ibuf_enqueue(struct msgbuf *, struct ibuf *); +void ibuf_dequeue(struct msgbuf *, struct ibuf *); -struct buf * -buf_open(size_t len) +struct ibuf * +ibuf_open(size_t len) { - struct buf *buf; + struct ibuf *buf; - if ((buf = calloc(1, sizeof(struct buf))) == NULL) + if ((buf = calloc(1, sizeof(struct ibuf))) == NULL) return (NULL); if ((buf->buf = malloc(len)) == NULL) { free(buf); @@ -49,15 +49,15 @@ buf_open(size_t len) return (buf); } -struct buf * -buf_dynamic(size_t len, size_t max) +struct ibuf * +ibuf_dynamic(size_t len, size_t max) { - struct buf *buf; + struct ibuf *buf; if (max < len) return (NULL); - if ((buf = buf_open(len)) == NULL) + if ((buf = ibuf_open(len)) == NULL) return (NULL); if (max > 0) @@ -67,7 +67,7 @@ buf_dynamic(size_t len, size_t max) } int -buf_realloc(struct buf *buf, size_t len) +ibuf_realloc(struct ibuf *buf, size_t len) { u_char *b; @@ -87,10 +87,10 @@ buf_realloc(struct buf *buf, size_t len) } int -buf_add(struct buf *buf, const void *data, size_t len) +ibuf_add(struct ibuf *buf, const void *data, size_t len) { if (buf->wpos + len > buf->size) - if (buf_realloc(buf, len) == -1) + if (ibuf_realloc(buf, len) == -1) return (-1); memcpy(buf->buf + buf->wpos, data, len); @@ -99,12 +99,12 @@ buf_add(struct buf *buf, const void *data, size_t len) } void * -buf_reserve(struct buf *buf, size_t len) +ibuf_reserve(struct ibuf *buf, size_t len) { void *b; if (buf->wpos + len > buf->size) - if (buf_realloc(buf, len) == -1) + if (ibuf_realloc(buf, len) == -1) return (NULL); b = buf->buf + buf->wpos; @@ -113,7 +113,7 @@ buf_reserve(struct buf *buf, size_t len) } void * -buf_seek(struct buf *buf, size_t pos, size_t len) +ibuf_seek(struct ibuf *buf, size_t pos, size_t len) { /* only allowed to seek in already written parts */ if (pos + len > buf->wpos) @@ -123,28 +123,28 @@ buf_seek(struct buf *buf, size_t pos, size_t len) } size_t -buf_size(struct buf *buf) +ibuf_size(struct ibuf *buf) { return (buf->wpos); } size_t -buf_left(struct buf *buf) +ibuf_left(struct ibuf *buf) { return (buf->max - buf->wpos); } void -buf_close(struct msgbuf *msgbuf, struct buf *buf) +ibuf_close(struct msgbuf *msgbuf, struct ibuf *buf) { - buf_enqueue(msgbuf, buf); + ibuf_enqueue(msgbuf, buf); } int -buf_write(struct msgbuf *msgbuf) +ibuf_write(struct msgbuf *msgbuf) { struct iovec iov[IOV_MAX]; - struct buf *buf; + struct ibuf *buf; unsigned int i = 0; ssize_t n; @@ -176,7 +176,7 @@ buf_write(struct msgbuf *msgbuf) } void -buf_free(struct buf *buf) +ibuf_free(struct ibuf *buf) { free(buf->buf); free(buf); @@ -193,14 +193,14 @@ msgbuf_init(struct msgbuf *msgbuf) void msgbuf_drain(struct msgbuf *msgbuf, size_t n) { - struct buf *buf, *next; + struct ibuf *buf, *next; for (buf = TAILQ_FIRST(&msgbuf->bufs); buf != NULL && n > 0; buf = next) { next = TAILQ_NEXT(buf, entry); if (buf->rpos + n >= buf->wpos) { n -= buf->wpos - buf->rpos; - buf_dequeue(msgbuf, buf); + ibuf_dequeue(msgbuf, buf); } else { buf->rpos += n; n = 0; @@ -211,17 +211,17 @@ msgbuf_drain(struct msgbuf *msgbuf, size_t n) void msgbuf_clear(struct msgbuf *msgbuf) { - struct buf *buf; + struct ibuf *buf; while ((buf = TAILQ_FIRST(&msgbuf->bufs)) != NULL) - buf_dequeue(msgbuf, buf); + ibuf_dequeue(msgbuf, buf); } int msgbuf_write(struct msgbuf *msgbuf) { struct iovec iov[IOV_MAX]; - struct buf *buf; + struct ibuf *buf; unsigned int i = 0; ssize_t n; struct msghdr msg; @@ -284,14 +284,14 @@ msgbuf_write(struct msgbuf *msgbuf) } void -buf_enqueue(struct msgbuf *msgbuf, struct buf *buf) +ibuf_enqueue(struct msgbuf *msgbuf, struct ibuf *buf) { TAILQ_INSERT_TAIL(&msgbuf->bufs, buf, entry); msgbuf->queued++; } void -buf_dequeue(struct msgbuf *msgbuf, struct buf *buf) +ibuf_dequeue(struct msgbuf *msgbuf, struct ibuf *buf) { TAILQ_REMOVE(&msgbuf->bufs, buf, entry); @@ -299,5 +299,5 @@ buf_dequeue(struct msgbuf *msgbuf, struct buf *buf) close(buf->fd); msgbuf->queued--; - buf_free(buf); + ibuf_free(buf); } diff --git a/usr.sbin/dvmrpd/dvmrpe.c b/usr.sbin/dvmrpd/dvmrpe.c index 24aaabaa235..f8217e46e35 100644 --- a/usr.sbin/dvmrpd/dvmrpe.c +++ b/usr.sbin/dvmrpd/dvmrpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dvmrpe.c,v 1.8 2009/09/22 16:38:31 michele Exp $ */ +/* $OpenBSD: dvmrpe.c,v 1.9 2010/05/26 13:56:07 nicm Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -169,7 +169,7 @@ dvmrpe(struct dvmrpd_conf *xconf, int pipe_parent2dvmrpe[2], TAILQ_INIT(&ctl_conns); control_listen(); - if ((pkt_ptr = calloc(1, READ_BUF_SIZE)) == NULL) + if ((pkt_ptr = calloc(1, IBUF_READ_SIZE)) == NULL) fatal("dvmrpe"); /* start interfaces */ diff --git a/usr.sbin/dvmrpd/dvmrpe.h b/usr.sbin/dvmrpd/dvmrpe.h index d5e95d283ca..7b771522906 100644 --- a/usr.sbin/dvmrpd/dvmrpe.h +++ b/usr.sbin/dvmrpd/dvmrpe.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dvmrpe.h,v 1.3 2009/03/14 15:32:55 michele Exp $ */ +/* $OpenBSD: dvmrpe.h,v 1.4 2010/05/26 13:56:07 nicm Exp $ */ /* * Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org> @@ -183,7 +183,7 @@ const char *nbr_action_name(int); struct ctl_nbr *nbr_to_ctl(struct nbr *); /* packet.c */ -int gen_dvmrp_hdr(struct buf *, struct iface *, u_int8_t); +int gen_dvmrp_hdr(struct ibuf *, struct iface *, u_int8_t); int send_packet(struct iface *, void *, size_t, struct sockaddr_in *); void recv_packet(int, short, void *); diff --git a/usr.sbin/dvmrpd/graft.c b/usr.sbin/dvmrpd/graft.c index 1931de3e3dc..7b2eab92c19 100644 --- a/usr.sbin/dvmrpd/graft.c +++ b/usr.sbin/dvmrpd/graft.c @@ -1,4 +1,4 @@ -/* $OpenBSD: graft.c,v 1.1 2006/06/01 14:12:20 norby Exp $ */ +/* $OpenBSD: graft.c,v 1.2 2010/05/26 13:56:07 nicm Exp $ */ /* * Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org> @@ -37,7 +37,7 @@ int send_graft(struct iface *iface, struct in_addr addr, void *data, int len) { struct sockaddr_in dst; - struct buf *buf; + struct ibuf *buf; struct dvmrp_hdr *dvmrp_hdr; int ret = 0; @@ -47,7 +47,7 @@ send_graft(struct iface *iface, struct in_addr addr, void *data, int len) if (iface->passive) return (0); - if ((buf = buf_open(iface->mtu - sizeof(struct ip))) == NULL) + if ((buf = ibuf_open(iface->mtu - sizeof(struct ip))) == NULL) fatal("send_graft"); /* DVMRP header */ @@ -59,15 +59,15 @@ send_graft(struct iface *iface, struct in_addr addr, void *data, int len) dst.sin_addr.s_addr = addr.s_addr; /* update chksum */ - dvmrp_hdr = buf_seek(buf, 0, sizeof(dvmrp_hdr)); + dvmrp_hdr = ibuf_seek(buf, 0, sizeof(dvmrp_hdr)); dvmrp_hdr->chksum = in_cksum(buf->buf, buf->wpos); ret = send_packet(iface, buf->buf, buf->wpos, &dst); - buf_free(buf); + ibuf_free(buf); return (ret); fail: log_warn("send_graft"); - buf_free(buf); + ibuf_free(buf); return (-1); } diff --git a/usr.sbin/dvmrpd/graft_ack.c b/usr.sbin/dvmrpd/graft_ack.c index 682293273da..70154b80cca 100644 --- a/usr.sbin/dvmrpd/graft_ack.c +++ b/usr.sbin/dvmrpd/graft_ack.c @@ -1,4 +1,4 @@ -/* $OpenBSD: graft_ack.c,v 1.1 2006/06/01 14:12:20 norby Exp $ */ +/* $OpenBSD: graft_ack.c,v 1.2 2010/05/26 13:56:07 nicm Exp $ */ /* * Copyright (c) 2006 Esben Norby <norby@openbsd.org> @@ -37,7 +37,7 @@ int send_graft_ack(struct iface *iface, struct in_addr addr, void *data, int len) { struct sockaddr_in dst; - struct buf *buf; + struct ibuf *buf; struct dvmrp_hdr *dvmrp_hdr; int ret = 0; @@ -47,7 +47,7 @@ send_graft_ack(struct iface *iface, struct in_addr addr, void *data, int len) if (iface->passive) return (0); - if ((buf = buf_open(iface->mtu - sizeof(struct ip))) == NULL) + if ((buf = ibuf_open(iface->mtu - sizeof(struct ip))) == NULL) fatal("send_graft_ack"); /* DVMRP header */ @@ -59,15 +59,15 @@ send_graft_ack(struct iface *iface, struct in_addr addr, void *data, int len) dst.sin_addr.s_addr = addr.s_addr; /* update chksum */ - dvmrp_hdr = buf_seek(buf, 0, sizeof(dvmrp_hdr)); + dvmrp_hdr = ibuf_seek(buf, 0, sizeof(dvmrp_hdr)); dvmrp_hdr->chksum = in_cksum(buf->buf, buf->wpos); ret = send_packet(iface, buf->buf, buf->wpos, &dst); - buf_free(buf); + ibuf_free(buf); return (ret); fail: log_warn("send_graft_ack"); - buf_free(buf); + ibuf_free(buf); return (-1); } diff --git a/usr.sbin/dvmrpd/igmp.c b/usr.sbin/dvmrpd/igmp.c index da0f3e3d0b7..b9594ee8400 100644 --- a/usr.sbin/dvmrpd/igmp.c +++ b/usr.sbin/dvmrpd/igmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: igmp.c,v 1.1 2006/06/01 14:12:20 norby Exp $ */ +/* $OpenBSD: igmp.c,v 1.2 2010/05/26 13:56:07 nicm Exp $ */ /* * Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org> @@ -40,7 +40,7 @@ send_igmp_query(struct iface *iface, struct group *group) { struct igmp_hdr igmp_hdr; struct sockaddr_in dst; - struct buf *buf; + struct ibuf *buf; int ret = 0; log_debug("send_igmp_query: interface %s", iface->name); @@ -48,7 +48,7 @@ send_igmp_query(struct iface *iface, struct group *group) if (iface->passive) return (0); - if ((buf = buf_open(iface->mtu - sizeof(struct ip))) == NULL) + if ((buf = ibuf_open(iface->mtu - sizeof(struct ip))) == NULL) fatal("send_igmp_query"); /* IGMP header */ @@ -77,7 +77,7 @@ send_igmp_query(struct iface *iface, struct group *group) /* update chksum */ igmp_hdr.chksum = in_cksum(&igmp_hdr, sizeof(igmp_hdr)); - buf_add(buf, &igmp_hdr, sizeof(igmp_hdr)); + ibuf_add(buf, &igmp_hdr, sizeof(igmp_hdr)); /* set destination address */ dst.sin_family = AF_INET; @@ -85,7 +85,7 @@ send_igmp_query(struct iface *iface, struct group *group) inet_aton(AllSystems, &dst.sin_addr); ret = send_packet(iface, buf->buf, buf->wpos, &dst); - buf_free(buf); + ibuf_free(buf); return (ret); } diff --git a/usr.sbin/dvmrpd/imsg.c b/usr.sbin/dvmrpd/imsg.c index 53ca8b4385a..5e5f97c40cb 100644 --- a/usr.sbin/dvmrpd/imsg.c +++ b/usr.sbin/dvmrpd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.9 2010/04/07 18:09:39 nicm Exp $ */ +/* $OpenBSD: imsg.c,v 1.10 2010/05/26 13:56:07 nicm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -135,7 +135,7 @@ int imsg_compose(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, pid_t pid, int fd, void *data, u_int16_t datalen) { - struct buf *wbuf; + struct ibuf *wbuf; if ((wbuf = imsg_create(ibuf, type, peerid, pid, datalen)) == NULL) return (-1); @@ -154,7 +154,7 @@ int imsg_composev(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, pid_t pid, int fd, const struct iovec *iov, int iovcnt) { - struct buf *wbuf; + struct ibuf *wbuf; int i, datalen = 0; for (i = 0; i < iovcnt; i++) @@ -175,11 +175,11 @@ imsg_composev(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, } /* ARGSUSED */ -struct buf * +struct ibuf * imsg_create(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, pid_t pid, u_int16_t datalen) { - struct buf *wbuf; + struct ibuf *wbuf; struct imsg_hdr hdr; datalen += IMSG_HEADER_SIZE; @@ -193,7 +193,7 @@ imsg_create(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, hdr.peerid = peerid; if ((hdr.pid = pid) == 0) hdr.pid = ibuf->pid; - if ((wbuf = buf_dynamic(datalen, MAX_IMSGSIZE)) == NULL) { + if ((wbuf = ibuf_dynamic(datalen, MAX_IMSGSIZE)) == NULL) { return (NULL); } if (imsg_add(wbuf, &hdr, sizeof(hdr)) == -1) @@ -203,18 +203,18 @@ imsg_create(struct imsgbuf *ibuf, u_int32_t type, u_int32_t peerid, } int -imsg_add(struct buf *msg, void *data, u_int16_t datalen) +imsg_add(struct ibuf *msg, void *data, u_int16_t datalen) { if (datalen) - if (buf_add(msg, data, datalen) == -1) { - buf_free(msg); + if (ibuf_add(msg, data, datalen) == -1) { + ibuf_free(msg); return (-1); } return (datalen); } void -imsg_close(struct imsgbuf *ibuf, struct buf *msg) +imsg_close(struct imsgbuf *ibuf, struct ibuf *msg) { struct imsg_hdr *hdr; @@ -226,7 +226,7 @@ imsg_close(struct imsgbuf *ibuf, struct buf *msg) hdr->len = (u_int16_t)msg->wpos; - buf_close(&ibuf->w, msg); + ibuf_close(&ibuf->w, msg); } void diff --git a/usr.sbin/dvmrpd/imsg.h b/usr.sbin/dvmrpd/imsg.h index 9fd3f2f4964..43564710bb2 100644 --- a/usr.sbin/dvmrpd/imsg.h +++ b/usr.sbin/dvmrpd/imsg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.h,v 1.5 2010/04/27 21:04:04 nicm Exp $ */ +/* $OpenBSD: imsg.h,v 1.6 2010/05/26 13:56:07 nicm Exp $ */ /* * Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -18,12 +18,12 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define READ_BUF_SIZE 65535 +#define IBUF_READ_SIZE 65535 #define IMSG_HEADER_SIZE sizeof(struct imsg_hdr) #define MAX_IMSGSIZE 16384 -struct buf { - TAILQ_ENTRY(buf) entry; +struct ibuf { + TAILQ_ENTRY(ibuf) entry; u_char *buf; size_t size; size_t max; @@ -33,13 +33,13 @@ struct buf { }; struct msgbuf { - TAILQ_HEAD(, buf) bufs; + TAILQ_HEAD(, ibuf) bufs; u_int32_t queued; int fd; }; -struct buf_read { - u_char buf[READ_BUF_SIZE]; +struct ibuf_read { + u_char buf[IBUF_READ_SIZE]; u_char *rptr; size_t wpos; }; @@ -51,7 +51,7 @@ struct imsg_fd { struct imsgbuf { TAILQ_HEAD(, imsg_fd) fds; - struct buf_read r; + struct ibuf_read r; struct msgbuf w; int fd; pid_t pid; @@ -75,16 +75,16 @@ struct imsg { /* buffer.c */ -struct buf *buf_open(size_t); -struct buf *buf_dynamic(size_t, size_t); -int buf_add(struct buf *, const void *, size_t); -void *buf_reserve(struct buf *, size_t); -void *buf_seek(struct buf *, size_t, size_t); -size_t buf_size(struct buf *); -size_t buf_left(struct buf *); -void buf_close(struct msgbuf *, struct buf *); -int buf_write(struct msgbuf *); -void buf_free(struct buf *); +struct ibuf *ibuf_open(size_t); +struct ibuf *ibuf_dynamic(size_t, size_t); +int ibuf_add(struct ibuf *, const void *, size_t); +void *ibuf_reserve(struct ibuf *, size_t); +void *ibuf_seek(struct ibuf *, size_t, size_t); +size_t ibuf_size(struct ibuf *); +size_t ibuf_left(struct ibuf *); +void ibuf_close(struct msgbuf *, struct ibuf *); +int ibuf_write(struct msgbuf *); +void ibuf_free(struct ibuf *); void msgbuf_init(struct msgbuf *); void msgbuf_clear(struct msgbuf *); int msgbuf_write(struct msgbuf *); @@ -98,10 +98,10 @@ int imsg_compose(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, int, void *, u_int16_t); int imsg_composev(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, int, const struct iovec *, int); -struct buf *imsg_create(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, +struct ibuf *imsg_create(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, u_int16_t); -int imsg_add(struct buf *, void *, u_int16_t); -void imsg_close(struct imsgbuf *, struct buf *); +int imsg_add(struct ibuf *, void *, u_int16_t); +void imsg_close(struct imsgbuf *, struct ibuf *); void imsg_free(struct imsg *); int imsg_flush(struct imsgbuf *); void imsg_clear(struct imsgbuf *); diff --git a/usr.sbin/dvmrpd/kmroute.c b/usr.sbin/dvmrpd/kmroute.c index 911319bc995..891f630e27a 100644 --- a/usr.sbin/dvmrpd/kmroute.c +++ b/usr.sbin/dvmrpd/kmroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kmroute.c,v 1.1 2006/06/01 14:12:20 norby Exp $ */ +/* $OpenBSD: kmroute.c,v 1.2 2010/05/26 13:56:07 nicm Exp $ */ /* * Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org> @@ -57,7 +57,7 @@ kmr_init(int fd) mrt_add_vif(conf->mroute_socket, iface); } - if ((mroute_ptr = calloc(1, READ_BUF_SIZE)) == NULL) + if ((mroute_ptr = calloc(1, IBUF_READ_SIZE)) == NULL) fatal("kmr_init"); return (0); @@ -94,7 +94,7 @@ kmr_recv_msg(int fd, short event, void *bula) /* setup buffer */ buf = mroute_ptr; - if ((r = recvfrom(fd, buf, READ_BUF_SIZE, 0, NULL, NULL)) == -1) { + if ((r = recvfrom(fd, buf, IBUF_READ_SIZE, 0, NULL, NULL)) == -1) { if (errno != EAGAIN && errno != EINTR) log_debug("kmr_recv_msg: error receiving packet"); return; diff --git a/usr.sbin/dvmrpd/nbrs2.c b/usr.sbin/dvmrpd/nbrs2.c index 1ea88464dc6..62ed768d7f2 100644 --- a/usr.sbin/dvmrpd/nbrs2.c +++ b/usr.sbin/dvmrpd/nbrs2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nbrs2.c,v 1.1 2006/06/01 14:12:20 norby Exp $ */ +/* $OpenBSD: nbrs2.c,v 1.2 2010/05/26 13:56:07 nicm Exp $ */ /* * Copyright (c) 2006 Esben Norby <norby@openbsd.org> @@ -37,7 +37,7 @@ int send_nbrs2(struct iface *iface, struct in_addr addr, void *data, int len) { struct sockaddr_in dst; - struct buf *buf; + struct ibuf *buf; struct dvmrp_hdr *dvmrp_hdr; int ret = 0; @@ -47,7 +47,7 @@ send_nbrs2(struct iface *iface, struct in_addr addr, void *data, int len) if (iface->passive) return (0); - if ((buf = buf_open(iface->mtu - sizeof(struct ip))) == NULL) + if ((buf = ibuf_open(iface->mtu - sizeof(struct ip))) == NULL) fatal("send_nbrs2"); /* DVMRP header */ @@ -59,15 +59,15 @@ send_nbrs2(struct iface *iface, struct in_addr addr, void *data, int len) dst.sin_addr.s_addr = addr.s_addr; /* update chksum */ - dvmrp_hdr = buf_seek(buf, 0, sizeof(dvmrp_hdr)); + dvmrp_hdr = ibuf_seek(buf, 0, sizeof(dvmrp_hdr)); dvmrp_hdr->chksum = in_cksum(buf->buf, buf->wpos); ret = send_packet(iface, buf->buf, buf->wpos, &dst); - buf_free(buf); + ibuf_free(buf); return (ret); fail: log_warn("send_nbrs2"); - buf_free(buf); + ibuf_free(buf); return (-1); } diff --git a/usr.sbin/dvmrpd/packet.c b/usr.sbin/dvmrpd/packet.c index f81a1614308..022c18f1e02 100644 --- a/usr.sbin/dvmrpd/packet.c +++ b/usr.sbin/dvmrpd/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.1 2006/06/01 14:12:20 norby Exp $ */ +/* $OpenBSD: packet.c,v 1.2 2010/05/26 13:56:07 nicm Exp $ */ /* * Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org> @@ -45,7 +45,7 @@ struct iface *find_iface(struct dvmrpd_conf *, struct in_addr); extern struct dvmrpd_conf *deconf; int -gen_dvmrp_hdr(struct buf *buf, struct iface *iface, u_int8_t code) +gen_dvmrp_hdr(struct ibuf *buf, struct iface *iface, u_int8_t code) { struct dvmrp_hdr dvmrp_hdr; @@ -57,7 +57,7 @@ gen_dvmrp_hdr(struct buf *buf, struct iface *iface, u_int8_t code) dvmrp_hdr.minor_version = DVMRP_MINOR_VERSION; dvmrp_hdr.major_version = DVMRP_MAJOR_VERSION; - return (buf_add(buf, &dvmrp_hdr, sizeof(dvmrp_hdr))); + return (ibuf_add(buf, &dvmrp_hdr, sizeof(dvmrp_hdr))); } /* send and receive packets */ @@ -108,7 +108,7 @@ recv_packet(int fd, short event, void *bula) /* setup buffer */ buf = pkt_ptr; - if ((r = recvfrom(fd, buf, READ_BUF_SIZE, 0, NULL, NULL)) == -1) { + if ((r = recvfrom(fd, buf, IBUF_READ_SIZE, 0, NULL, NULL)) == -1) { if (errno != EAGAIN && errno != EINTR) log_debug("recv_packet: error receiving packet"); return; diff --git a/usr.sbin/dvmrpd/probe.c b/usr.sbin/dvmrpd/probe.c index 93e3dccb607..17347df9532 100644 --- a/usr.sbin/dvmrpd/probe.c +++ b/usr.sbin/dvmrpd/probe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: probe.c,v 1.1 2006/06/01 14:12:20 norby Exp $ */ +/* $OpenBSD: probe.c,v 1.2 2010/05/26 13:56:07 nicm Exp $ */ /* * Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org> @@ -39,7 +39,7 @@ int send_probe(struct iface *iface) { struct sockaddr_in dst; - struct buf *buf; + struct ibuf *buf; struct dvmrp_hdr *dvmrp_hdr; struct nbr *nbr; int ret = 0; @@ -47,7 +47,7 @@ send_probe(struct iface *iface) if (iface->passive) return (0); - if ((buf = buf_open(iface->mtu - sizeof(struct ip))) == NULL) + if ((buf = ibuf_open(iface->mtu - sizeof(struct ip))) == NULL) fatal("send_probe"); /* DVMRP header */ @@ -55,12 +55,12 @@ send_probe(struct iface *iface) goto fail; /* generation ID */ - buf_add(buf, &iface->gen_id, sizeof(iface->gen_id)); + ibuf_add(buf, &iface->gen_id, sizeof(iface->gen_id)); /* generate neighbor list */ LIST_FOREACH(nbr, &iface->nbr_list, entry) { if (nbr->state > NBR_STA_DOWN) - buf_add(buf, &nbr->id, sizeof(nbr->id)); + ibuf_add(buf, &nbr->id, sizeof(nbr->id)); } /* set destination address */ @@ -69,15 +69,15 @@ send_probe(struct iface *iface) inet_aton(AllDVMRPRouters, &dst.sin_addr); /* update chksum */ - dvmrp_hdr = buf_seek(buf, 0, sizeof(dvmrp_hdr)); + dvmrp_hdr = ibuf_seek(buf, 0, sizeof(dvmrp_hdr)); dvmrp_hdr->chksum = in_cksum(buf->buf, buf->wpos); ret = send_packet(iface, buf->buf, buf->wpos, &dst); - buf_free(buf); + ibuf_free(buf); return (ret); fail: log_warn("send_probe"); - buf_free(buf); + ibuf_free(buf); return (-1); } diff --git a/usr.sbin/dvmrpd/prune.c b/usr.sbin/dvmrpd/prune.c index 58cf4ac3d1f..0296e113d6f 100644 --- a/usr.sbin/dvmrpd/prune.c +++ b/usr.sbin/dvmrpd/prune.c @@ -1,4 +1,4 @@ -/* $OpenBSD: prune.c,v 1.2 2009/03/14 15:32:55 michele Exp $ */ +/* $OpenBSD: prune.c,v 1.3 2010/05/26 13:56:07 nicm Exp $ */ /* * Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org> @@ -37,7 +37,7 @@ int send_prune(struct nbr *nbr, struct prune *p) { struct sockaddr_in dst; - struct buf *buf; + struct ibuf *buf; struct dvmrp_hdr *dvmrp_hdr; struct prune_hdr prune; int ret = 0; @@ -54,7 +54,7 @@ send_prune(struct nbr *nbr, struct prune *p) dst.sin_len = sizeof(struct sockaddr_in); dst.sin_addr = nbr->addr; - if ((buf = buf_open(nbr->iface->mtu - sizeof(struct ip))) == NULL) + if ((buf = ibuf_open(nbr->iface->mtu - sizeof(struct ip))) == NULL) fatal("send_prune"); /* DVMRP header */ @@ -68,19 +68,19 @@ send_prune(struct nbr *nbr, struct prune *p) prune.lifetime = htonl(MAX_PRUNE_LIFETIME); prune.src_netmask = p->netmask.s_addr; - buf_add(buf, &prune, sizeof(prune)); + ibuf_add(buf, &prune, sizeof(prune)); /* update chksum */ - dvmrp_hdr = buf_seek(buf, 0, sizeof(dvmrp_hdr)); + dvmrp_hdr = ibuf_seek(buf, 0, sizeof(dvmrp_hdr)); dvmrp_hdr->chksum = in_cksum(buf->buf, buf->wpos); ret = send_packet(nbr->iface, buf->buf, buf->wpos, &dst); - buf_free(buf); + ibuf_free(buf); return (ret); fail: log_warn("send_prune"); - buf_free(buf); + ibuf_free(buf); return (-1); } diff --git a/usr.sbin/dvmrpd/report.c b/usr.sbin/dvmrpd/report.c index 140dc3f572f..55137ad3119 100644 --- a/usr.sbin/dvmrpd/report.c +++ b/usr.sbin/dvmrpd/report.c @@ -1,4 +1,4 @@ -/* $OpenBSD: report.c,v 1.7 2007/04/10 09:37:25 michele Exp $ */ +/* $OpenBSD: report.c,v 1.8 2010/05/26 13:56:07 nicm Exp $ */ /* * Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org> @@ -41,7 +41,7 @@ int send_report(struct iface *iface, struct in_addr addr, void *data, int len) { struct sockaddr_in dst; - struct buf *buf; + struct ibuf *buf; struct dvmrp_hdr *dvmrp_hdr; int ret = 0; @@ -51,29 +51,29 @@ send_report(struct iface *iface, struct in_addr addr, void *data, int len) if (iface->passive) return (0); - if ((buf = buf_open(iface->mtu - sizeof(struct ip))) == NULL) + if ((buf = ibuf_open(iface->mtu - sizeof(struct ip))) == NULL) fatal("send_report"); /* DVMRP header */ if (gen_dvmrp_hdr(buf, iface, DVMRP_CODE_REPORT)) goto fail; - buf_add(buf, data, len); + ibuf_add(buf, data, len); dst.sin_family = AF_INET; dst.sin_len = sizeof(struct sockaddr_in); dst.sin_addr.s_addr = addr.s_addr; /* update chksum */ - dvmrp_hdr = buf_seek(buf, 0, sizeof(dvmrp_hdr)); + dvmrp_hdr = ibuf_seek(buf, 0, sizeof(dvmrp_hdr)); dvmrp_hdr->chksum = in_cksum(buf->buf, buf->wpos); ret = send_packet(iface, buf->buf, buf->wpos, &dst); - buf_free(buf); + ibuf_free(buf); return (ret); fail: log_warn("send_report"); - buf_free(buf); + ibuf_free(buf); return (-1); } @@ -225,7 +225,7 @@ void rr_list_send(struct rr_head *rr_list, struct iface *xiface, struct nbr *nbr) { struct rr_entry *le, *le2; - struct buf *buf; + struct ibuf *buf; struct iface *iface; struct in_addr addr; u_int32_t netid, netmask; @@ -243,7 +243,7 @@ rr_list_send(struct rr_head *rr_list, struct iface *xiface, struct nbr *nbr) } while (!TAILQ_EMPTY(rr_list)) { - if ((buf = buf_open(iface->mtu - sizeof(struct ip))) == NULL) + if ((buf = ibuf_open(iface->mtu - sizeof(struct ip))) == NULL) fatal("rr_list_send"); prefixlen = 0; @@ -255,13 +255,13 @@ rr_list_send(struct rr_head *rr_list, struct iface *xiface, struct nbr *nbr) prefixlen = mask2prefixlen(netmask); netmask = ntohl(netmask) << 8; netmask = htonl(netmask); - buf_add(buf, &netmask, 3); + ibuf_add(buf, &netmask, 3); } netid_len = PREFIX_SIZE(prefixlen); /* netid */ netid = le->re->net.s_addr; - buf_add(buf, &netid, netid_len); + ibuf_add(buf, &netid, netid_len); /* metric */ if (iface->ifindex == le->re->ifindex) @@ -283,13 +283,13 @@ rr_list_send(struct rr_head *rr_list, struct iface *xiface, struct nbr *nbr) metric = metric | LAST_MASK; } - buf_add(buf, &metric, sizeof(metric)); + ibuf_add(buf, &metric, sizeof(metric)); TAILQ_REMOVE(rr_list, le, entry); rr_list_remove(le->re); free(le); } send_report(iface, addr, buf->buf, buf->wpos); - buf_free(buf); + ibuf_free(buf); } } |