summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2019-03-15 16:49:21 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2019-03-15 16:49:21 +0000
commit7dfe3a498e3bf590afe4b6e87cc32176ead182d9 (patch)
tree50eacb81e4808abdf676b7f0049927a1349f5923 /usr.sbin
parentdd66408b0b3a2a9e36652fc9882f2d4d0a6e0c6b (diff)
Only accept one ICMPv6 and one route socket.
This caught a missing break where the ICMPv6 socket was also used as the route socket for a short while. OK pamela
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/rad/frontend.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/usr.sbin/rad/frontend.c b/usr.sbin/rad/frontend.c
index 45ad71e489f..dc1196f379d 100644
--- a/usr.sbin/rad/frontend.c
+++ b/usr.sbin/rad/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.26 2019/03/15 16:47:19 florian Exp $ */
+/* $OpenBSD: frontend.c,v 1.27 2019/03/15 16:49:20 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -145,7 +145,7 @@ struct rad_conf *frontend_conf;
struct imsgev *iev_main;
struct imsgev *iev_engine;
struct event ev_route;
-int icmp6sock = -1, ioctlsock = -1;
+int icmp6sock = -1, ioctlsock = -1, routesock = -1;
struct ipv6_mreq all_routers;
struct sockaddr_in6 all_nodes;
struct msghdr sndmhdr;
@@ -456,14 +456,21 @@ frontend_dispatch_main(int fd, short event, void *bula)
nconf = NULL;
break;
case IMSG_ICMP6SOCK:
+ if (icmp6sock != -1)
+ fatalx("%s: received unexpected icmp6 fd",
+ __func__);
if ((icmp6sock = imsg.fd) == -1)
fatalx("%s: expected to receive imsg "
"ICMPv6 fd but didn't receive any",
__func__);
event_set(&icmp6ev.ev, icmp6sock, EV_READ | EV_PERSIST,
icmp6_receive, NULL);
+ break;
case IMSG_ROUTESOCK:
- if ((fd = imsg.fd) == -1)
+ if (routesock != -1)
+ fatalx("%s: received unexpected routesock fd",
+ __func__);
+ if ((routesock = imsg.fd) == -1)
fatalx("%s: expected to receive imsg "
"routesocket fd but didn't receive any",
__func__);