From fe9a5e47b9ac3a9f393f32459dfe61164a5d460e Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 15 Feb 2023 13:47:00 +0000 Subject: [PATCH] Use correct order of arguments for shutdown(2). Luckily routesock would never be <= 2 so shutdown would always failing with EINVAL and not shutting down random other sockets. The kernel was just uselessly piling up route messages that we were never reading. This mistake first showed up in slaacd(8) and then was copied to the other daemons. Reported & fixed by Josiah Frentsos (jfrent at tilde.team), thanks! OK kn --- sbin/dhcpleased/dhcpleased.c | 4 ++-- sbin/slaacd/slaacd.c | 4 ++-- sbin/unwind/unwind.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sbin/dhcpleased/dhcpleased.c b/sbin/dhcpleased/dhcpleased.c index dc52c6d8a18..1b76a0bd38c 100644 --- a/sbin/dhcpleased/dhcpleased.c +++ b/sbin/dhcpleased/dhcpleased.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpleased.c,v 1.28 2022/12/11 10:47:37 otto Exp $ */ +/* $OpenBSD: dhcpleased.c,v 1.29 2023/02/15 13:47:00 florian Exp $ */ /* * Copyright (c) 2017, 2021 Florian Obser @@ -255,7 +255,7 @@ main(int argc, char *argv[]) if ((routesock = socket(AF_ROUTE, SOCK_RAW | SOCK_CLOEXEC | SOCK_NONBLOCK, AF_INET)) == -1) fatal("route socket"); - shutdown(SHUT_RD, routesock); + shutdown(routesock, SHUT_RD); event_init(); diff --git a/sbin/slaacd/slaacd.c b/sbin/slaacd/slaacd.c index 816afff65e9..4d1786361f7 100644 --- a/sbin/slaacd/slaacd.c +++ b/sbin/slaacd/slaacd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: slaacd.c,v 1.67 2022/11/27 15:19:38 kn Exp $ */ +/* $OpenBSD: slaacd.c,v 1.68 2023/02/15 13:47:00 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser @@ -213,7 +213,7 @@ main(int argc, char *argv[]) if ((routesock = socket(AF_ROUTE, SOCK_RAW | SOCK_CLOEXEC | SOCK_NONBLOCK, AF_INET6)) == -1) fatal("route socket"); - shutdown(SHUT_RD, routesock); + shutdown(routesock, SHUT_RD); event_init(); diff --git a/sbin/unwind/unwind.c b/sbin/unwind/unwind.c index 3a407c97f77..1b70b6e3e6c 100644 --- a/sbin/unwind/unwind.c +++ b/sbin/unwind/unwind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unwind.c,v 1.67 2021/12/18 10:34:19 florian Exp $ */ +/* $OpenBSD: unwind.c,v 1.68 2023/02/15 13:47:00 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser @@ -278,7 +278,7 @@ main(int argc, char *argv[]) if ((routesock = socket(AF_ROUTE, SOCK_RAW | SOCK_CLOEXEC | SOCK_NONBLOCK, 0)) == -1) fatal("route socket"); - shutdown(SHUT_RD, routesock); + shutdown(routesock, SHUT_RD); if ((ta_fd = open(TRUST_ANCHOR_FILE, O_RDWR | O_CREAT, 0644)) == -1) log_warn("%s", TRUST_ANCHOR_FILE); -- 2.20.1