0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

nixos/networkd: DHCPv6PrefixDelegation -> DHCPPrefixDelegation

Adapt to changes introduced in Systemd 250:

> The [DHCPv6PrefixDelegation] section in .network file is renamed to
> [DHCPPrefixDelegation], as now the prefix delegation is also
> supported with DHCPv4 protocol by enabling the Use6RD= setting.

Replaces the `dhcpV6PrefixDelegationConfig` with
`dhcpPrefixDelegationConfig` and throws an error if the old option is
used.

Also adapt the respective IPv6 prefix delegation test.
This commit is contained in:
Vincent Haupert 2022-10-09 00:00:18 +02:00
parent e6cf6a32d9
commit bc8d6d8f96
2 changed files with 19 additions and 9 deletions

View file

@ -526,7 +526,7 @@ let
"IPv6ProxyNDP" "IPv6ProxyNDP"
"IPv6ProxyNDPAddress" "IPv6ProxyNDPAddress"
"IPv6SendRA" "IPv6SendRA"
"DHCPv6PrefixDelegation" "DHCPPrefixDelegation"
"IPv6MTUBytes" "IPv6MTUBytes"
"Bridge" "Bridge"
"Bond" "Bond"
@ -569,7 +569,7 @@ let
(assertValueOneOf "IPv4ProxyARP" boolValues) (assertValueOneOf "IPv4ProxyARP" boolValues)
(assertValueOneOf "IPv6ProxyNDP" boolValues) (assertValueOneOf "IPv6ProxyNDP" boolValues)
(assertValueOneOf "IPv6SendRA" boolValues) (assertValueOneOf "IPv6SendRA" boolValues)
(assertValueOneOf "DHCPv6PrefixDelegation" boolValues) (assertValueOneOf "DHCPPrefixDelegation" boolValues)
(assertByteFormat "IPv6MTUBytes") (assertByteFormat "IPv6MTUBytes")
(assertValueOneOf "ActiveSlave" boolValues) (assertValueOneOf "ActiveSlave" boolValues)
(assertValueOneOf "PrimarySlave" boolValues) (assertValueOneOf "PrimarySlave" boolValues)
@ -766,15 +766,20 @@ let
(assertInt "IAID") (assertInt "IAID")
]; ];
sectionDHCPv6PrefixDelegation = checkUnitConfig "DHCPv6PrefixDelegation" [ sectionDHCPPrefixDelegation = checkUnitConfig "DHCPPrefixDelegation" [
(assertOnlyFields [ (assertOnlyFields [
"UplinkInterface"
"SubnetId" "SubnetId"
"Announce" "Announce"
"Assign" "Assign"
"Token" "Token"
"ManageTemporaryAddress"
"RouteMetric"
]) ])
(assertValueOneOf "Announce" boolValues) (assertValueOneOf "Announce" boolValues)
(assertValueOneOf "Assign" boolValues) (assertValueOneOf "Assign" boolValues)
(assertValueOneOf "ManageTemporaryAddress" boolValues)
(assertRange "RouteMetric" 0 4294967295)
]; ];
sectionIPv6AcceptRA = checkUnitConfig "IPv6AcceptRA" [ sectionIPv6AcceptRA = checkUnitConfig "IPv6AcceptRA" [
@ -1338,12 +1343,17 @@ let
}; };
dhcpV6PrefixDelegationConfig = mkOption { dhcpV6PrefixDelegationConfig = mkOption {
visible = false;
apply = _: throw "The option `systemd.network.networks.<name>.dhcpV6PrefixDelegationConfig` has been renamed to `systemd.network.networks.<name>.dhcpPrefixDelegationConfig`.";
};
dhcpPrefixDelegationConfig = mkOption {
default = {}; default = {};
example = { SubnetId = "auto"; Announce = true; }; example = { SubnetId = "auto"; Announce = true; };
type = types.addCheck (types.attrsOf unitOption) check.network.sectionDHCPv6PrefixDelegation; type = types.addCheck (types.attrsOf unitOption) check.network.sectionDHCPPrefixDelegation;
description = lib.mdDoc '' description = lib.mdDoc ''
Each attribute in this set specifies an option in the Each attribute in this set specifies an option in the
`[DHCPv6PrefixDelegation]` section of the unit. See `[DHCPPrefixDelegation]` section of the unit. See
{manpage}`systemd.network(5)` for details. {manpage}`systemd.network(5)` for details.
''; '';
}; };
@ -1789,9 +1799,9 @@ let
[DHCPv6] [DHCPv6]
${attrsToSection def.dhcpV6Config} ${attrsToSection def.dhcpV6Config}
'' ''
+ optionalString (def.dhcpV6PrefixDelegationConfig != { }) '' + optionalString (def.dhcpPrefixDelegationConfig != { }) ''
[DHCPv6PrefixDelegation] [DHCPPrefixDelegation]
${attrsToSection def.dhcpV6PrefixDelegationConfig} ${attrsToSection def.dhcpPrefixDelegationConfig}
'' ''
+ optionalString (def.ipv6AcceptRAConfig != { }) '' + optionalString (def.ipv6AcceptRAConfig != { }) ''
[IPv6AcceptRA] [IPv6AcceptRA]

View file

@ -176,7 +176,7 @@ import ./make-test-python.nix ({pkgs, ...}: {
IPv6AcceptRA = false; IPv6AcceptRA = false;
# Delegate prefixes from the DHCPv6 PD pool. # Delegate prefixes from the DHCPv6 PD pool.
DHCPv6PrefixDelegation = true; DHCPPrefixDelegation = true;
IPv6SendRA = true; IPv6SendRA = true;
}; };