about summary refs log tree commit diff
path: root/nixos/tests/networking.nix
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2021-08-11 12:48:43 +0200
committertomberek <tomberek@users.noreply.github.com>2021-10-16 20:48:03 -0400
commitc1f515547109a7e1845120449676ba6aa9a78fe9 (patch)
tree487ec319ee52767d36bb80cb59f3e1a433c0324b /nixos/tests/networking.nix
parentf29ea2d15d833494f7e97e0231b03ca70a8e7db4 (diff)
nixos/networking: support FOU encapsulation for sits
Diffstat (limited to 'nixos/tests/networking.nix')
-rw-r--r--nixos/tests/networking.nix27
1 files changed, 24 insertions, 3 deletions
diff --git a/nixos/tests/networking.nix b/nixos/tests/networking.nix
index fdcf67f1126c3..647c8942b37d9 100644
--- a/nixos/tests/networking.nix
+++ b/nixos/tests/networking.nix
@@ -431,7 +431,6 @@ let
         virtualisation.vlans = [ 1 ];
         networking = {
           useNetworkd = networkd;
-          firewall.enable = false;
           useDHCP = false;
           sits.sit = {
             inherit remote;
@@ -446,8 +445,30 @@ let
       };
     in {
       name = "Sit";
-      nodes.client1 = node { address4 = "192.168.1.1"; remote = "192.168.1.2"; address6 = "fc00::1"; };
-      nodes.client2 = node { address4 = "192.168.1.2"; remote = "192.168.1.1"; address6 = "fc00::2"; };
+      # note on firewalling: the two nodes are explicitly asymmetric.
+      # client1 sends SIT packets in UDP, but accepts only proto-41 incoming.
+      # client2 does the reverse, sending in proto-41 and accepting only UDP incoming.
+      # that way we'll notice when either SIT itself or FOU breaks.
+      nodes.client1 = args@{ pkgs, ... }:
+        mkMerge [
+          (node { address4 = "192.168.1.1"; remote = "192.168.1.2"; address6 = "fc00::1"; } args)
+          {
+            networking = {
+              firewall.extraCommands = "iptables -A INPUT -p 41 -j ACCEPT";
+              sits.sit.encapsulation = { type = "fou"; port = 9001; };
+            };
+          }
+        ];
+      nodes.client2 = args@{ pkgs, ... }:
+        mkMerge [
+          (node { address4 = "192.168.1.2"; remote = "192.168.1.1"; address6 = "fc00::2"; } args)
+          {
+            networking = {
+              firewall.allowedUDPPorts = [ 9001 ];
+              fooOverUDP.fou1 = { port = 9001; protocol = 41; };
+            };
+          }
+        ];
       testScript = { ... }:
         ''
           start_all()