diff options
author | Pierre Bourdon <delroth@gmail.com> | 2022-08-19 02:22:47 +0200 |
---|---|---|
committer | Pierre Bourdon <delroth@gmail.com> | 2022-08-19 02:25:41 +0200 |
commit | 4ae5da539489d31697a1e163b9de190e150ca63e (patch) | |
tree | 92ea0d1c143d64ed457260b29a3be3ad179f8258 /nixos/modules/tasks | |
parent | 5efa0529286c94347ce9f977e780016b4b21fa9e (diff) |
nixos/network-interfaces-systemd: do not ignore /0 gateway routes
While it might seem odd, 0.0.0.0/0 or ::/0 gateways are valid and commonly used on point-to-point links (e.g. a wireguard tunnel) to indicate that all traffic needs to be sent to a given interface. systemd-networkd actually documents this as a valid configuration in its man pages [1]. Tested to do the right thing in one of my NixOS containers using a Wireguard tunnel as its default route. [1] https://www.freedesktop.org/software/systemd/man/systemd.network.html#DefaultRouteOnDevice=
Diffstat (limited to 'nixos/modules/tasks')
-rw-r--r-- | nixos/modules/tasks/network-interfaces-systemd.nix | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/nixos/modules/tasks/network-interfaces-systemd.nix b/nixos/modules/tasks/network-interfaces-systemd.nix index 1657fabcd9b1c..b24b29c32d4ac 100644 --- a/nixos/modules/tasks/network-interfaces-systemd.nix +++ b/nixos/modules/tasks/network-interfaces-systemd.nix @@ -134,7 +134,7 @@ in # Most of these route options have not been tested. # Please fix or report any mistakes you may find. routeConfig = - optionalAttrs (route.prefixLength > 0) { + optionalAttrs (route.address != null && route.prefixLength != null) { Destination = "${route.address}/${toString route.prefixLength}"; } // optionalAttrs (route.options ? fastopen_no_cookie) { |