From a416278570c360b7ec3c9881344c07b5584d20a3 Mon Sep 17 00:00:00 2001 From: Tore Anderson Date: Sun, 5 Mar 2023 10:58:29 +0100 Subject: [PATCH] Make NM/systemd integration more robust This fixed the following dependency loop that could occur when the system was booting up: 1. NetworkManager configures a network interface and fires off the clatd dispatcher script. 2. The dispatcher scripts tries to restart `clatd.service`. 3. However, `clatd.service` cannot be (re)started at this point because its dependency `network-online.target` has not yet been reached. 4. Therefore, the `systemctl restart clatd.service` command in the dispatcher script blocks, waiting for `network-online.target` to be reached. 5. But that won't happen until the dispatcher scripts finishes... Adding `--no-block` allows the dispatcher script to finish immediately without waiting for the restart to complete (instead, systemd will do it in the background once `network-online.target` has been reached). Furthermore, since `clatd.service` may end up being restarted several times during a boot process (especially on a system with many network interfaces handled by NetworkManager), it is also at risk of inadvertently triggering the restart rate-limiting feature in systemd, so disable that while we're at it. Closes #22. Thanks to @patrakov for the report! --- scripts/clatd.networkmanager | 2 +- scripts/clatd.systemd | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/clatd.networkmanager b/scripts/clatd.networkmanager index 57c8348..c16ef2e 100644 --- a/scripts/clatd.networkmanager +++ b/scripts/clatd.networkmanager @@ -27,7 +27,7 @@ # systemd-based distros if which systemctl &> /dev/null; then - systemctl restart clatd.service + systemctl --no-block restart clatd.service fi # upstart-based distros diff --git a/scripts/clatd.systemd b/scripts/clatd.systemd index 241edce..9b627fe 100644 --- a/scripts/clatd.systemd +++ b/scripts/clatd.systemd @@ -12,6 +12,7 @@ Description=464XLAT CLAT daemon Documentation=man:clatd(8) After=network-online.target +StartLimitIntervalSec=0 [Service] Type=simple