From c26c6241eae93985c33590401fda971d7574c136 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Mon, 23 Sep 2019 16:37:58 +0200 Subject: networking.useDHCP: disallow for networkd This setting will be removed with the switch to systemd-networkd. The use of per interface config is encouraged instead. --- nixos/modules/tasks/network-interfaces-systemd.nix | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'nixos/modules/tasks') diff --git a/nixos/modules/tasks/network-interfaces-systemd.nix b/nixos/modules/tasks/network-interfaces-systemd.nix index 34e27066715..605d00de58f 100644 --- a/nixos/modules/tasks/network-interfaces-systemd.nix +++ b/nixos/modules/tasks/network-interfaces-systemd.nix @@ -38,6 +38,12 @@ in } { assertion = cfg.defaultGateway6 == null || cfg.defaultGateway6.interface == null; message = "networking.defaultGateway6.interface is not supported by networkd."; + } { + assertion = cfg.useDHCP == false; + message = '' + networking.useDHCP is not supported by networkd. + Please use per interface configuration and set the global option to false. + ''; } ] ++ flip mapAttrsToList cfg.bridges (n: { rstp, ... }: { assertion = !rstp; message = "networking.bridges.${n}.rstp is not supported by networkd."; @@ -56,9 +62,7 @@ in genericNetwork = override: let gateway = optional (cfg.defaultGateway != null) cfg.defaultGateway.address ++ optional (cfg.defaultGateway6 != null) cfg.defaultGateway6.address; - in { - DHCP = override (dhcpStr cfg.useDHCP); - } // optionalAttrs (gateway != [ ]) { + in optionalAttrs (gateway != [ ]) { routes = override [ { routeConfig = { @@ -97,7 +101,7 @@ in networks."40-${i.name}" = mkMerge [ (genericNetwork mkDefault) { name = mkDefault i.name; DHCP = mkForce (dhcpStr - (if i.useDHCP != null then i.useDHCP else cfg.useDHCP && interfaceIps i == [ ])); + (if i.useDHCP != null then i.useDHCP else false)); address = forEach (interfaceIps i) (ip: "${ip.address}/${toString ip.prefixLength}"); networkConfig.IPv6PrivacyExtensions = "kernel"; -- cgit 1.4.1 From e862dd637350ddd1812a6c1fb5811c6464e74ff5 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Tue, 24 Sep 2019 09:36:49 +0200 Subject: networking.useDHCP: add release notes and docs --- nixos/doc/manual/release-notes/rl-1909.xml | 8 ++++++++ nixos/modules/tasks/network-interfaces.nix | 5 +++++ 2 files changed, 13 insertions(+) (limited to 'nixos/modules/tasks') diff --git a/nixos/doc/manual/release-notes/rl-1909.xml b/nixos/doc/manual/release-notes/rl-1909.xml index 58ab7207f53..012c2e4f992 100644 --- a/nixos/doc/manual/release-notes/rl-1909.xml +++ b/nixos/doc/manual/release-notes/rl-1909.xml @@ -484,6 +484,14 @@ (citrix_workspace). + + + The option is unsupported in combination with + in anticipation of defaulting to it by default. + It has to be set to false and enabled per + interface with + + diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 5bf7b0d227f..834ce758410 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -903,6 +903,11 @@ in Whether to use DHCP to obtain an IP address and other configuration for all network interfaces that are not manually configured. + + Using this option is highly discouraged and also incompatible with + . Please use + instead + and set this to false. ''; }; -- cgit 1.4.1