diff options
author | florian <florian@openbsd.org> | 2019-03-15 16:47:19 +0000 |
---|---|---|
committer | florian <florian@openbsd.org> | 2019-03-15 16:47:19 +0000 |
commit | 2b2996d812a07c2f1839da7222adc011c746f9a3 (patch) | |
tree | 3462de5bdc6511f7dcef4f418c0a693ebc301627 /usr.sbin/rad | |
parent | Do not accept a control socket if we already have one. (diff) | |
download | wireguard-openbsd-2b2996d812a07c2f1839da7222adc011c746f9a3.tar.xz wireguard-openbsd-2b2996d812a07c2f1839da7222adc011c746f9a3.zip |
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 'usr.sbin/rad')
-rw-r--r-- | usr.sbin/rad/engine.c | 8 | ||||
-rw-r--r-- | usr.sbin/rad/frontend.c | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/usr.sbin/rad/engine.c b/usr.sbin/rad/engine.c index d8aa56715d5..9ded4c6eb2f 100644 --- a/usr.sbin/rad/engine.c +++ b/usr.sbin/rad/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.14 2019/03/12 19:40:01 pamela Exp $ */ +/* $OpenBSD: engine.c,v 1.15 2019/03/15 16:47:19 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser <florian@openbsd.org> @@ -318,6 +318,9 @@ engine_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 rad_conf)) fatalx("%s: IMSG_RECONF_CONF wrong length: %lu", __func__, IMSG_DATA_SIZE(imsg)); @@ -400,6 +403,9 @@ engine_dispatch_main(int fd, short event, void *bula) ra_dnssl_conf, entry); break; case IMSG_RECONF_END: + if (nconf == NULL) + fatalx("%s: IMSG_RECONF_END without " + "IMSG_RECONF_CONF", __func__); merge_config(engine_conf, nconf); nconf = NULL; break; diff --git a/usr.sbin/rad/frontend.c b/usr.sbin/rad/frontend.c index b25cd3dc3a7..45ad71e489f 100644 --- a/usr.sbin/rad/frontend.c +++ b/usr.sbin/rad/frontend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frontend.c,v 1.25 2019/03/15 16:46:25 florian Exp $ */ +/* $OpenBSD: frontend.c,v 1.26 2019/03/15 16:47:19 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser <florian@openbsd.org> @@ -362,6 +362,9 @@ frontend_dispatch_main(int fd, short event, void *bula) event_add(&iev_engine->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 rad_conf)) fatalx("%s: IMSG_RECONF_CONF wrong length: %lu", __func__, IMSG_DATA_SIZE(imsg)); @@ -445,6 +448,9 @@ frontend_dispatch_main(int fd, short event, void *bula) ra_dnssl_conf, entry); break; case IMSG_RECONF_END: + if (nconf == NULL) + fatalx("%s: IMSG_RECONF_END without " + "IMSG_RECONF_CONF", __func__); merge_config(frontend_conf, nconf); merge_ra_interfaces(); nconf = NULL; |