From 996ed0830e052fb32546ea317eb01d910a975c9e Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Sun, 18 Feb 2018 23:40:22 +0300 Subject: [PATCH 1/3] dhcpcd service: always want by multi-user When default gateways were specified the service wasn't wanted by anything at all before. --- nixos/modules/services/networking/dhcpcd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/dhcpcd.nix b/nixos/modules/services/networking/dhcpcd.nix index d283c7624335..f0f8f1324c5b 100644 --- a/nixos/modules/services/networking/dhcpcd.nix +++ b/nixos/modules/services/networking/dhcpcd.nix @@ -160,7 +160,7 @@ in in { description = "DHCP Client"; - wantedBy = optional (!hasDefaultGatewaySet) "network-online.target"; + wantedBy = [ "multi-user.target" ] ++ optional (!hasDefaultGatewaySet) "network-online.target"; after = [ "network.target" ]; wants = [ "network.target" ]; From 5ff25fcd7ebc18fe3a0f73fd95831fb267b06734 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Sun, 18 Feb 2018 23:42:03 +0300 Subject: [PATCH 2/3] dhcpcd service: want for both IP stacks We want to wait for both stacks to be active before declaring that network is active. So either both default gateways must be specified or only IPv4 if IPv6 is disabled to avoid dhcpcd for network-online.target. --- nixos/modules/services/networking/dhcpcd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/dhcpcd.nix b/nixos/modules/services/networking/dhcpcd.nix index f0f8f1324c5b..e2127518f1ae 100644 --- a/nixos/modules/services/networking/dhcpcd.nix +++ b/nixos/modules/services/networking/dhcpcd.nix @@ -156,7 +156,7 @@ in systemd.services.dhcpcd = let cfgN = config.networking; hasDefaultGatewaySet = (cfgN.defaultGateway != null && cfgN.defaultGateway.address != "") - || (cfgN.defaultGateway6 != null && cfgN.defaultGateway6.address != ""); + && (!cfgN.enableIPv6 || (cfgN.defaultGateway6 != null && cfgN.defaultGateway6.address != "")); in { description = "DHCP Client"; From d77984f571b11811240414d55b61390d9b90b6f1 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Mon, 19 Feb 2018 23:30:49 +0300 Subject: [PATCH 3/3] network-interfaces-scripted service: delay setup if IPv6 is disabled Even if IPv6 gateway is set, there's no need to set it early if IPv6 is disabled. --- nixos/modules/tasks/network-interfaces-scripted.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/tasks/network-interfaces-scripted.nix b/nixos/modules/tasks/network-interfaces-scripted.nix index 63d07832d105..2687a64ff4c2 100644 --- a/nixos/modules/tasks/network-interfaces-scripted.nix +++ b/nixos/modules/tasks/network-interfaces-scripted.nix @@ -80,7 +80,7 @@ let else optional (dev != null && dev != "lo" && !config.boot.isContainer) (subsystemDevice dev); hasDefaultGatewaySet = (cfg.defaultGateway != null && cfg.defaultGateway.address != "") - || (cfg.defaultGateway6 != null && cfg.defaultGateway6.address != ""); + || (cfg.enableIPv6 && cfg.defaultGateway6 != null && cfg.defaultGateway6.address != ""); networkLocalCommands = { after = [ "network-setup.service" ];