]> git.feebdaed.xyz Git - 0xmirror/libreswan.git/commitdiff
systemd: log messages sent to systemd
authorAndrew Cagney <cagney@gnu.org>
Mon, 15 Dec 2025 20:48:16 +0000 (15:48 -0500)
committerAndrew Cagney <cagney@gnu.org>
Mon, 15 Dec 2025 20:48:16 +0000 (15:48 -0500)
programs/pluto/pluto_sd.c
programs/pluto/pluto_sd.h

index 7a72f76dac82cffb294ad7763e3a7d2f70ffeab2..7e839e668b2acfee36d3c7edb0efc933c8fb367d 100644 (file)
@@ -35,22 +35,31 @@ void pluto_sd_init(struct logger *logger)
        int ret = lswsd_watchdog_enabled(&sd_usecs);
 
        if (ret == 0) {
-               llog(RC_LOG, logger, "systemd watchdog not enabled - not sending watchdog keepalives");
+               llog(RC_LOG, logger, "systemd watchdog [disabled]; not sending \"keep-alive ping\"");
                return;
        }
+
        if (ret < 0) {
-               llog(RC_LOG, logger, "systemd watchdog returned error %d - not sending watchdog keepalives", ret);
+               /*
+                * Can only happen when systemd set bogus watchdog
+                * variables; fatal?
+                */
+               llog(ERROR_STREAM, logger,
+                    "systemd watchdog [failed]; configuration call call returned error %d - not sending \"keep-alive ping\"", ret);
                return;
        }
 
-       llog(RC_LOG, logger, "systemd watchdog for ipsec service configured with timeout of %"PRIu64" usecs", sd_usecs);
-       uintmax_t sd_secs = sd_usecs / 2 / 1000000; /* suggestion from sd_watchdog_enabled(3) */
-       llog(RC_LOG, logger, "watchdog: sending probes every %ju secs", sd_secs);
+       uintmax_t keep_alive = sd_usecs / 2 / 1000000; /* suggestion from sd_watchdog_enabled(3) */
+       llog(RC_LOG, logger,
+            "systemd watchdog [enabled]; ipsec.service configured with timeout of %"PRIu64" usecs, sending \"keep-alive ping\" every %ju seconds",
+            sd_usecs, keep_alive);
+
        /* tell systemd that we have finished starting up */
        pluto_sd(PLUTO_SD_START, SD_REPORT_NO_STATUS, logger);
+
        /* start the keepalive events */
        enable_periodic_timer(EVENT_SD_WATCHDOG, sd_watchdog_event,
-                             deltatime(sd_secs), logger);
+                             deltatime(keep_alive), logger);
 }
 
 /*
@@ -59,8 +68,9 @@ void pluto_sd_init(struct logger *logger)
 void pluto_sd(int action, int status, struct logger *logger)
 {
        name_buf ab;
-       ldbg(logger, "pluto_sd: executing action %s(%d), status %d",
-            str_enum_long(&sd_action_names, action, &ab), action, status);
+       llog(LOG_STREAM/*not-whack*/, logger,
+            "systemd watchdog: sending %s, status %d",
+            str_enum_long(&sd_action_names, action, &ab), status);
 
        switch (action) {
        case PLUTO_SD_WATCHDOG:
index 305625d12159366f86b0a51e1e51638f26b437fe..d8ff32e8a05a81f1030ca49490b46f0fa62ecf09 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef _PLUTO_SD_H
 #define _PLUTO_SD_H
 
+#include "verbose.h"
+
 #ifdef USE_SYSTEMD_WATCHDOG
 
 #define SD_REPORT_NO_STATUS 0