Lease time is the convergence knob for mapping edits: a client picks up a changed record at the latest one lease after the edit. Make it configurable per subnet for dhcp backends that honor it.
Signed-off-by: Hannes Laimer <[email protected]> --- src/PVE/Network/SDN/Dhcp/Dnsmasq.pm | 3 ++- src/PVE/Network/SDN/SubnetPlugin.pm | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm index 4677330..861a3ed 100644 --- a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm +++ b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm @@ -185,7 +185,8 @@ sub configure_subnet { $mask = join('.', unpack("C4", pack("N", $mask))); } - push @{$config}, "dhcp-range=set:$tag,$network,static,$mask,infinite"; + my $lease = $subnet_config->{'dhcp-lease-time'} // 'infinite'; + push @{$config}, "dhcp-range=set:$tag,$network,static,$mask,$lease"; my $option_string; if (ip_is_ipv6($subnet_config->{network})) { diff --git a/src/PVE/Network/SDN/SubnetPlugin.pm b/src/PVE/Network/SDN/SubnetPlugin.pm index e2a0e50..c362c78 100644 --- a/src/PVE/Network/SDN/SubnetPlugin.pm +++ b/src/PVE/Network/SDN/SubnetPlugin.pm @@ -177,6 +177,14 @@ sub properties { description => 'IP address for the DNS server', optional => 1, }, + 'dhcp-lease-time' => { + type => 'integer', + minimum => 60, + description => + 'Lease time in seconds for DHCP answers. Without it dnsmasq hands out' + . ' infinite leases and the ebpf responder ten minutes.', + optional => 1, + }, }; } @@ -189,6 +197,7 @@ sub options { dnszoneprefix => { optional => 1 }, 'dhcp-range' => { optional => 1 }, 'dhcp-dns-server' => { optional => 1 }, + 'dhcp-lease-time' => { optional => 1 }, }; } -- 2.47.3
