about summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorRaito Bezarius <masterancpp@gmail.com>2024-01-12 03:52:39 +0100
committerRaito Bezarius <masterancpp@gmail.com>2024-01-12 03:52:39 +0100
commit3ecaad0e0e9670eda92fa17ddb96f23fcd4159a7 (patch)
treef27e9758601f7146ff6b52684a0ec8b5ee4761ca /nixos/modules/services
parente28b1c21cd5a7d160ac481426e57ad7cc988fa1d (diff)
downloadnixlib-3ecaad0e0e9670eda92fa17ddb96f23fcd4159a7.tar
nixlib-3ecaad0e0e9670eda92fa17ddb96f23fcd4159a7.tar.gz
nixlib-3ecaad0e0e9670eda92fa17ddb96f23fcd4159a7.tar.bz2
nixlib-3ecaad0e0e9670eda92fa17ddb96f23fcd4159a7.tar.lz
nixlib-3ecaad0e0e9670eda92fa17ddb96f23fcd4159a7.tar.xz
nixlib-3ecaad0e0e9670eda92fa17ddb96f23fcd4159a7.tar.zst
nixlib-3ecaad0e0e9670eda92fa17ddb96f23fcd4159a7.zip
nixos/networking/keepalived: do not emit `unicastPeers` when there are none
In the past, we emitted `unicast_peer` block even with empty unicast peers list.

This now results in:
```
Keepalived_vrrp[392762]: A unicast keyword has been specified without any unicast peers. Defaulting to multicast. This usage is deprecated - please update your configuration.
```

We do not emit it anymore to avoid this warning.
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/networking/keepalived/default.nix8
1 files changed, 5 insertions, 3 deletions
diff --git a/nixos/modules/services/networking/keepalived/default.nix b/nixos/modules/services/networking/keepalived/default.nix
index 429a47c3962c..bf5e96f001a8 100644
--- a/nixos/modules/services/networking/keepalived/default.nix
+++ b/nixos/modules/services/networking/keepalived/default.nix
@@ -59,9 +59,11 @@ let
         ${optionalString i.vmacXmitBase "vmac_xmit_base"}
 
         ${optionalString (i.unicastSrcIp != null) "unicast_src_ip ${i.unicastSrcIp}"}
-        unicast_peer {
-          ${concatStringsSep "\n" i.unicastPeers}
-        }
+        ${optionalString (builtins.length i.unicastPeers > 0) ''
+          unicast_peer {
+            ${concatStringsSep "\n" i.unicastPeers}
+          }
+        ''}
 
         virtual_ipaddress {
           ${concatMapStringsSep "\n" virtualIpLine i.virtualIps}