summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2021-12-16 23:25:12 +0100
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2021-12-16 22:56:57 +0000
commit71d967bb4f026131b8629755b15cc48100282d11 (patch)
tree6ea8c27df5e2fe565ea68d29f5d422143154674e
parentMerge pull request #151027 from NixOS/backport-150975-to-release-21.11 (diff)
downloadnixpkgs-71d967bb4f026131b8629755b15cc48100282d11.tar.gz
nixos/snapserver: use the correct bind address arguments
Snapserver expects the arguments `--tcp.bind_to_address` and `--http.bind_to_address` instead of the `--tcp.address` (and http equivalent) versions. This caused the process to listen on `0.0.0.0` (for TCP and HTTP sockets) regardless of the configuration value. It also never listend on the IPv6 address `::` as our module system made the user believe. This commit fixes the above issue and ensures that (at least for the TCP socket) that our default `::` does indeed allow connections via IPv6 (to localhost aka ::1). (cherry picked from commit c9c93b0add8ab0ff054c83ba34174249564a8f3f)
-rw-r--r--nixos/modules/services/audio/snapserver.nix4
-rw-r--r--nixos/tests/snapcast.nix8
2 files changed, 10 insertions, 2 deletions
diff --git a/nixos/modules/services/audio/snapserver.nix b/nixos/modules/services/audio/snapserver.nix
index d3e97719f357..b82aca3976f0 100644
--- a/nixos/modules/services/audio/snapserver.nix
+++ b/nixos/modules/services/audio/snapserver.nix
@@ -54,12 +54,12 @@ let
# tcp json rpc
++ [ "--tcp.enabled ${toString cfg.tcp.enable}" ]
++ optionals cfg.tcp.enable [
- "--tcp.address ${cfg.tcp.listenAddress}"
+ "--tcp.bind_to_address ${cfg.tcp.listenAddress}"
"--tcp.port ${toString cfg.tcp.port}" ]
# http json rpc
++ [ "--http.enabled ${toString cfg.http.enable}" ]
++ optionals cfg.http.enable [
- "--http.address ${cfg.http.listenAddress}"
+ "--http.bind_to_address ${cfg.http.listenAddress}"
"--http.port ${toString cfg.http.port}"
] ++ optional (cfg.http.docRoot != null) "--http.doc_root \"${toString cfg.http.docRoot}\"");
diff --git a/nixos/tests/snapcast.nix b/nixos/tests/snapcast.nix
index 8d960b4cc069..30b8343e2ffe 100644
--- a/nixos/tests/snapcast.nix
+++ b/nixos/tests/snapcast.nix
@@ -40,6 +40,7 @@ in {
};
};
};
+ environment.systemPackages = [ pkgs.snapcast ];
};
client = {
environment.systemPackages = [ pkgs.snapcast ];
@@ -71,6 +72,13 @@ in {
"curl --fail http://localhost:${toString httpPort}/jsonrpc -d '{json.dumps(get_rpc_version)}'"
)
+ with subtest("test a ipv6 connection"):
+ server.execute("systemd-run --unit=snapcast-local-client snapclient -h ::1 -p ${toString port}")
+ server.wait_until_succeeds(
+ "journalctl -o cat -u snapserver.service | grep -q 'Hello from'"
+ )
+ server.wait_until_succeeds("journalctl -o cat -u snapcast-local-client | grep -q 'buffer: ${toString bufferSize}'")
+
with subtest("test a connection"):
client.execute("systemd-run --unit=snapcast-client snapclient -h server -p ${toString port}")
server.wait_until_succeeds(