summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2024-11-21 13:27:14 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2024-11-21 13:27:14 +0000
commitc514d0e184ddcbc45f71c5fa24a32932ed1cfb1a (patch)
tree54a5b01f4114eedd8762f1c5dc0a5d13880b00d5
parentd4bf2b1ec1958fcf17f26becf16b308a9b9dfbb1 (diff)
Do not abuse struct ibuf_read for internal bits. Just define an own struct.
OK tb@
-rw-r--r--usr.sbin/ldpd/ldpe.h9
-rw-r--r--usr.sbin/ldpd/packet.c8
2 files changed, 11 insertions, 6 deletions
diff --git a/usr.sbin/ldpd/ldpe.h b/usr.sbin/ldpd/ldpe.h
index 24c0bc4b3e2..862bbda63ca 100644
--- a/usr.sbin/ldpd/ldpe.h
+++ b/usr.sbin/ldpd/ldpe.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldpe.h,v 1.79 2021/01/19 15:59:25 claudio Exp $ */
+/* $OpenBSD: ldpe.h,v 1.80 2024/11/21 13:27:13 claudio Exp $ */
/*
* Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org>
@@ -54,10 +54,15 @@ struct adj {
union ldpd_addr trans_addr;
};
+struct buf_read {
+ uint8_t buf[IBUF_READ_SIZE];
+ size_t wpos;
+};
+
struct tcp_conn {
struct nbr *nbr;
int fd;
- struct ibuf_read *rbuf;
+ struct buf_read *rbuf;
struct evbuf wbuf;
struct event rev;
};
diff --git a/usr.sbin/ldpd/packet.c b/usr.sbin/ldpd/packet.c
index f0f8080333c..1ed83732c36 100644
--- a/usr.sbin/ldpd/packet.c
+++ b/usr.sbin/ldpd/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.74 2024/11/21 13:20:00 claudio Exp $ */
+/* $OpenBSD: packet.c,v 1.75 2024/11/21 13:27:13 claudio Exp $ */
/*
* Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org>
@@ -36,7 +36,7 @@ static struct iface *disc_find_iface(unsigned int, int,
union ldpd_addr *, int);
static void session_read(int, short, void *);
static void session_write(int, short, void *);
-static ssize_t session_get_pdu(struct ibuf_read *, char **);
+static ssize_t session_get_pdu(struct buf_read *, char **);
static void tcp_close(struct tcp_conn *);
static struct pending_conn *pending_conn_new(int, int, union ldpd_addr *);
static void pending_conn_timeout(int, short, void *);
@@ -651,7 +651,7 @@ session_close(struct nbr *nbr)
}
static ssize_t
-session_get_pdu(struct ibuf_read *r, char **b)
+session_get_pdu(struct buf_read *r, char **b)
{
struct ldp_hdr l;
size_t av, dlen, left;
@@ -691,7 +691,7 @@ tcp_new(int fd, struct nbr *nbr)
evbuf_init(&tcp->wbuf, tcp->fd, session_write, tcp);
if (nbr) {
- if ((tcp->rbuf = calloc(1, sizeof(struct ibuf_read))) == NULL)
+ if ((tcp->rbuf = calloc(1, sizeof(struct buf_read))) == NULL)
fatal(__func__);
event_set(&tcp->rev, tcp->fd, EV_READ | EV_PERSIST,