Don't let interfaces get IPv6 addresses if networking.enableIPv6 is false

This commit is contained in:
Eelco Dolstra 2012-10-19 15:41:01 -04:00
parent ac8db6fd33
commit c8628e0293
2 changed files with 8 additions and 1 deletions

View file

@ -3,7 +3,9 @@
{config, pkgs, ...}:
with pkgs.lib;
let
cfg = config.networking;
options = {
@ -43,7 +45,9 @@ in
source = pkgs.writeText "hosts"
''
127.0.0.1 localhost
::1 localhost
${optionalString cfg.enableIPv6 ''
::1 localhost
''}
${cfg.extraHosts}
'';
target = "hosts";

View file

@ -278,6 +278,9 @@ in
'')}
EOF
# Disable or enable IPv6.
echo ${if cfg.enableIPv6 then "0" else "1"} > /proc/sys/net/ipv6/conf/all/disable_ipv6
# Set the default gateway.
${optionalString (cfg.defaultGateway != "") ''
# FIXME: get rid of "|| true" (necessary to make it idempotent).