summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2018-04-26 17:06:28 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2018-04-26 17:06:28 +0000
commit0cb49bd8cfd980e7821f5fade397b1b415cbc5b0 (patch)
treee91c8afe83296ed8728da50433e18ea7113ee103 /sbin
parent681969e1942da96ecadc199773255f9ee5685958 (diff)
Hoist initialisations up; while here tighten not yet working pledge.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/slaacd/slaacd.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/sbin/slaacd/slaacd.c b/sbin/slaacd/slaacd.c
index fe895f906b0..a53fa2e9827 100644
--- a/sbin/slaacd/slaacd.c
+++ b/sbin/slaacd/slaacd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slaacd.c,v 1.15 2018/02/10 05:57:59 florian Exp $ */
+/* $OpenBSD: slaacd.c,v 1.16 2018/04/26 17:06:27 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -283,12 +283,6 @@ main(int argc, char *argv[])
if ((ioctl_sock = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0)
fatal("socket");
-#if 0
- /* XXX ioctl SIOCAIFADDR_IN6 */
-BROKEN if (pledge("rpath stdio sendfd cpath", NULL) == -1)
- fatal("pledge");
-#endif
-
if ((icmp6sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) < 0)
fatal("ICMPv6 socket");
@@ -307,8 +301,6 @@ BROKEN if (pledge("rpath stdio sendfd cpath", NULL) == -1)
sizeof(filt)) == -1)
fatal("ICMP6_FILTER");
- main_imsg_compose_frontend_fd(IMSG_ICMP6SOCK, 0, icmp6sock);
-
if ((frontend_routesock = socket(PF_ROUTE, SOCK_RAW, 0)) < 0)
fatal("route socket");
@@ -318,12 +310,22 @@ BROKEN if (pledge("rpath stdio sendfd cpath", NULL) == -1)
&rtfilter, sizeof(rtfilter)) < 0)
fatal("setsockopt(ROUTE_MSGFILTER)");
- main_imsg_compose_frontend_fd(IMSG_ROUTESOCK, 0, frontend_routesock);
-
#ifndef SMALL
if ((control_fd = control_init(csock)) == -1)
fatalx("control socket setup failed");
+#endif /* SMALL */
+#if 0
+ /* XXX ioctl SIOCAIFADDR_IN6 */
+BROKEN if (pledge("stdio cpath sendfd", NULL) == -1)
+ fatal("pledge");
+#endif
+
+ main_imsg_compose_frontend_fd(IMSG_ICMP6SOCK, 0, icmp6sock);
+
+ main_imsg_compose_frontend_fd(IMSG_ROUTESOCK, 0, frontend_routesock);
+
+#ifndef SMALL
main_imsg_compose_frontend_fd(IMSG_CONTROLFD, 0, control_fd);
#endif /* SMALL */