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, ...}:
|
{config, pkgs, ...}:
|
||||||
|
|
||||||
with pkgs.lib;
|
with pkgs.lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.networking;
|
cfg = config.networking;
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
@ -43,7 +45,9 @@ in
|
|||||||
source = pkgs.writeText "hosts"
|
source = pkgs.writeText "hosts"
|
||||||
''
|
''
|
||||||
127.0.0.1 localhost
|
127.0.0.1 localhost
|
||||||
::1 localhost
|
${optionalString cfg.enableIPv6 ''
|
||||||
|
::1 localhost
|
||||||
|
''}
|
||||||
${cfg.extraHosts}
|
${cfg.extraHosts}
|
||||||
'';
|
'';
|
||||||
target = "hosts";
|
target = "hosts";
|
||||||
|
@ -278,6 +278,9 @@ in
|
|||||||
'')}
|
'')}
|
||||||
EOF
|
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.
|
# Set the default gateway.
|
||||||
${optionalString (cfg.defaultGateway != "") ''
|
${optionalString (cfg.defaultGateway != "") ''
|
||||||
# FIXME: get rid of "|| true" (necessary to make it idempotent).
|
# FIXME: get rid of "|| true" (necessary to make it idempotent).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user