summary refs log tree commit diff
path: root/nixos/tests/networking.nix
diff options
context:
space:
mode:
authorrnhmjoj <rnhmjoj@inventati.org>2018-02-01 15:50:35 +0100
committerrnhmjoj <rnhmjoj@inventati.org>2018-02-01 16:29:36 +0100
commit4050c30da2e0ec42123c381be1312b8d0b2cc118 (patch)
treee4ec27804d251caeb19b28a8bdfb85c8d6f765c8 /nixos/tests/networking.nix
parent1fec496f384c53df39684035bafb482865d3eff8 (diff)
downloadnixpkgs-4050c30da2e0ec42123c381be1312b8d0b2cc118.tar
nixpkgs-4050c30da2e0ec42123c381be1312b8d0b2cc118.tar.gz
nixpkgs-4050c30da2e0ec42123c381be1312b8d0b2cc118.tar.bz2
nixpkgs-4050c30da2e0ec42123c381be1312b8d0b2cc118.tar.lz
nixpkgs-4050c30da2e0ec42123c381be1312b8d0b2cc118.tar.xz
nixpkgs-4050c30da2e0ec42123c381be1312b8d0b2cc118.tar.zst
nixpkgs-4050c30da2e0ec42123c381be1312b8d0b2cc118.zip
nixos/tests: add test for temporary IPv6 addresses
Diffstat (limited to 'nixos/tests/networking.nix')
-rw-r--r--nixos/tests/networking.nix57
1 files changed, 57 insertions, 0 deletions
diff --git a/nixos/tests/networking.nix b/nixos/tests/networking.nix
index 182328b3296..fa3dc053872 100644
--- a/nixos/tests/networking.nix
+++ b/nixos/tests/networking.nix
@@ -476,6 +476,63 @@ let
         );
       '';
     };
+    privacy = {
+      name = "Privacy";
+      nodes.router = { config, pkgs, ... }: {
+        virtualisation.vlans = [ 1 ];
+        boot.kernel.sysctl."net.ipv6.conf.all.forwarding" = true;
+        networking = {
+          useNetworkd = networkd;
+          interfaces.eth1 = {
+            ipv6Address = "fd00:1234:5678:1::1";
+            ipv6PrefixLength = 64;
+          };
+        };
+        services.radvd = {
+          enable = true;
+          config = ''
+            interface eth1 {
+              AdvSendAdvert on;
+              AdvManagedFlag on;
+              AdvOtherConfigFlag on;
+
+              prefix fd00:1234:5678:1::/64 {
+                AdvAutonomous on;
+                AdvOnLink on;
+              };
+            };
+          '';
+        };
+      };
+      nodes.client = { config, pkgs, ... }: with pkgs.lib; {
+        virtualisation.vlans = [ 1 ];
+        networking = {
+          useNetworkd = networkd;
+          useDHCP = true;
+          interfaces.eth1 = {
+            preferTempAddress = true;
+            ip4 = mkOverride 0 [ ];
+            ip6 = mkOverride 0 [ ];
+          };
+        };
+      };
+      testScript = { nodes, ... }:
+        ''
+          startAll;
+
+          $client->waitForUnit("network.target");
+          $router->waitForUnit("network-online.target");
+
+          # Wait until we have an ip address
+          $client->waitUntilSucceeds("ip addr show dev eth1 | grep -q 'fd00:1234:5678:1:'");
+
+          # Test vlan 1
+          $client->waitUntilSucceeds("ping -c 1 fd00:1234:5678:1::1");
+
+          # Test address used is temporary
+          $client->succeed("! ip route get fd00:1234:5678:1::1 | grep -q ':[a-f0-9]*ff:fe[a-f0-9]*:'");
+        '';
+    };
   };
 
 in mapAttrs (const (attrs: makeTest (attrs // {