-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1245 from flyingcircusio/PL-133360-fix-ipv6-autoc…
…onfig-again [24.11] Fix IPv6 autoconfiguration
- Loading branch information
Showing
7 changed files
with
286 additions
and
24 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
changelog.d/20250122_094142_PL-133360-fix-ipv6-autoconfig-again_scriv.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!-- | ||
A new changelog entry. | ||
Delete placeholder items that do not apply. Empty sections will be removed | ||
automatically during release. | ||
Leave the XX.XX as is: this is a placeholder and will be automatically filled | ||
correctly during the release and helps when backporting over multiple platform | ||
branches. | ||
--> | ||
|
||
### Impact | ||
|
||
|
||
|
||
### NixOS XX.XX platform | ||
|
||
- platform: ensure that IPv6 autoconfiguration is correctly disabled | ||
on both physical and virtual hosts. (PL-133360) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import ./make-test-python.nix ({ pkgs, testlib, ... }: | ||
let | ||
assertZeroSysctl = pkgs.writeScriptBin "assert_zero_sysctl" '' | ||
set -eu | ||
sysctl="$1" | ||
value="$(${pkgs.procps}/bin/sysctl -n -b "$sysctl")" | ||
[ "$value" == "0" ] | ||
''; | ||
|
||
makePhysicalHost = { id, links }: { lib, config, ... }: | ||
let | ||
testNodeId = config.virtualisation.test.nodeNumber; | ||
in { | ||
imports = [ | ||
(testlib.fcConfig { | ||
inherit id; | ||
net.mgm = true; | ||
net.ul = true; | ||
extraEncParameters = { | ||
inherit id; | ||
interfaces.fe.policy = "vxlan"; | ||
interfaces.srv.policy = "vxlan"; | ||
interfaces.ul = { | ||
policy = "underlay"; | ||
nics = map (link: { | ||
mac = "52:54:00:12:${lib.toLower (lib.toHexString link)}:0${toString testNodeId}"; | ||
external_label = "phys/${toString link}"; | ||
}) links; | ||
}; | ||
}; | ||
}) | ||
]; | ||
|
||
# use the hardware networking config profile | ||
flyingcircus.networking.physicalHostNetworking = true; | ||
# extra underlay network links | ||
virtualisation.vlans = links; | ||
|
||
services.fail2ban.enable = false; | ||
|
||
environment.systemPackages = [ assertZeroSysctl ]; | ||
}; | ||
in { | ||
name = "ipv6-autoconfig"; | ||
testCases = { | ||
virtual = { | ||
name = "virtual"; | ||
nodes.machine = { ... }: { | ||
imports = [ | ||
(testlib.fcConfig {}) | ||
]; | ||
|
||
environment.systemPackages = [ assertZeroSysctl ]; | ||
}; | ||
testScript = '' | ||
sysctls = [ | ||
"accept_ra", | ||
"autoconf", | ||
"temp_valid_lft", | ||
"temp_prefered_lft", | ||
"addr_gen_mode", | ||
] | ||
machine.wait_for_unit("multi-user.target") | ||
with subtest("testing ipv6 autoconf configuration on ethsrv"): | ||
for sysctl in sysctls: | ||
machine.succeed(f"assert_zero_sysctl net.ipv6.conf.ethsrv.{sysctl}") | ||
with subtest("testing ipv6 autoconf configuration on ethfe"): | ||
for sysctl in sysctls: | ||
machine.succeed(f"assert_zero_sysctl net.ipv6.conf.ethfe.{sysctl}") | ||
''; | ||
}; | ||
hardware = { | ||
name = "hardware"; | ||
nodes = { | ||
machine = makePhysicalHost { id = 1; links = [ 253 254 ]; }; | ||
switch1 = testlib.mockVxlanSwitch { id = 2; links = [ 253 ]; }; | ||
switch2 = testlib.mockVxlanSwitch { id = 2; links = [ 254 ]; }; | ||
}; | ||
testScript = '' | ||
sysctls = [ | ||
"accept_ra", | ||
"autoconf", | ||
"temp_valid_lft", | ||
"temp_prefered_lft", | ||
] | ||
hw_sysctls = sysctls.copy() | ||
hw_sysctls.append("addr_gen_mode") | ||
start_all() | ||
for vm in [machine, switch1, switch2]: | ||
vm.wait_for_unit("multi-user.target") | ||
virt_links = ["brsrv", "brfe", "vxsrv", "vxfe"]; | ||
phys_links = ["ethmgm", "ul-phys-253", "ul-phys-254"]; | ||
with subtest("testing physical links"): | ||
for link in phys_links: | ||
with subtest(f"testing ipv6 autoconf configuration on {link}"): | ||
for sysctl in hw_sysctls: | ||
machine.succeed(f"assert_zero_sysctl net.ipv6.conf.{link}.{sysctl}") | ||
with subtest("testing virtual links"): | ||
for link in virt_links: | ||
with subtest(f"testing ipv6 autoconf configuration on {link}"): | ||
for sysctl in sysctls: | ||
machine.succeed(f"assert_zero_sysctl net.ipv6.conf.{link}.{sysctl}") | ||
''; | ||
}; | ||
}; | ||
}) |
Oops, something went wrong.