summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2018-08-04 09:36:50 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2018-08-04 09:36:50 +0000
commiteaf01727f8962621c3a7aee80d54ef7110d80a7c (patch)
treefa14c521963780a0cd0afae697495e2b569b8edb /sbin
parentbef5b006fd6f579420367c22cd736821031a3658 (diff)
Leave the control socket behind on shutdown. It doesn't hurt anyone.
On the other hand it is much more powerful to get rid of cpath; slaacd has no filesystem access whatsoever. Triggered by mestre@'s work to fix unlinking in other daemons and a question from deraadt@ OK mestre
Diffstat (limited to 'sbin')
-rw-r--r--sbin/slaacd/control.c13
-rw-r--r--sbin/slaacd/control.h3
-rw-r--r--sbin/slaacd/slaacd.c19
3 files changed, 7 insertions, 28 deletions
diff --git a/sbin/slaacd/control.c b/sbin/slaacd/control.c
index 1d3556b612f..1a0c2b0305a 100644
--- a/sbin/slaacd/control.c
+++ b/sbin/slaacd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.3 2018/04/26 17:08:18 florian Exp $ */
+/* $OpenBSD: control.c,v 1.4 2018/08/04 09:36:49 florian Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -106,17 +106,6 @@ control_listen(void)
}
void
-control_cleanup(char *path)
-{
- if (path == NULL)
- return;
- event_del(&control_state.ev);
- event_del(&control_state.evt);
- if (unlink(path) != 0)
- log_warn("unlink %s", path);
-}
-
-void
control_accept(int listenfd, short event, void *bula)
{
int connfd;
diff --git a/sbin/slaacd/control.h b/sbin/slaacd/control.h
index 52b576c5862..c244ed5a5a4 100644
--- a/sbin/slaacd/control.h
+++ b/sbin/slaacd/control.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.h,v 1.2 2017/07/06 15:02:53 florian Exp $ */
+/* $OpenBSD: control.h,v 1.3 2018/08/04 09:36:49 florian Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -33,5 +33,4 @@ int control_listen(void);
void control_accept(int, short, void *);
void control_dispatch_imsg(int, short, void *);
int control_imsg_relay(struct imsg *);
-void control_cleanup(char *);
#endif /* SMALL */
diff --git a/sbin/slaacd/slaacd.c b/sbin/slaacd/slaacd.c
index 344fc148537..244ac4350d9 100644
--- a/sbin/slaacd/slaacd.c
+++ b/sbin/slaacd/slaacd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slaacd.c,v 1.28 2018/07/27 06:20:01 bket Exp $ */
+/* $OpenBSD: slaacd.c,v 1.29 2018/08/04 09:36:49 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -80,11 +80,7 @@ struct imsgev *iev_engine;
pid_t frontend_pid;
pid_t engine_pid;
-int routesock, ioctl_sock;
-
-char *csock;
-
-int rtm_seq = 0;
+int routesock, ioctl_sock, rtm_seq = 0;
void
main_sig_handler(int sig, short event, void *arg)
@@ -129,12 +125,11 @@ main(int argc, char *argv[])
int pipe_main2engine[2];
int icmp6sock, on = 1;
int frontend_routesock, rtfilter;
+ char *csock = SLAACD_SOCKET;
#ifndef SMALL
int control_fd;
#endif /* SMALL */
- csock = SLAACD_SOCKET;
-
log_init(1, LOG_DAEMON); /* Log to stderr until daemonized. */
log_setverbose(1);
@@ -285,7 +280,7 @@ main(int argc, char *argv[])
fatalx("control socket setup failed");
#endif /* SMALL */
- if (pledge("stdio cpath sendfd wroute", NULL) == -1)
+ if (pledge("stdio sendfd wroute", NULL) == -1)
fatal("pledge");
main_imsg_compose_frontend_fd(IMSG_ICMP6SOCK, 0, icmp6sock);
@@ -331,10 +326,6 @@ main_shutdown(void)
free(iev_frontend);
free(iev_engine);
-#ifndef SMALL
- control_cleanup(csock);
-#endif /* SMALL */
-
log_info("terminating");
exit(0);
}
@@ -420,7 +411,7 @@ main_dispatch_frontend(int fd, short event, void *bula)
switch (imsg.hdr.type) {
case IMSG_STARTUP_DONE:
- if (pledge("stdio cpath wroute", NULL) == -1)
+ if (pledge("stdio wroute", NULL) == -1)
fatal("pledge");
break;
#ifndef SMALL