Don't let interfaces get IPv6 addresses if networking.enableIPv6 is false
This commit is contained in:
parent
ac8db6fd33
commit
c8628e0293
|
@ -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";
|
||||
|
|
|
@ -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).
|
||||
|
|
Loading…
Reference in New Issue