charon-systemd: Handle SIGHUP the same way charon does
That is, reload strongswan.conf, the loggers and the plugins.
This commit is contained in:
@@ -241,6 +241,7 @@ static int run()
|
|||||||
sigset_t set;
|
sigset_t set;
|
||||||
|
|
||||||
sigemptyset(&set);
|
sigemptyset(&set);
|
||||||
|
sigaddset(&set, SIGHUP);
|
||||||
sigaddset(&set, SIGTERM);
|
sigaddset(&set, SIGTERM);
|
||||||
sigprocmask(SIG_BLOCK, &set, NULL);
|
sigprocmask(SIG_BLOCK, &set, NULL);
|
||||||
|
|
||||||
@@ -262,6 +263,21 @@ static int run()
|
|||||||
}
|
}
|
||||||
switch (sig)
|
switch (sig)
|
||||||
{
|
{
|
||||||
|
case SIGHUP:
|
||||||
|
{
|
||||||
|
DBG1(DBG_DMN, "signal of type SIGHUP received. Reloading "
|
||||||
|
"configuration");
|
||||||
|
if (lib->settings->load_files(lib->settings, lib->conf, FALSE))
|
||||||
|
{
|
||||||
|
charon->load_loggers(charon, NULL, FALSE);
|
||||||
|
lib->plugins->reload(lib->plugins, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DBG1(DBG_DMN, "reloading config failed, keeping old");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
{
|
{
|
||||||
DBG1(DBG_DMN, "SIGTERM received, shutting down");
|
DBG1(DBG_DMN, "SIGTERM received, shutting down");
|
||||||
|
|||||||
Reference in New Issue
Block a user