summarylogtreecommitdiffstats
path: root/2222-charon-systemd-sighup.patch
blob: 544612c207559113757795c34ea73e6fefbbf9fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
index 5c7bbd779..fc93e2182 100644
--- a/src/charon-systemd/charon-systemd.c
+++ b/src/charon-systemd/charon-systemd.c
@@ -241,6 +241,7 @@ static int run()
        sigset_t set;

        sigemptyset(&set);
+       sigaddset(&set, SIGHUP);
        sigaddset(&set, SIGTERM);
        sigprocmask(SIG_BLOCK, &set, NULL);

@@ -262,6 +263,21 @@ static int run()
                }
                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:
                        {
                                DBG1(DBG_DMN, "SIGTERM received, shutting down");