summary refs log tree commit diff
path: root/nixos/tests/networking.nix
diff options
context:
space:
mode:
authorLuflosi <luflosi@luflosi.de>2021-11-04 00:19:54 +0100
committerLuflosi <luflosi@luflosi.de>2022-01-20 20:14:55 +0100
commitca58bd0a50f38de43b401df716806c0f83479a8e (patch)
tree6301596ab1a682ba60a4df08954f7f533325f20c /nixos/tests/networking.nix
parentfde7c9d409cf012d53d065364532793c93191dcb (diff)
downloadnixpkgs-ca58bd0a50f38de43b401df716806c0f83479a8e.tar
nixpkgs-ca58bd0a50f38de43b401df716806c0f83479a8e.tar.gz
nixpkgs-ca58bd0a50f38de43b401df716806c0f83479a8e.tar.bz2
nixpkgs-ca58bd0a50f38de43b401df716806c0f83479a8e.tar.lz
nixpkgs-ca58bd0a50f38de43b401df716806c0f83479a8e.tar.xz
nixpkgs-ca58bd0a50f38de43b401df716806c0f83479a8e.tar.zst
nixpkgs-ca58bd0a50f38de43b401df716806c0f83479a8e.zip
nixos/networkd: Add routes from interfaces to [Route] section of .network file
Closes https://github.com/NixOS/nixpkgs/pull/93635.
Diffstat (limited to 'nixos/tests/networking.nix')
-rw-r--r--nixos/tests/networking.nix10
1 files changed, 9 insertions, 1 deletions
diff --git a/nixos/tests/networking.nix b/nixos/tests/networking.nix
index f46a115a07d..2510937b5dc 100644
--- a/nixos/tests/networking.nix
+++ b/nixos/tests/networking.nix
@@ -740,6 +740,7 @@ let
     routes = {
       name = "routes";
       machine = {
+        networking.useNetworkd = networkd;
         networking.useDHCP = false;
         networking.interfaces.eth0 = {
           ipv4.addresses = [ { address = "192.168.1.2"; prefixLength = 24; } ];
@@ -749,7 +750,13 @@ let
             { address = "2001:1470:fffd:2098::"; prefixLength = 64; via = "fdfd:b3f0::1"; }
           ];
           ipv4.routes = [
-            { address = "10.0.0.0"; prefixLength = 16; options = { mtu = "1500"; }; }
+            { address = "10.0.0.0"; prefixLength = 16; options = {
+              mtu = "1500";
+              # Explicitly set scope because iproute and systemd-networkd
+              # disagree on what the scope should be
+              # if the type is the default "unicast"
+              scope = "link";
+            }; }
             { address = "192.168.2.0"; prefixLength = 24; via = "192.168.1.1"; }
           ];
         };
@@ -798,6 +805,7 @@ let
                 ipv6Table, targetIPv6Table
             )
 
+      '' + optionalString (!networkd) ''
         with subtest("test clean-up of the tables"):
             machine.succeed("systemctl stop network-addresses-eth0")
             ipv4Residue = machine.succeed("ip -4 route list dev eth0 | head -n-3").strip()