summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2019-02-01 15:52:35 +0000
committerflorian <florian@openbsd.org>2019-02-01 15:52:35 +0000
commitb04dd19da176f5f0708c5fd5b8b10ef72d48adec (patch)
tree92a9fbe56bf00c36bdeb89f0c186dfb0116bb2d1
parentsync (diff)
downloadwireguard-openbsd-b04dd19da176f5f0708c5fd5b8b10ef72d48adec.tar.xz
wireguard-openbsd-b04dd19da176f5f0708c5fd5b8b10ef72d48adec.zip
Don't send udp sockets that we failed to open to the frontend,
it will crash when it sees a -1 FD. Found the hard way by solene on a box without ::1
-rw-r--r--sbin/unwind/unwind.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/unwind/unwind.c b/sbin/unwind/unwind.c
index e582d60b969..d72b98f98b0 100644
--- a/sbin/unwind/unwind.c
+++ b/sbin/unwind/unwind.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unwind.c,v 1.8 2019/01/29 20:03:49 florian Exp $ */
+/* $OpenBSD: unwind.c,v 1.9 2019/02/01 15:52:35 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -741,6 +741,8 @@ open_ports(void)
if (udp4sock == -1 && udp6sock == -1)
fatal("could not bind to 127.0.0.1 or ::1 on port 53");
- main_imsg_compose_frontend_fd(IMSG_UDP4SOCK, 0, udp4sock);
- main_imsg_compose_frontend_fd(IMSG_UDP6SOCK, 0, udp6sock);
+ if (udp4sock != -1)
+ main_imsg_compose_frontend_fd(IMSG_UDP4SOCK, 0, udp4sock);
+ if (udp6sock != -1)
+ main_imsg_compose_frontend_fd(IMSG_UDP6SOCK, 0, udp6sock);
}