diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2019-03-15 16:48:38 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2019-03-15 16:48:38 +0000 |
commit | dd66408b0b3a2a9e36652fc9882f2d4d0a6e0c6b (patch) | |
tree | e3bfa65c03c7311b91f59fe901607a836e604948 /sbin/unwind | |
parent | eaf514917fabbdff3bcf2099f6b1b4e00b91c85c (diff) |
Correctly interlock config reloads imsgs.
Only accept a new config reload if it's not currently running and
on accept a config reload end if one is currently running.
OK pamela
Diffstat (limited to 'sbin/unwind')
-rw-r--r-- | sbin/unwind/captiveportal.c | 8 | ||||
-rw-r--r-- | sbin/unwind/frontend.c | 8 | ||||
-rw-r--r-- | sbin/unwind/resolver.c | 8 |
3 files changed, 21 insertions, 3 deletions
diff --git a/sbin/unwind/captiveportal.c b/sbin/unwind/captiveportal.c index 8ba6f13693c..cbca055a055 100644 --- a/sbin/unwind/captiveportal.c +++ b/sbin/unwind/captiveportal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: captiveportal.c,v 1.9 2019/03/04 08:58:43 florian Exp $ */ +/* $OpenBSD: captiveportal.c,v 1.10 2019/03/15 16:48:37 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser <florian@openbsd.org> @@ -306,6 +306,9 @@ captiveportal_dispatch_main(int fd, short event, void *bula) event_add(&iev_frontend->ev, NULL); break; case IMSG_RECONF_CONF: + if (nconf != NULL) + fatalx("%s: IMSG_RECONF_CONF already in " + "progress", __func__); if (IMSG_DATA_SIZE(imsg) != sizeof(struct uw_conf)) fatalx("%s: IMSG_RECONF_CONF wrong length: %lu", __func__, IMSG_DATA_SIZE(imsg)); @@ -365,6 +368,9 @@ captiveportal_dispatch_main(int fd, short event, void *bula) uw_forwarder, entry); break; case IMSG_RECONF_END: + if (nconf == NULL) + fatalx("%s: IMSG_RECONF_END without " + "IMSG_RECONF_CONF", __func__); merge_config(captiveportal_conf, nconf); nconf = NULL; break; diff --git a/sbin/unwind/frontend.c b/sbin/unwind/frontend.c index ebe1a3c79b8..eb4927618ba 100644 --- a/sbin/unwind/frontend.c +++ b/sbin/unwind/frontend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frontend.c,v 1.16 2019/03/01 08:02:25 florian Exp $ */ +/* $OpenBSD: frontend.c,v 1.17 2019/03/15 16:48:37 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser <florian@openbsd.org> @@ -352,6 +352,9 @@ frontend_dispatch_main(int fd, short event, void *bula) event_add(&iev_captiveportal->ev, NULL); break; case IMSG_RECONF_CONF: + if (nconf != NULL) + fatalx("%s: IMSG_RECONF_CONF already in " + "progress", __func__); if (IMSG_DATA_SIZE(imsg) != sizeof(struct uw_conf)) fatalx("%s: IMSG_RECONF_CONF wrong length: %lu", __func__, IMSG_DATA_SIZE(imsg)); @@ -411,6 +414,9 @@ frontend_dispatch_main(int fd, short event, void *bula) uw_forwarder, entry); break; case IMSG_RECONF_END: + if (nconf == NULL) + fatalx("%s: IMSG_RECONF_END without " + "IMSG_RECONF_CONF", __func__); merge_config(frontend_conf, nconf); nconf = NULL; break; diff --git a/sbin/unwind/resolver.c b/sbin/unwind/resolver.c index 61caebcb790..7cb9fd3289a 100644 --- a/sbin/unwind/resolver.c +++ b/sbin/unwind/resolver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resolver.c,v 1.21 2019/03/01 08:02:25 florian Exp $ */ +/* $OpenBSD: resolver.c,v 1.22 2019/03/15 16:48:37 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser <florian@openbsd.org> @@ -584,6 +584,9 @@ resolver_dispatch_main(int fd, short event, void *bula) fatal("pledge"); break; case IMSG_RECONF_CONF: + if (nconf != NULL) + fatalx("%s: IMSG_RECONF_CONF already in " + "progress", __func__); if (IMSG_DATA_SIZE(imsg) != sizeof(struct uw_conf)) fatalx("%s: IMSG_RECONF_CONF wrong length: %lu", __func__, IMSG_DATA_SIZE(imsg)); @@ -643,6 +646,9 @@ resolver_dispatch_main(int fd, short event, void *bula) uw_forwarder, entry); break; case IMSG_RECONF_END: + if (nconf == NULL) + fatalx("%s: IMSG_RECONF_END without " + "IMSG_RECONF_CONF", __func__); forwarders_changed = check_forwarders_changed( &resolver_conf->uw_forwarder_list, &nconf->uw_forwarder_list); |