summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2023-12-14 13:52:39 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2023-12-14 13:52:39 +0000
commit59d99ad94d41b6e27991d7893f8c11027bc0332f (patch)
treee01968e62cc22a0f44eb3645e67636fb102c252b /usr.sbin
parent652eb7ba6f06a8b27b2ca59db784b01286bcc107 (diff)
Mostly straightforward conversion to imsg_get_fd() only the handling
of the control socket needs a local variable since imsg_get_fd() can only be called once on an imsg. OK tb@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/rde.c6
-rw-r--r--usr.sbin/bgpd/rtr.c6
-rw-r--r--usr.sbin/bgpd/session.c14
3 files changed, 13 insertions, 13 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index ef631708a67..b5ba5d720fb 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.612 2023/11/07 11:18:35 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.613 2023/12/14 13:52:37 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -854,7 +854,7 @@ rde_dispatch_imsg_parent(struct imsgbuf *imsgbuf)
case IMSG_SOCKET_CONN:
case IMSG_SOCKET_CONN_CTL:
case IMSG_SOCKET_CONN_RTR:
- if ((fd = imsg.fd) == -1) {
+ if ((fd = imsg_get_fd(&imsg)) == -1) {
log_warnx("expected to receive imsg fd "
"but didn't receive any");
break;
@@ -1229,7 +1229,7 @@ rde_dispatch_imsg_parent(struct imsgbuf *imsgbuf)
break;
}
memcpy(&xmrt, imsg.data, sizeof(xmrt));
- if ((fd = imsg.fd) == -1)
+ if ((fd = imsg_get_fd(&imsg)) == -1)
log_warnx("expected to receive fd for mrt dump "
"but didn't receive any");
else if (xmrt.type == MRT_TABLE_DUMP ||
diff --git a/usr.sbin/bgpd/rtr.c b/usr.sbin/bgpd/rtr.c
index 0619e6a1f32..8077e1094e1 100644
--- a/usr.sbin/bgpd/rtr.c
+++ b/usr.sbin/bgpd/rtr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtr.c,v 1.17 2023/11/07 11:18:35 claudio Exp $ */
+/* $OpenBSD: rtr.c,v 1.18 2023/12/14 13:52:38 claudio Exp $ */
/*
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
@@ -319,7 +319,7 @@ rtr_dispatch_imsg_parent(struct imsgbuf *imsgbuf)
switch (imsg.hdr.type) {
case IMSG_SOCKET_CONN_RTR:
- if ((fd = imsg.fd) == -1) {
+ if ((fd = imsg_get_fd(&imsg)) == -1) {
log_warnx("expected to receive imsg fd "
"but didn't receive any");
break;
@@ -335,7 +335,7 @@ rtr_dispatch_imsg_parent(struct imsgbuf *imsgbuf)
imsg_init(ibuf_rde, fd);
break;
case IMSG_SOCKET_CONN:
- if ((fd = imsg.fd) == -1) {
+ if ((fd = imsg_get_fd(&imsg)) == -1) {
log_warnx("expected to receive imsg fd "
"but didn't receive any");
break;
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 7480937fc62..c3029ac7f7e 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.455 2023/11/07 11:18:35 claudio Exp $ */
+/* $OpenBSD: session.c,v 1.456 2023/12/14 13:52:38 claudio Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@@ -2977,7 +2977,7 @@ session_dispatch_imsg(struct imsgbuf *imsgbuf, int idx, u_int *listener_cnt)
case IMSG_SOCKET_CONN_CTL:
if (idx != PFD_PIPE_MAIN)
fatalx("reconf request not from parent");
- if ((fd = imsg.fd) == -1) {
+ if ((fd = imsg_get_fd(&imsg)) == -1) {
log_warnx("expected to receive imsg fd to "
"RDE but didn't receive any");
break;
@@ -3037,7 +3037,7 @@ session_dispatch_imsg(struct imsgbuf *imsgbuf, int idx, u_int *listener_cnt)
fatalx("king bula sez: "
"expected REINIT");
- if ((nla->fd = imsg.fd) == -1)
+ if ((nla->fd = imsg_get_fd(&imsg)) == -1)
log_warnx("expected to receive fd for "
"%s but didn't receive any",
log_sockaddr((struct sockaddr *)
@@ -3066,17 +3066,17 @@ session_dispatch_imsg(struct imsgbuf *imsgbuf, int idx, u_int *listener_cnt)
sizeof(restricted))
fatalx("RECONF_CTRL imsg with wrong len");
memcpy(&restricted, imsg.data, sizeof(restricted));
- if (imsg.fd == -1) {
+ if ((fd = imsg_get_fd(&imsg)) == -1) {
log_warnx("expected to receive fd for control "
"socket but didn't receive any");
break;
}
if (restricted) {
control_shutdown(rcsock);
- rcsock = imsg.fd;
+ rcsock = fd;
} else {
control_shutdown(csock);
- csock = imsg.fd;
+ csock = fd;
}
break;
case IMSG_RECONF_DRAIN:
@@ -3166,7 +3166,7 @@ session_dispatch_imsg(struct imsgbuf *imsgbuf, int idx, u_int *listener_cnt)
}
memcpy(&xmrt, imsg.data, sizeof(struct mrt));
- if ((xmrt.wbuf.fd = imsg.fd) == -1)
+ if ((xmrt.wbuf.fd = imsg_get_fd(&imsg)) == -1)
log_warnx("expected to receive fd for mrt dump "
"but didn't receive any");