From d0260c0d8c0e4578c7d8353cb4eab6f1a289f2b1 Mon Sep 17 00:00:00 2001 From: Git Sagar Date: Thu, 4 Jun 2026 16:41:34 +0530 Subject: [PATCH] add exit-client-on-disconnect patch When a startup account exhausts retries (including after an established connection drops with NumRetry 0), exit the process so systemd can restart it for a clean reconnect + DHCP. Co-Authored-By: Claude Opus 4.6 --- package.nix | 2 +- patches/exit-client-on-disconnect.patch | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 patches/exit-client-on-disconnect.patch diff --git a/package.nix b/package.nix index cc65897..2d88ab2 100644 --- a/package.nix +++ b/package.nix @@ -23,7 +23,7 @@ stdenv.mkDerivation (finalAttrs: { fetchSubmodules = true; }; - patches = [ ./patches/ipb-profile-key.patch ./patches/tap-name-no-prefix.patch ./patches/prevent-dmesg-call.patch ./patches/simplify_l2tp_auth.patch ]; + patches = [ ./patches/ipb-profile-key.patch ./patches/tap-name-no-prefix.patch ./patches/prevent-dmesg-call.patch ./patches/simplify_l2tp_auth.patch ./patches/exit-client-on-disconnect.patch ]; nativeBuildInputs = with pkgs; [ cmake diff --git a/patches/exit-client-on-disconnect.patch b/patches/exit-client-on-disconnect.patch new file mode 100644 index 0000000..76cd3b0 --- /dev/null +++ b/patches/exit-client-on-disconnect.patch @@ -0,0 +1,16 @@ +--- a/src/Cedar/Session.c 2026-06-04 16:38:36.571857886 +0530 ++++ b/src/Cedar/Session.c 2026-06-04 16:38:36.581858026 +0530 +@@ -1789,6 +1789,13 @@ + + Debug("Session Halt.\n"); + ++ ++ // Exit process when a startup account exhausts retries. ++ // Lets systemd restart the service for a clean reconnect + DHCP. ++ if (s->Account != NULL && s->Account->StartupAccount) ++ { ++ _exit(1); ++ } + s->ClientStatus = CLIENT_STATUS_IDLE; + + // Regard as that the session is ended here