0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00

nixos/dhcpcd: don't solicit or accept ipv6 router advertisements if use static addresses

This commit is contained in:
Izorkin 2023-01-04 18:05:13 +03:00
parent 83ba52e31a
commit 0e9cb9fcfd
No known key found for this signature in database
GPG key ID: 1436C1B3F3679F09
3 changed files with 18 additions and 0 deletions

View file

@ -33,6 +33,13 @@ let
(if !config.networking.useDHCP && enableDHCP then
map (i: i.name) (filter (i: i.useDHCP == true) interfaces) else null);
staticIPv6Addresses = map (i: i.name) (filter (i: i.ipv6.addresses != [ ]) interfaces);
noIPv6rs = concatStringsSep "\n" (map (name: ''
interface ${name}
noipv6rs
'') staticIPv6Addresses);
# Config file adapted from the one that ships with dhcpcd.
dhcpcdConf = pkgs.writeText "dhcpcd.conf"
''
@ -75,6 +82,8 @@ let
''}
${cfg.extraConfig}
${optionalString config.networking.enableIPv6 noIPv6rs}
'';
exitHook = pkgs.writeText "dhcpcd.exit-hook"