diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2019-01-29 15:37:30 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2019-01-29 15:37:30 +0000 |
commit | 422bdeb4eba3795d2416164b716fef77c998dcc8 (patch) | |
tree | a7a60d37c9ae87fd1e0a8ebfdcbb2e4d2a4e851b | |
parent | fbe37619ba5ad4d537ef090762ffbb88022d9937 (diff) |
We don't need IMSG_SHUTDOWN, we can just close the sockets.
pointed out by deraadt
-rw-r--r-- | sbin/unwind/frontend.c | 10 | ||||
-rw-r--r-- | sbin/unwind/resolver.c | 6 | ||||
-rw-r--r-- | sbin/unwind/unwind.c | 11 | ||||
-rw-r--r-- | sbin/unwind/unwind.h | 3 |
4 files changed, 6 insertions, 24 deletions
diff --git a/sbin/unwind/frontend.c b/sbin/unwind/frontend.c index 7bf8f3733a4..4b682fe6e8f 100644 --- a/sbin/unwind/frontend.c +++ b/sbin/unwind/frontend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frontend.c,v 1.5 2019/01/27 12:40:54 florian Exp $ */ +/* $OpenBSD: frontend.c,v 1.6 2019/01/29 15:37:29 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser <florian@openbsd.org> @@ -369,9 +369,6 @@ frontend_dispatch_main(int fd, short event, void *bula) __func__); parse_dhcp_lease(fd); break; - case IMSG_SHUTDOWN: - frontend_imsg_compose_resolver(IMSG_SHUTDOWN, 0, NULL, 0); - break; default: log_debug("%s: error handling imsg %d", __func__, imsg.hdr.type); @@ -418,11 +415,8 @@ frontend_dispatch_resolver(int fd, short event, void *bula) break; switch (imsg.hdr.type) { - case IMSG_SHUTDOWN: - frontend_imsg_compose_main(IMSG_SHUTDOWN, 0, NULL, 0); - break; case IMSG_ANSWER_HEADER: - /* XX size */ + /* XXX size */ query_imsg = (struct query_imsg *)imsg.data; if ((pq = find_pending_query(query_imsg->id)) == NULL) { diff --git a/sbin/unwind/resolver.c b/sbin/unwind/resolver.c index 9cd7f24d442..9a2198f9602 100644 --- a/sbin/unwind/resolver.c +++ b/sbin/unwind/resolver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resolver.c,v 1.11 2019/01/27 12:40:54 florian Exp $ */ +/* $OpenBSD: resolver.c,v 1.12 2019/01/29 15:37:29 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser <florian@openbsd.org> @@ -304,10 +304,6 @@ resolver_dispatch_frontend(int fd, short event, void *bula) if (update_resolvers) restart_resolvers(); break; - case IMSG_SHUTDOWN: - resolver_imsg_compose_frontend(IMSG_SHUTDOWN, 0, NULL, - 0); - break; case IMSG_QUERY: query_imsg = malloc(sizeof(*query_imsg)); /* XXX */ memcpy(query_imsg, imsg.data, sizeof(*query_imsg)); diff --git a/sbin/unwind/unwind.c b/sbin/unwind/unwind.c index 11a6d776b41..2c29f3a0bd9 100644 --- a/sbin/unwind/unwind.c +++ b/sbin/unwind/unwind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unwind.c,v 1.5 2019/01/27 12:40:54 florian Exp $ */ +/* $OpenBSD: unwind.c,v 1.6 2019/01/29 15:37:29 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser <florian@openbsd.org> @@ -77,8 +77,6 @@ uint32_t cmd_opts; void main_sig_handler(int sig, short event, void *arg) { - struct unwind_conf empty_conf; - /* * Normal signal handler rules don't apply because libevent * decouples for us. @@ -87,9 +85,7 @@ main_sig_handler(int sig, short event, void *arg) switch (sig) { case SIGTERM: case SIGINT: - memset(&empty_conf, 0, sizeof(empty_conf)); - (void)main_imsg_send_config(&empty_conf); - (void)main_imsg_compose_frontend(IMSG_SHUTDOWN, 0, NULL, 0); + main_shutdown(); break; case SIGHUP: if (main_reload() == -1) @@ -410,9 +406,6 @@ main_dispatch_frontend(int fd, short event, void *bula) memcpy(&verbose, imsg.data, sizeof(verbose)); log_setverbose(verbose); break; - case IMSG_SHUTDOWN: - shut = 1; - break; case IMSG_OPEN_DHCP_LEASE: memcpy(&rtm_index, imsg.data, sizeof(rtm_index)); open_dhcp_lease(rtm_index); diff --git a/sbin/unwind/unwind.h b/sbin/unwind/unwind.h index 6f8701aef60..887db4b46ab 100644 --- a/sbin/unwind/unwind.h +++ b/sbin/unwind/unwind.h @@ -1,4 +1,4 @@ -/* $OpenBSD: unwind.h,v 1.3 2019/01/27 12:40:54 florian Exp $ */ +/* $OpenBSD: unwind.h,v 1.4 2019/01/29 15:37:29 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser <florian@openbsd.org> @@ -64,7 +64,6 @@ enum imsg_type { IMSG_CONTROLFD, IMSG_STARTUP, IMSG_STARTUP_DONE, - IMSG_SHUTDOWN, IMSG_SOCKET_IPC, IMSG_QUERY, IMSG_ANSWER_HEADER, |