--- Begin Message ---
(configure_range is now noop)

Signed-off-by: lou lecrivain <lou.lecriv...@wdz.de>
---
 src/PVE/Network/SDN/Dhcp.pm         |  3 ++-
 src/PVE/Network/SDN/Dhcp/Dnsmasq.pm | 23 ++++++++++-------------
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/PVE/Network/SDN/Dhcp.pm b/src/PVE/Network/SDN/Dhcp.pm
index d48de34..3ee18e0 100644
--- a/src/PVE/Network/SDN/Dhcp.pm
+++ b/src/PVE/Network/SDN/Dhcp.pm
@@ -98,11 +98,12 @@ sub regenerate_config {
                my $subnet_config = $subnets->{$subnet_id};
                my $dhcp_ranges = 
PVE::Network::SDN::Subnets::get_dhcp_ranges($subnet_config);
 
+               next if !$dhcp_ranges;
                my ($zone, $subnet_network, $subnet_mask) = split(/-/, 
$subnet_id);
                next if $zone ne $zoneid;
-               next if !$dhcp_ranges;
 
                eval { $dhcp_plugin->configure_subnet($config, $zoneid, 
$vnetid, $subnet_config) };
+
                warn "Could not configure subnet $subnet_id: $@\n" if $@;
 
                foreach my $dhcp_range (@$dhcp_ranges) {
diff --git a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm 
b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
index ae52d31..263d24f 100644
--- a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
+++ b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
@@ -129,6 +129,15 @@ sub configure_subnet {
 
     my $tag = $subnet_config->{id};
 
+    my ($zone, $network, $mask) = split(/-/, $tag);
+
+    if (Net::IP::ip_is_ipv4($network)) {
+       $mask = (2 ** $mask - 1) << (32 - $mask);
+       $mask = join( '.', unpack( "C4", pack( "N", $mask ) ) );
+    }
+
+    push @{$config}, "dhcp-range=set:$tag,$network,static,$mask,infinite";
+
     my $option_string;
     if (ip_is_ipv6($subnet_config->{network})) {
        $option_string = 'option6';
@@ -139,22 +148,10 @@ sub configure_subnet {
 
     push @{$config}, 
"dhcp-option=tag:$tag,$option_string:dns-server,$subnet_config->{'dhcp-dns-server'}"
        if $subnet_config->{'dhcp-dns-server'};
-
 }
 
 sub configure_range {
-    my ($class, $config, $dhcpid, $vnetid, $subnet_config, $range_config) = @_;
-
-    my $tag = $subnet_config->{id};
-
-    my ($zone, $network, $mask) = split(/-/, $tag);
-
-    if (Net::IP::ip_is_ipv4($network)) {
-       $mask = (2 ** $mask - 1) << (32 - $mask);
-       $mask = join( '.', unpack( "C4", pack( "N", $mask ) ) );
-    }
-
-    push @{$config}, "dhcp-range=set:$tag,$network,static,$mask,infinite";
+    # noop, everything is done within configure_subnet
 }
 
 sub configure_vnet {
-- 
2.39.5



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

Reply via email to