From 7b78f0f098aebdeb6316fc066a4cdeaf62e37abd Mon Sep 17 00:00:00 2001 From: Andreas Rammhold Date: Wed, 8 Jan 2020 19:36:00 +0100 Subject: nixos/networkd: remove CriticalConnection= fields in favor of KeepConnection Systemd upstream has deprecated CriticalConnection with v244 in favor of KeepConnection as that seems to be more flexible: The CriticalConnection= setting in .network files is now deprecated, and replaced by a new KeepConfiguration= setting which allows more detailed configuration of the IP configuration to keep in place. --- nixos/doc/manual/release-notes/rl-2009.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'nixos/doc/manual') diff --git a/nixos/doc/manual/release-notes/rl-2009.xml b/nixos/doc/manual/release-notes/rl-2009.xml index 1cf7c977eeb0..1b40a84be554 100644 --- a/nixos/doc/manual/release-notes/rl-2009.xml +++ b/nixos/doc/manual/release-notes/rl-2009.xml @@ -290,6 +290,16 @@ environment.systemPackages = [ has been set to true. + + + The systemd-networkd option + systemd.network.networks.<name>.dhcp.CriticalConnection + has been removed following upstream systemd's deprecation of the same. It is recommended to use + systemd.network.networks.<name>.networkConfig.KeepConfiguration instead. + See systemd.network + 5 for details. + + -- cgit 1.4.1 From 819e8bb35f4a8371ee6af77dba9b8860041956b6 Mon Sep 17 00:00:00 2001 From: Andreas Rammhold Date: Wed, 8 Jan 2020 20:18:26 +0100 Subject: nixos/networkd: rename the networkd dhcpConfig option to dhcpV4Config This follows upstreams change in documentation. While the `[DHCP]` section might still work it is undocumented and we should probably not be using it anymore. Users can just upgrade to the new option without much hassle. I had to create a bit of custom module deprecation code since the usual approach doesn't support wildcards in the path. --- nixos/doc/manual/release-notes/rl-2009.xml | 11 +++++++++++ nixos/modules/system/boot/networkd.nix | 23 +++++++++++++++-------- nixos/modules/virtualisation/nixos-containers.nix | 2 +- 3 files changed, 27 insertions(+), 9 deletions(-) (limited to 'nixos/doc/manual') diff --git a/nixos/doc/manual/release-notes/rl-2009.xml b/nixos/doc/manual/release-notes/rl-2009.xml index 1b40a84be554..54136ad55cdd 100644 --- a/nixos/doc/manual/release-notes/rl-2009.xml +++ b/nixos/doc/manual/release-notes/rl-2009.xml @@ -300,6 +300,17 @@ environment.systemPackages = [ 5 for details. + + + The systemd-networkd option + systemd.network.networks._name_.dhcpConfig + has been renamed to + + following upstream systemd's documentation change. + See systemd.network + 5 for details. + + diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index c4790f59dff6..887d1de95ff3 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -275,13 +275,13 @@ let ]) ]; - checkDhcp = checkUnitConfig "DHCP" [ + checkDhcpV4 = checkUnitConfig "DHCPv4" [ (assertOnlyFields [ "UseDNS" "RoutesToDNS" "UseNTP" "UseMTU" "Anonymize" "SendHostname" "UseHostname" "Hostname" "UseDomains" "UseRoutes" "UseTimezone" "ClientIdentifier" "VendorClassIdentifier" "UserClass" "MaxAttempts" "DUIDType" "DUIDRawData" "IAID" "RequestBroadcast" "RouteMetric" "RouteTable" - "ListenPort" "SendRelease" "RapidCommit" + "ListenPort" "SendRelease" ]) (assertValueOneOf "UseDNS" boolValues) (assertValueOneOf "RoutesToDNS" boolValues) @@ -298,7 +298,6 @@ let (assertInt "RouteTable") (assertMinimum "RouteTable" 0) (assertValueOneOf "SendRelease" boolValues) - (assertValueOneOf "RapidCommit" boolValues) ]; checkDhcpV6 = checkUnitConfig "DHCPv6" [ @@ -649,13 +648,20 @@ let ''; }; + # systemd.network.networks.*.dhcpConfig has been deprecated in favor of ….dhcpV4Config + # Produce a nice warning message so users know it is gone. dhcpConfig = mkOption { + visible = false; + apply = _: throw "The option `systemd.network.networks.*.dhcpConfig` can no longer be used since it's been removed. Please use `systemd.network.networks.*.dhcpV4Config` instead."; + }; + + dhcpV4Config = mkOption { default = {}; example = { UseDNS = true; UseRoutes = true; }; - type = types.addCheck (types.attrsOf unitOption) checkDhcp; + type = types.addCheck (types.attrsOf unitOption) checkDhcpV4; description = '' Each attribute in this set specifies an option in the - [DHCP] section of the unit. See + [DHCPv4] section of the unit. See systemd.network 5 for details. ''; @@ -998,9 +1004,9 @@ let ${concatStringsSep "\n" (map (s: "Tunnel=${s}") def.tunnel)} ${concatStringsSep "\n" (map (s: "Xfrm=${s}") def.xfrm)} - ${optionalString (def.dhcpConfig != { }) '' - [DHCP] - ${attrsToSection def.dhcpConfig} + ${optionalString (def.dhcpV4Config != { }) '' + [DHCPv4] + ${attrsToSection def.dhcpV4Config} ''} ${optionalString (def.dhcpV6Config != {}) '' @@ -1084,6 +1090,7 @@ in }; config = mkMerge [ + # .link units are honored by udev, no matter if systemd-networkd is enabled or not. { systemd.network.units = mapAttrs' (n: v: nameValuePair "${n}.link" (linkToUnit n v)) cfg.links; diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix index 016d68ea3018..b0fa03917c82 100644 --- a/nixos/modules/virtualisation/nixos-containers.nix +++ b/nixos/modules/virtualisation/nixos-containers.nix @@ -546,7 +546,7 @@ in Note that this option might require to do some adjustments to the container configuration, e.g. you might want to set - systemd.network.networks.$interface.dhcpConfig.ClientIdentifier to "mac" + systemd.network.networks.$interface.dhcpV4Config.ClientIdentifier to "mac" if you use macvlans option. This way dhcp client identifier will be stable between the container restarts. -- cgit 1.4.1