]> git.puffer.fish Git - mirror/pve-network.git/commitdiff
dhcp: always generate dhcp-range for dnsmasq
authorLou Lecrivain <lou.lecrivain@wdz.de>
Fri, 13 Dec 2024 19:45:38 +0000 (20:45 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 7 Apr 2025 15:58:20 +0000 (17:58 +0200)
(configure_range is now noop)

Signed-off-by: lou lecrivain <lou.lecrivain@wdz.de>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Hannes Duerr <h.duerr@proxmox.com>
Link: https://lore.proxmox.com/mailman.183.1734119197.332.pve-devel@lists.proxmox.com
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Network/SDN/Dhcp.pm
src/PVE/Network/SDN/Dhcp/Dnsmasq.pm

index d48de3421568239e20ccb45d98c920c2f36c4c2f..8bbc210db4c9d6b0579d8395e0887be2e2a4d2b3 100644 (file)
@@ -100,7 +100,6 @@ sub regenerate_config {
 
                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 $@;
index ae52d3199e0fc51fd1401d7dd78085ad730e5588..263d24fa442558a9bb996d076f378e8027a89ea2 100644 (file)
@@ -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 {