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:32:07 +0100
committerVincent Haupert <mail@vincent-haupert.de>2021-01-30 14:06:44 +0100
commit735111487b6f5d0e1353e4bac157366ec5036756 (patch)
tree7ddf1ed6c22ed9e7c77ed4a0d9ab4deb150199c9 /nixos/modules/system/boot/networkd.nix
parent38f19af76935a5c86ee17daa41cc835fe8f10ac9 (diff)
downloadnixpkgs-735111487b6f5d0e1353e4bac157366ec5036756.tar
nixpkgs-735111487b6f5d0e1353e4bac157366ec5036756.tar.gz
nixpkgs-735111487b6f5d0e1353e4bac157366ec5036756.tar.bz2
nixpkgs-735111487b6f5d0e1353e4bac157366ec5036756.tar.lz
nixpkgs-735111487b6f5d0e1353e4bac157366ec5036756.tar.xz
nixpkgs-735111487b6f5d0e1353e4bac157366ec5036756.tar.zst
nixpkgs-735111487b6f5d0e1353e4bac157366ec5036756.zip
nixos/networkd: add ipv6AcceptRAConfig option
Adds `systemd.network.networks.*.ipv6AcceptRAConfig` for networkd's
[IPv6AcceptRA] section.
Diffstat (limited to 'nixos/modules/system/boot/networkd.nix')
-rw-r--r--nixos/modules/system/boot/networkd.nix39
1 files changed, 39 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix
index 382e4abe620..d439c602534 100644
--- a/nixos/modules/system/boot/networkd.nix
+++ b/nixos/modules/system/boot/networkd.nix
@@ -681,6 +681,29 @@ let
         (assertValueOneOf "Assign" boolValues)
       ];
 
+      sectionIPv6AcceptRA = checkUnitConfig "IPv6AcceptRA" [
+        (assertOnlyFields [
+          "UseDNS"
+          "UseDomains"
+          "RouteTable"
+          "UseAutonomousPrefix"
+          "UseOnLinkPrefix"
+          "RouterDenyList"
+          "RouterAllowList"
+          "PrefixDenyList"
+          "PrefixAllowList"
+          "RouteDenyList"
+          "RouteAllowList"
+          "DHCPv6Client"
+        ])
+        (assertValueOneOf "UseDNS" boolValues)
+        (assertValueOneOf "UseDomains" (boolValues ++ ["route"]))
+        (assertRange "RouteTable" 0 4294967295)
+        (assertValueOneOf "UseAutonomousPrefix" boolValues)
+        (assertValueOneOf "UseOnLinkPrefix" boolValues)
+        (assertValueOneOf "DHCPv6Client" (boolValues ++ ["always"]))
+      ];
+
       sectionDHCPServer = checkUnitConfig "DHCPServer" [
         (assertOnlyFields [
           "PoolOffset"
@@ -1126,6 +1149,18 @@ let
       '';
     };
 
+    ipv6AcceptRAConfig = mkOption {
+      default = {};
+      example = { UseDNS = true; DHCPv6Client = "always"; };
+      type = types.addCheck (types.attrsOf unitOption) check.network.sectionIPv6AcceptRA;
+      description = ''
+        Each attribute in this set specifies an option in the
+        <literal>[IPv6AcceptRA]</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; };
@@ -1497,6 +1532,10 @@ let
           [DHCPv6PrefixDelegation]
           ${attrsToSection def.dhcpV6PrefixDelegationConfig}
         ''
+        + optionalString (def.ipv6AcceptRAConfig != { }) ''
+          [IPv6AcceptRA]
+          ${attrsToSection def.ipv6AcceptRAConfig}
+        ''
         + optionalString (def.dhcpServerConfig != { }) ''
           [DHCPServer]
           ${attrsToSection def.dhcpServerConfig}