public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Lou Lecrivain via pve-devel <pve-devel@lists.proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Lou Lecrivain <lou.lecrivain@wdz.de>
Subject: [pve-devel] SPAM: [PATCH pve-network v2 2/4] dhcp: always generate dhcp-range for dnsmasq
Date: Mon,  9 Dec 2024 12:31:56 +0100	[thread overview]
Message-ID: <mailman.92.1733743977.332.pve-devel@lists.proxmox.com> (raw)
In-Reply-To: <20241209113158.7343-1-lou.lecrivain@wdz.de>

[-- Attachment #1: Type: message/rfc822, Size: 5859 bytes --]

From: Lou Lecrivain <lou.lecrivain@wdz.de>
To: pve-devel@lists.proxmox.com
Subject: SPAM: [PATCH pve-network v2 2/4] dhcp: always generate dhcp-range for dnsmasq
Date: Mon,  9 Dec 2024 12:31:56 +0100
Message-ID: <20241209113158.7343-3-lou.lecrivain@wdz.de>

(configure_range is now noop)

Signed-off-by: lou lecrivain <lou.lecrivain@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



[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

  parent reply	other threads:[~2024-12-09 11:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20241209113158.7343-1-lou.lecrivain@wdz.de>
2024-12-09 11:31 ` [pve-devel] SPAM: [PATCH pve-network v2 1/4] vnet: do not skip if no range is defined, ask for allocation inside prefix instead Lou Lecrivain via pve-devel
2024-12-12 13:58   ` Stefan Hanreich
2024-12-09 11:31 ` Lou Lecrivain via pve-devel [this message]
2024-12-09 11:31 ` [pve-devel] SPAM: [PATCH pve-network v2 3/4] fix: register details in pve ipam db for add_next_freeip Lou Lecrivain via pve-devel
2024-12-09 11:31 ` [pve-devel] SPAM: [PATCH pve-network v2 4/4] update tests following changes to behaviour: - allocating IPs also when prefix-only - PVE IPAM register details for every allocation strategy Lou Lecrivain via pve-devel
     [not found] ` <20241209113158.7343-3-lou.lecrivain@wdz.de>
2024-12-12 13:52   ` [pve-devel] (no subject) Stefan Hanreich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mailman.92.1733743977.332.pve-devel@lists.proxmox.com \
    --to=pve-devel@lists.proxmox.com \
    --cc=lou.lecrivain@wdz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal