summary refs log tree commit diff
path: root/nixos/modules/system/boot/networkd.nix
diff options
context:
space:
mode:
authorVincent Haupert <mail@vincent-haupert.de>2021-01-30 11:24:13 +0100
committerVincent Haupert <mail@vincent-haupert.de>2021-01-30 14:06:27 +0100
commit38f19af76935a5c86ee17daa41cc835fe8f10ac9 (patch)
tree4c5b7931c748d6d938aa6f5048f150f37f047d83 /nixos/modules/system/boot/networkd.nix
parent53033aaf5a2620c8adaf6e66ef9afc1d567132c2 (diff)
downloadnixpkgs-38f19af76935a5c86ee17daa41cc835fe8f10ac9.tar
nixpkgs-38f19af76935a5c86ee17daa41cc835fe8f10ac9.tar.gz
nixpkgs-38f19af76935a5c86ee17daa41cc835fe8f10ac9.tar.bz2
nixpkgs-38f19af76935a5c86ee17daa41cc835fe8f10ac9.tar.lz
nixpkgs-38f19af76935a5c86ee17daa41cc835fe8f10ac9.tar.xz
nixpkgs-38f19af76935a5c86ee17daa41cc835fe8f10ac9.tar.zst
nixpkgs-38f19af76935a5c86ee17daa41cc835fe8f10ac9.zip
nixos/networkd: add dhcpV6PrefixDelegationConfig option
networkd gained a new section [DHCPv6PrefixDelegation] which
controls delegated prefixes assigned by DHCPv6 client. Added in systemd
246.
Diffstat (limited to 'nixos/modules/system/boot/networkd.nix')
-rw-r--r--nixos/modules/system/boot/networkd.nix29
1 files changed, 29 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix
index 2a679ffa81a..382e4abe620 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
+        <literal>[DHCPv6PrefixDelegation]</literal> section of the unit. See
+        <citerefentry><refentrytitle>systemd.network</refentrytitle>
+        <manvolnum>5</manvolnum></citerefentry> 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}