summaryrefslogtreecommitdiff
path: root/usr.sbin/eigrpd
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/eigrpd')
-rw-r--r--usr.sbin/eigrpd/control.c9
-rw-r--r--usr.sbin/eigrpd/eigrpd.c10
-rw-r--r--usr.sbin/eigrpd/eigrpe.c9
-rw-r--r--usr.sbin/eigrpd/rde.c9
4 files changed, 26 insertions, 11 deletions
diff --git a/usr.sbin/eigrpd/control.c b/usr.sbin/eigrpd/control.c
index ad56b64c155..f525c80d532 100644
--- a/usr.sbin/eigrpd/control.c
+++ b/usr.sbin/eigrpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.15 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.16 2024/11/21 13:38:14 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -144,7 +144,12 @@ control_accept(int listenfd, short event, void *bula)
return;
}
- imsgbuf_init(&c->iev.ibuf, connfd);
+ if (imsgbuf_init(&c->iev.ibuf, connfd) == -1) {
+ log_warn("%s: imsgbuf_init", __func__);
+ close(connfd);
+ free(c);
+ return;
+ }
c->iev.handler = control_dispatch_imsg;
c->iev.events = EV_READ;
event_set(&c->iev.ev, c->iev.ibuf.fd, c->iev.events,
diff --git a/usr.sbin/eigrpd/eigrpd.c b/usr.sbin/eigrpd/eigrpd.c
index 03b2b99ca50..d9946bb9389 100644
--- a/usr.sbin/eigrpd/eigrpd.c
+++ b/usr.sbin/eigrpd/eigrpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eigrpd.c,v 1.35 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: eigrpd.c,v 1.36 2024/11/21 13:38:14 claudio Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -240,9 +240,13 @@ main(int argc, char *argv[])
if ((iev_eigrpe = malloc(sizeof(struct imsgev))) == NULL ||
(iev_rde = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsgbuf_init(&iev_eigrpe->ibuf, pipe_parent2eigrpe[0]);
+ if (imsgbuf_init(&iev_eigrpe->ibuf, pipe_parent2eigrpe[0]) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_eigrpe->ibuf);
iev_eigrpe->handler = main_dispatch_eigrpe;
- imsgbuf_init(&iev_rde->ibuf, pipe_parent2rde[0]);
+ if (imsgbuf_init(&iev_rde->ibuf, pipe_parent2rde[0]) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_rde->ibuf);
iev_rde->handler = main_dispatch_rde;
/* setup event handler */
diff --git a/usr.sbin/eigrpd/eigrpe.c b/usr.sbin/eigrpd/eigrpe.c
index f4232109018..b5dedb798ee 100644
--- a/usr.sbin/eigrpd/eigrpe.c
+++ b/usr.sbin/eigrpd/eigrpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eigrpe.c,v 1.46 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: eigrpe.c,v 1.47 2024/11/21 13:38:14 claudio Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -146,7 +146,9 @@ eigrpe(int debug, int verbose, char *sockname)
/* setup pipe and event handler to the parent process */
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsgbuf_init(&iev_main->ibuf, 3);
+ if (imsgbuf_init(&iev_main->ibuf, 3) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_main->ibuf);
iev_main->handler = eigrpe_dispatch_main;
iev_main->events = EV_READ;
event_set(&iev_main->ev, iev_main->ibuf.fd, iev_main->events,
@@ -300,7 +302,8 @@ eigrpe_dispatch_main(int fd, short event, void *bula)
iev_rde = malloc(sizeof(struct imsgev));
if (iev_rde == NULL)
fatal(NULL);
- imsgbuf_init(&iev_rde->ibuf, fd);
+ if (imsgbuf_init(&iev_rde->ibuf, fd) == -1)
+ fatal(NULL);
iev_rde->handler = eigrpe_dispatch_rde;
iev_rde->events = EV_READ;
event_set(&iev_rde->ev, iev_rde->ibuf.fd,
diff --git a/usr.sbin/eigrpd/rde.c b/usr.sbin/eigrpd/rde.c
index 5bcfd383c05..c931f7efd6e 100644
--- a/usr.sbin/eigrpd/rde.c
+++ b/usr.sbin/eigrpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.31 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.32 2024/11/21 13:38:14 claudio Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -112,7 +112,9 @@ rde(int debug, int verbose)
/* setup pipe and event handler to the parent process */
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsgbuf_init(&iev_main->ibuf, 3);
+ if (imsgbuf_init(&iev_main->ibuf, 3) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_main->ibuf);
iev_main->handler = rde_dispatch_parent;
iev_main->events = EV_READ;
event_set(&iev_main->ev, iev_main->ibuf.fd, iev_main->events,
@@ -367,7 +369,8 @@ rde_dispatch_parent(int fd, short event, void *bula)
iev_eigrpe = malloc(sizeof(struct imsgev));
if (iev_eigrpe == NULL)
fatal(NULL);
- imsgbuf_init(&iev_eigrpe->ibuf, fd);
+ if (imsgbuf_init(&iev_eigrpe->ibuf, fd) == -1)
+ fatal(NULL);
iev_eigrpe->handler = rde_dispatch_imsg;
iev_eigrpe->events = EV_READ;
event_set(&iev_eigrpe->ev, iev_eigrpe->ibuf.fd,