diff options
author | pennae <github@quasiparticle.net> | 2021-08-11 11:02:47 +0200 |
---|---|---|
committer | tomberek <tomberek@users.noreply.github.com> | 2021-10-16 20:48:03 -0400 |
commit | f29ea2d15d833494f7e97e0231b03ca70a8e7db4 (patch) | |
tree | 636d34b80a85598e045fb5e0f190c6330a51efdf /nixos/tests/networking.nix | |
parent | eebfe7199d9e543acea19de4af15a91ab7774e7c (diff) |
nixos/networking: add foo-over-udp endpoint support
allows configuration of foo-over-udp decapsulation endpoints. sadly networkd seems to lack the features necessary to support local and peer address configuration, so those are only supported when using scripted configuration.
Diffstat (limited to 'nixos/tests/networking.nix')
-rw-r--r-- | nixos/tests/networking.nix | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/nixos/tests/networking.nix b/nixos/tests/networking.nix index 8b947ddf0cf45..fdcf67f1126c3 100644 --- a/nixos/tests/networking.nix +++ b/nixos/tests/networking.nix @@ -380,6 +380,52 @@ let router.wait_until_succeeds("ping -c 1 192.168.1.3") ''; }; + fou = { + name = "foo-over-udp"; + nodes.machine = { ... }: { + virtualisation.vlans = [ 1 ]; + networking = { + useNetworkd = networkd; + useDHCP = false; + interfaces.eth1.ipv4.addresses = mkOverride 0 + [ { address = "192.168.1.1"; prefixLength = 24; } ]; + fooOverUDP = { + fou1 = { port = 9001; }; + fou2 = { port = 9002; protocol = 41; }; + fou3 = mkIf (!networkd) + { port = 9003; local.address = "192.168.1.1"; }; + fou4 = mkIf (!networkd) + { port = 9004; local = { address = "192.168.1.1"; dev = "eth1"; }; }; + }; + }; + systemd.services = { + fou3-fou-encap.after = optional (!networkd) "network-addresses-eth1.service"; + }; + }; + testScript = { ... }: + '' + import json + + machine.wait_for_unit("network.target") + fous = json.loads(machine.succeed("ip -json fou show")) + assert {"port": 9001, "gue": None, "family": "inet"} in fous, "fou1 exists" + assert {"port": 9002, "ipproto": 41, "family": "inet"} in fous, "fou2 exists" + '' + optionalString (!networkd) '' + assert { + "port": 9003, + "gue": None, + "family": "inet", + "local": "192.168.1.1", + } in fous, "fou3 exists" + assert { + "port": 9004, + "gue": None, + "family": "inet", + "local": "192.168.1.1", + "dev": "eth1", + } in fous, "fou4 exists" + ''; + }; sit = let node = { address4, remote, address6 }: { pkgs, ... }: with pkgs.lib; { virtualisation.vlans = [ 1 ]; |