nixos/networkd: add ipv6PrefixDelegationConfig to networkd

This commit is contained in:
Andreas Rammhold
2020-05-01 13:33:54 +02:00
parent 819e8bb35f
commit 5abd9a74fc
+31
View File
@@ -310,6 +310,20 @@ let
(assertValueOneOf "ForceDHCPv6PDOtherInformation" boolValues) (assertValueOneOf "ForceDHCPv6PDOtherInformation" boolValues)
]; ];
checkIpv6PrefixDelegation = checkUnitConfig "IPv6PrefixDelegation" [
(assertOnlyFields [
"Managed" "OtherInformation" "RouterLifetimeSec"
"RouterPreference" "EmitDNS" "DNS" "EmitDomains" "Domains"
"DNSLifetimeSec"
])
(assertValueOneOf "Managed" boolValues)
(assertValueOneOf "OtherInformation" boolValues)
(assertValueOneOf "RouterPreference" ["high" "medium" "low" "normal" "default"])
(assertValueOneOf "EmitDNS" boolValues)
(assertValueOneOf "EmitDomains" boolValues)
(assertMinimum "DNSLifetimeSec" 0)
];
checkDhcpServer = checkUnitConfig "DHCPServer" [ checkDhcpServer = checkUnitConfig "DHCPServer" [
(assertOnlyFields [ (assertOnlyFields [
"PoolOffset" "PoolSize" "DefaultLeaseTimeSec" "MaxLeaseTimeSec" "PoolOffset" "PoolSize" "DefaultLeaseTimeSec" "MaxLeaseTimeSec"
@@ -679,6 +693,18 @@ let
''; '';
}; };
ipv6PrefixDelegationConfig = mkOption {
default = {};
example = { EmitDNS = true; Managed = true; OtherInformation = true; };
type = types.addCheck (types.attrsOf unitOption) checkIpv6PrefixDelegation;
description = ''
Each attribute in this set specifies an option in the
<literal>[IPv6PrefixDelegation]</literal> section of the unit. See
<citerefentry><refentrytitle>systemd.network</refentrytitle>
<manvolnum>5</manvolnum></citerefentry> for details.
'';
};
dhcpServerConfig = mkOption { dhcpServerConfig = mkOption {
default = {}; default = {};
example = { PoolOffset = 50; EmitDNS = false; }; example = { PoolOffset = 50; EmitDNS = false; };
@@ -1013,6 +1039,11 @@ let
[DHCPv6] [DHCPv6]
${attrsToSection def.dhcpV6Config} ${attrsToSection def.dhcpV6Config}
''}
${optionalString (def.ipv6PrefixDelegationConfig != {}) ''
[IPv6PrefixDelegation]
${attrsToSection def.ipv6PrefixDelegationConfig}
''} ''}
${optionalString (def.dhcpServerConfig != { }) '' ${optionalString (def.dhcpServerConfig != { }) ''
[DHCPServer] [DHCPServer]