[pve-devel] [RFC pve-network 2/3] always generate dnsmasq ethers file
Stefan Lendl
s.lendl at proxmox.com
Fri Oct 27 13:20:18 CEST 2023
Makes dnsmasq stateless and can be generated from the IPAM.
On dhcp_add_ip always generate the entire ethers file.
Signed-off-by: Stefan Lendl <s.lendl at proxmox.com>
---
src/PVE/Network/SDN/Dhcp.pm | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/PVE/Network/SDN/Dhcp.pm b/src/PVE/Network/SDN/Dhcp.pm
index b92c73a..b854cce 100644
--- a/src/PVE/Network/SDN/Dhcp.pm
+++ b/src/PVE/Network/SDN/Dhcp.pm
@@ -87,8 +87,14 @@ sub add_mapping {
next if !$ip;
+ # generates ethers file every time
+ my $ipam_db = $ipam_plugin->read_db();
+ my $dbzone = $ipam_db->{zones}->{$subnet_config->{zone}};
+ my $dbsubnet = $dbzone->{subnets}->{$subnet_config->{cidr}};
+ my $dbsubnet_ips = $dbsubnet->{ips};
+
my $dhcp_plugin = PVE::Network::SDN::Dhcp::Plugin->lookup($dhcp_config->{type});
- $dhcp_plugin->add_ip_mapping($dhcp_config, $mac, $ip);
+ $dhcp_plugin->generate_config($dhcp_config, $dbsubnet_ips);
return $ip;
}
--
2.41.0
More information about the pve-devel
mailing list