diff options
author | Linus Heckemann <git@sphalerite.org> | 2019-07-14 19:27:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-14 19:27:54 +0200 |
commit | a935eff7fa56672adf331f038af3f9a99347caa7 (patch) | |
tree | e3c62c7d7a5b18021f94fc8f52a48e612d4843d9 /nixos/modules | |
parent | 1a10f17cf620907ab62ad6695810a038cf97fa6d (diff) | |
parent | 1738283e6e53267ed1999daedccfb1a6ca3306b7 (diff) | |
download | nixpkgs-a935eff7fa56672adf331f038af3f9a99347caa7.tar nixpkgs-a935eff7fa56672adf331f038af3f9a99347caa7.tar.gz nixpkgs-a935eff7fa56672adf331f038af3f9a99347caa7.tar.bz2 nixpkgs-a935eff7fa56672adf331f038af3f9a99347caa7.tar.lz nixpkgs-a935eff7fa56672adf331f038af3f9a99347caa7.tar.xz nixpkgs-a935eff7fa56672adf331f038af3f9a99347caa7.tar.zst nixpkgs-a935eff7fa56672adf331f038af3f9a99347caa7.zip |
Merge pull request #62835 from lheckemann/ipv6-privacy-extensions
Ipv6 privacy extensions
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/tasks/network-interfaces.nix | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index f9b0eb330bf..1a13e386947 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -1087,7 +1087,24 @@ in virtualisation.vswitch = mkIf (cfg.vswitches != { }) { enable = true; }; - services.udev.packages = mkIf (cfg.wlanInterfaces != {}) [ + services.udev.packages = [ + (pkgs.writeTextFile rec { + name = "ipv6-privacy-extensions.rules"; + destination = "/etc/udev/rules.d/98-${name}"; + text = '' + # enable and prefer IPv6 privacy addresses by default + ACTION=="add", SUBSYSTEM=="net", RUN+="${pkgs.procps}/bin/sysctl net.ipv6.conf.%k.use_tempaddr=2" + ''; + }) + (pkgs.writeTextFile rec { + name = "ipv6-privacy-extensions.rules"; + destination = "/etc/udev/rules.d/99-${name}"; + text = concatMapStrings (i: '' + # enable IPv6 privacy addresses but prefer EUI-64 addresses for ${i.name} + ACTION=="add", SUBSYSTEM=="net", RUN+="${pkgs.procps}/bin/sysctl net.ipv6.conf.${i.name}.use_tempaddr=1" + '') (filter (i: !i.preferTempAddress) interfaces); + }) + ] ++ lib.optional (cfg.wlanInterfaces != {}) (pkgs.writeTextFile { name = "99-zzz-40-wlanInterfaces.rules"; destination = "/etc/udev/rules.d/99-zzz-40-wlanInterfaces.rules"; @@ -1161,8 +1178,7 @@ in # Generate the same systemd events for both 'add' and 'move' udev events. ACTION=="move", SUBSYSTEM=="net", ENV{DEVTYPE}=="wlan", NAME=="${device}", ${systemdAttrs curInterface._iName} ''); - }) ]; - + }); }; } |