From 38f19af76935a5c86ee17daa41cc835fe8f10ac9 Mon Sep 17 00:00:00 2001 From: Vincent Haupert Date: Sat, 30 Jan 2021 11:24:13 +0100 Subject: [PATCH] nixos/networkd: add dhcpV6PrefixDelegationConfig option networkd gained a new section [DHCPv6PrefixDelegation] which controls delegated prefixes assigned by DHCPv6 client. Added in systemd 246. --- nixos/modules/system/boot/networkd.nix | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index 2a679ffa81af..382e4abe620b 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -437,6 +437,7 @@ let "IPv6ProxyNDP" "IPv6ProxyNDPAddress" "IPv6PrefixDelegation" + "DHCPv6PrefixDelegation" "IPv6MTUBytes" "Bridge" "Bond" @@ -478,6 +479,7 @@ let (assertValueOneOf "IPv4ProxyARP" boolValues) (assertValueOneOf "IPv6ProxyNDP" boolValues) (assertValueOneOf "IPv6PrefixDelegation" ["static" "dhcpv6" "yes" "false"]) + (assertValueOneOf "DHCPv6PrefixDelegation" boolValues) (assertByteFormat "IPv6MTUBytes") (assertValueOneOf "ActiveSlave" boolValues) (assertValueOneOf "PrimarySlave" boolValues) @@ -668,6 +670,17 @@ let (assertRange "SendOption" 1 65536) ]; + sectionDHCPv6PrefixDelegation = checkUnitConfig "DHCPv6PrefixDelegation" [ + (assertOnlyFields [ + "SubnetId" + "Announce" + "Assign" + "Token" + ]) + (assertValueOneOf "Announce" boolValues) + (assertValueOneOf "Assign" boolValues) + ]; + sectionDHCPServer = checkUnitConfig "DHCPServer" [ (assertOnlyFields [ "PoolOffset" @@ -1101,6 +1114,18 @@ let ''; }; + dhcpV6PrefixDelegationConfig = mkOption { + default = {}; + example = { SubnetId = "auto"; Announce = true; }; + type = types.addCheck (types.attrsOf unitOption) check.network.sectionDHCPv6PrefixDelegation; + description = '' + Each attribute in this set specifies an option in the + [DHCPv6PrefixDelegation] section of the unit. See + systemd.network + 5 for details. + ''; + }; + dhcpServerConfig = mkOption { default = {}; example = { PoolOffset = 50; EmitDNS = false; }; @@ -1468,6 +1493,10 @@ let [DHCPv6] ${attrsToSection def.dhcpV6Config} '' + + optionalString (def.dhcpV6PrefixDelegationConfig != { }) '' + [DHCPv6PrefixDelegation] + ${attrsToSection def.dhcpV6PrefixDelegationConfig} + '' + optionalString (def.dhcpServerConfig != { }) '' [DHCPServer] ${attrsToSection def.dhcpServerConfig}