summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2018-04-26 17:07:31 +0000
committerflorian <florian@openbsd.org>2018-04-26 17:07:31 +0000
commit7f820bb42e48f3fff789960b8a5a52dd20f18586 (patch)
treea4d40989f69cf0b245efb181cad7cacfb70ea160
parentHoist initialisations up; while here tighten not yet working pledge. (diff)
downloadwireguard-openbsd-7f820bb42e48f3fff789960b8a5a52dd20f18586.tar.xz
wireguard-openbsd-7f820bb42e48f3fff789960b8a5a52dd20f18586.zip
The frontend tells the main process when the startup is finished so
that we can drop the sendfd pledge.
-rw-r--r--sbin/slaacd/frontend.c4
-rw-r--r--sbin/slaacd/slaacd.c10
-rw-r--r--sbin/slaacd/slaacd.h3
3 files changed, 14 insertions, 3 deletions
diff --git a/sbin/slaacd/frontend.c b/sbin/slaacd/frontend.c
index 4e3cd16f50b..058832b374f 100644
--- a/sbin/slaacd/frontend.c
+++ b/sbin/slaacd/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.13 2018/02/20 16:22:19 otto Exp $ */
+/* $OpenBSD: frontend.c,v 1.14 2018/04/26 17:07:31 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -616,6 +616,8 @@ frontend_startup(void)
if ((ifnidxp = if_nameindex()) == NULL)
fatalx("if_nameindex");
+ frontend_imsg_compose_main(IMSG_STARTUP_DONE, 0, NULL, 0);
+
for(ifnidx = ifnidxp; ifnidx->if_index !=0 && ifnidx->if_name != NULL;
ifnidx++) {
update_iface(ifnidx->if_index, ifnidx->if_name);
diff --git a/sbin/slaacd/slaacd.c b/sbin/slaacd/slaacd.c
index a53fa2e9827..3a372689a7b 100644
--- a/sbin/slaacd/slaacd.c
+++ b/sbin/slaacd/slaacd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slaacd.c,v 1.16 2018/04/26 17:06:27 florian Exp $ */
+/* $OpenBSD: slaacd.c,v 1.17 2018/04/26 17:07:31 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -74,6 +74,7 @@ const char* imsg_type_name[] = {
"IMSG_ROUTESOCK",
"IMSG_CONTROLFD",
"IMSG_STARTUP",
+ "IMSG_STARTUP_DONE",
"IMSG_UPDATE_IF",
"IMSG_REMOVE_IF",
"IMSG_RA",
@@ -451,6 +452,13 @@ main_dispatch_frontend(int fd, short event, void *bula)
break;
switch (imsg.hdr.type) {
+ case IMSG_STARTUP_DONE:
+#if 0
+ /* XXX ioctl SIOCAIFADDR_IN6 */
+BROKEN if (pledge("stdio cpath", NULL) == -1)
+ fatal("pledge");
+#endif
+ break;
#ifndef SMALL
case IMSG_CTL_LOG_VERBOSE:
/* Already checked by frontend. */
diff --git a/sbin/slaacd/slaacd.h b/sbin/slaacd/slaacd.h
index f824411da32..68fc3a15e1b 100644
--- a/sbin/slaacd/slaacd.h
+++ b/sbin/slaacd/slaacd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: slaacd.h,v 1.12 2018/02/10 05:57:59 florian Exp $ */
+/* $OpenBSD: slaacd.h,v 1.13 2018/04/26 17:07:31 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -61,6 +61,7 @@ enum imsg_type {
IMSG_ROUTESOCK,
IMSG_CONTROLFD,
IMSG_STARTUP,
+ IMSG_STARTUP_DONE,
IMSG_UPDATE_IF,
IMSG_REMOVE_IF,
IMSG_RA,