From 110c0e1d4950afbbb9ce8ad1d5c5dcddd4a7ae13 Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Tue, 18 Aug 2026 22:35:54 +0200 Subject: [PATCH] [fix](trx-rs): correct systemd network ordering Let the client wait for an enabled local server without activating a disabled one, and declare the socket families required by both services for configured listeners and remote connections. Assisted-By: OpenAI Codex (GPT-5) Signed-off-by: Stan Grams --- packaging/systemd/trx-client.service | 12 ++++++++---- packaging/systemd/trx-server.service | 7 +++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/packaging/systemd/trx-client.service b/packaging/systemd/trx-client.service index 1c5e2c02..a6b851cb 100644 --- a/packaging/systemd/trx-client.service +++ b/packaging/systemd/trx-client.service @@ -18,10 +18,11 @@ [Unit] Description=trx-rs radio client and web frontend Documentation=https://github.com/stanislawgrams/trx-rs -# Prefer the server to be up first; it is a soft dependency so the client still -# starts (and retries) if the server is managed separately. -Wants=trx-server.service -After=trx-server.service +# Wait for networking and, when it is enabled, the local server. After= only +# orders units already in the transaction: it deliberately does not start a +# disabled trx-server, since the client may connect to a remote server instead. +Wants=network-online.target +After=network-online.target trx-server.service [Service] Type=simple @@ -32,6 +33,9 @@ RestartSec=2 KillSignal=SIGINT TimeoutStopSec=15 NoNewPrivileges=true +# The client opens outbound TCP connections to remote servers and binds TCP +# listeners for its configured HTTP, JSON, rigctl, and audio frontends. +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 [Install] WantedBy=default.target diff --git a/packaging/systemd/trx-server.service b/packaging/systemd/trx-server.service index e211ae2c..86e94601 100644 --- a/packaging/systemd/trx-server.service +++ b/packaging/systemd/trx-server.service @@ -18,6 +18,10 @@ [Unit] Description=trx-rs radio server (CAT/SDR backend) Documentation=https://github.com/stanislawgrams/trx-rs +# The server binds its control/audio TCP listeners and may connect to networked +# rigs and reporting services, so do not start it before networking is ready. +Wants=network-online.target +After=network-online.target [Service] Type=simple @@ -29,6 +33,9 @@ RestartSec=2 KillSignal=SIGINT TimeoutStopSec=15 NoNewPrivileges=true +# Permit local IPC plus IPv4/IPv6 listening and outbound connections. Ports +# are configuration-defined, so SocketBindAllow= cannot safely narrow them. +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 [Install] WantedBy=default.target