From dbc0e14f63dc368ca8668291ad42980a3e39567a Mon Sep 17 00:00:00 2001 From: Astro Date: Tue, 14 Nov 2023 23:30:41 +0100 Subject: [PATCH] nixos-module/container/dhcp-server: don't set max-valid-lifetime but hold-reclaimed-time hope that works without depleting the address pools --- nix/nixos-module/container/dhcp-server.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nix/nixos-module/container/dhcp-server.nix b/nix/nixos-module/container/dhcp-server.nix index c4c00ea..79518c0 100644 --- a/nix/nixos-module/container/dhcp-server.nix +++ b/nix/nixos-module/container/dhcp-server.nix @@ -29,6 +29,8 @@ in # TODO: use with kea >= 2.5.0 # ddns-conflict-resolution-mode = "check-exists-with-dhcid"; ddns-use-conflict-resolution = false; + expired-leases-processing.hold-reclaimed-time = builtins.foldl' lib.max + 3600 (concatMapDhcpNets (net: { dhcp, ... }: dhcp.max-time)); subnet4 = concatMapDhcpNets (net: { vlan, subnet4, hosts4, dhcp, domainName, ... }: { id = vlan; @@ -36,8 +38,9 @@ in pools = [ { pool = "${dhcp.start} - ${dhcp.end}"; } ]; + renew-timer = builtins.ceil (.5 * dhcp.time); + rebind-timer = builtins.ceil (.85 * dhcp.time); valid-lifetime = dhcp.time; - max-valid-lifetime = dhcp.max-time; option-data = [ { space = "dhcp4"; name = "routers";