-/* $OpenBSD: engine.c,v 1.5 2018/07/11 17:32:05 florian Exp $ */
+/* $OpenBSD: engine.c,v 1.6 2018/07/11 19:05:25 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
memcpy(&verbose, imsg.data, sizeof(verbose));
log_setverbose(verbose);
break;
+ case IMSG_SHUTDOWN:
+ engine_imsg_compose_frontend(IMSG_SHUTDOWN, 0, NULL, 0);
+ break;
default:
log_debug("%s: unexpected imsg %d", __func__,
imsg.hdr.type);
-/* $OpenBSD: frontend.c,v 1.4 2018/07/11 17:32:05 florian Exp $ */
+/* $OpenBSD: frontend.c,v 1.5 2018/07/11 19:05:25 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
fatal("pledge");
frontend_startup();
break;
+ case IMSG_SHUTDOWN:
+ frontend_imsg_compose_engine(IMSG_SHUTDOWN, 0, NULL, 0);
+ break;
default:
log_debug("%s: error handling imsg %d", __func__,
imsg.hdr.type);
free_ra_iface(ra_iface);
}
break;
+ case IMSG_SHUTDOWN:
+ frontend_imsg_compose_main(IMSG_SHUTDOWN, 0, NULL, 0);
+ break;
default:
log_debug("%s: error handling imsg %d", __func__,
imsg.hdr.type);
-/* $OpenBSD: rad.c,v 1.3 2018/07/11 14:01:44 florian Exp $ */
+/* $OpenBSD: rad.c,v 1.4 2018/07/11 19:05:25 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
void
main_sig_handler(int sig, short event, void *arg)
{
+ struct rad_conf empty_conf;
+
/*
* Normal signal handler rules don't apply because libevent
* decouples for us.
switch (sig) {
case SIGTERM:
case SIGINT:
- main_shutdown();
+ memset(&empty_conf, 0, sizeof(empty_conf));
+ (void)main_imsg_send_config(&empty_conf);
+ (void)main_imsg_compose_frontend(IMSG_SHUTDOWN, 0, NULL, 0);
+ break;
case SIGHUP:
if (main_reload() == -1)
log_warnx("configuration reload failed");
memcpy(&verbose, imsg.data, sizeof(verbose));
log_setverbose(verbose);
break;
+ case IMSG_SHUTDOWN:
+ shut = 1;
+ break;
default:
log_debug("%s: error handling imsg %d", __func__,
imsg.hdr.type);
-/* $OpenBSD: rad.h,v 1.5 2018/07/11 17:32:05 florian Exp $ */
+/* $OpenBSD: rad.h,v 1.6 2018/07/11 19:05:25 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
IMSG_SEND_RA,
IMSG_UPDATE_IF,
IMSG_REMOVE_IF,
+ IMSG_SHUTDOWN,
IMSG_SOCKET_IPC
};