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.le...@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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to