diff options
author | Tobias Heider <tobhe@cvs.openbsd.org> | 2023-03-05 22:17:23 +0000 |
---|---|---|
committer | Tobias Heider <tobhe@cvs.openbsd.org> | 2023-03-05 22:17:23 +0000 |
commit | e708a13915a3edd96e2fbdcc4af5fe861e57b7fe (patch) | |
tree | 0fdca5ce895c503208478dd0f41b5ab336d4e418 /sbin/iked/iked.c | |
parent | 4b9edfb40f5561c1c7de2940f706bf400587a29b (diff) |
Fix clean process shutdown by storing env globally like vmd and httpd do
instead of getting it from p_ps. The old approach does not work anymore
after the recent fork + exec update.
ok patrick@
Diffstat (limited to 'sbin/iked/iked.c')
-rw-r--r-- | sbin/iked/iked.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sbin/iked/iked.c b/sbin/iked/iked.c index 858d1e2b80f..aa824d6f196 100644 --- a/sbin/iked/iked.c +++ b/sbin/iked/iked.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iked.c,v 1.63 2023/03/04 22:22:50 tobhe Exp $ */ +/* $OpenBSD: iked.c,v 1.64 2023/03/05 22:17:22 tobhe Exp $ */ /* * Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de> @@ -47,6 +47,8 @@ int parent_dispatch_control(int, struct privsep_proc *, struct imsg *); int parent_dispatch_ikev2(int, struct privsep_proc *, struct imsg *); int parent_configure(struct iked *); +struct iked *iked_env; + static struct privsep_proc procs[] = { { "ca", PROC_CERT, parent_dispatch_ca, caproc, IKED_CA }, { "control", PROC_CONTROL, parent_dispatch_control, control }, @@ -161,6 +163,7 @@ main(int argc, char *argv[]) if ((env = calloc(1, sizeof(*env))) == NULL) fatal("calloc: env"); + iked_env = env; env->sc_opts = opts; env->sc_nattmode = natt_mode; env->sc_nattport = port; @@ -421,7 +424,7 @@ parent_sig_handler(int sig, short event, void *arg) int parent_dispatch_ca(int fd, struct privsep_proc *p, struct imsg *imsg) { - struct iked *env = p->p_ps->ps_env; + struct iked *env = iked_env; switch (imsg->hdr.type) { case IMSG_OCSP_FD: @@ -437,7 +440,7 @@ parent_dispatch_ca(int fd, struct privsep_proc *p, struct imsg *imsg) int parent_dispatch_control(int fd, struct privsep_proc *p, struct imsg *imsg) { - struct iked *env = p->p_ps->ps_env; + struct iked *env = iked_env; int v; char *str = NULL; unsigned int type = imsg->hdr.type; @@ -476,7 +479,7 @@ parent_dispatch_control(int fd, struct privsep_proc *p, struct imsg *imsg) int parent_dispatch_ikev2(int fd, struct privsep_proc *p, struct imsg *imsg) { - struct iked *env = p->p_ps->ps_env; + struct iked *env = iked_env; switch (imsg->hdr.type) { case IMSG_IF_ADDADDR: |