From 3ab26f9f0021dd4d519a0fd1fc976a0c399f8f08 Mon Sep 17 00:00:00 2001 From: Izorkin Date: Thu, 9 Feb 2023 14:03:54 +0300 Subject: [PATCH] nixos/dhcpcd: add IPv6rs option --- .../doc/manual/release-notes/rl-2305.section.md | 1 + nixos/modules/services/networking/dhcpcd.nix | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-2305.section.md b/nixos/doc/manual/release-notes/rl-2305.section.md index e23f1b562e71..f4fdc38493c2 100644 --- a/nixos/doc/manual/release-notes/rl-2305.section.md +++ b/nixos/doc/manual/release-notes/rl-2305.section.md @@ -284,6 +284,7 @@ In addition to numerous new and upgraded packages, this release has the followin ``` - `services.dhcpcd` service now don't solicit or accept IPv6 Router Advertisements on interfaces that use static IPv6 addresses. + If network uses both IPv6 Unique local addresses (ULA) and global IPv6 address auto-configuration with SLAAC, must add the parameter `networking.dhcpcd.IPv6rs = true;`. - The module `services.headscale` was refactored to be compliant with [RFC 0042](https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md). To be precise, this means that the following things have changed: diff --git a/nixos/modules/services/networking/dhcpcd.nix b/nixos/modules/services/networking/dhcpcd.nix index 9a0b29fbe5a7..8b6d3fc55f3e 100644 --- a/nixos/modules/services/networking/dhcpcd.nix +++ b/nixos/modules/services/networking/dhcpcd.nix @@ -81,9 +81,12 @@ let noipv6 ''} - ${cfg.extraConfig} + ${optionalString (config.networking.enableIPv6 && cfg.IPv6rs == null && staticIPv6Addresses != [ ]) noIPv6rs} + ${optionalString (config.networking.enableIPv6 && cfg.IPv6rs == false) '' + noipv6rs + ''} - ${optionalString config.networking.enableIPv6 noIPv6rs} + ${cfg.extraConfig} ''; exitHook = pkgs.writeText "dhcpcd.exit-hook" @@ -160,6 +163,16 @@ in ''; }; + networking.dhcpcd.IPv6rs = mkOption { + type = types.nullOr types.bool; + default = null; + description = lib.mdDoc '' + Force enable or disable solicitation and receipt of IPv6 Router Advertisements. + This is required, for example, when using a static unique local IPv6 address (ULA) + and global IPv6 address auto-configuration with SLAAC. + ''; + }; + networking.dhcpcd.runHook = mkOption { type = types.lines; default = "";