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 2/2] dhcp: generate dhcp-range for dnsmasq even when no dhcp_ranges exist
Date: Thu, 28 Nov 2024 18:09:42 +0100 [thread overview]
Message-ID: <mailman.835.1732813827.391.pve-devel@lists.proxmox.com> (raw)
In-Reply-To: <20241128170942.4717-1-lou.lecrivain@wdz.de>
[-- Attachment #1: Type: message/rfc822, Size: 5939 bytes --]
From: Lou Lecrivain <lou.lecrivain@wdz.de>
To: pve-devel@lists.proxmox.com
Subject: SPAM: [PATCH pve-network 2/2] dhcp: generate dhcp-range for dnsmasq even when no dhcp_ranges exist
Date: Thu, 28 Nov 2024 18:09:42 +0100
Message-ID: <20241128170942.4717-3-lou.lecrivain@wdz.de>
Signed-off-by: lou lecrivain <lou.lecrivain@wdz.de>
---
src/PVE/Network/SDN/Dhcp.pm | 6 ++++--
src/PVE/Network/SDN/Dhcp/Dnsmasq.pm | 5 ++++-
src/PVE/Network/SDN/Dhcp/Plugin.pm | 2 +-
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/PVE/Network/SDN/Dhcp.pm b/src/PVE/Network/SDN/Dhcp.pm
index d48de34..6c4ad10 100644
--- a/src/PVE/Network/SDN/Dhcp.pm
+++ b/src/PVE/Network/SDN/Dhcp.pm
@@ -98,11 +98,13 @@ 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 $with_ranges = (scalar $dhcp_ranges->@* > 0);
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) };
+ eval { $dhcp_plugin->configure_subnet($config, $zoneid, $vnetid, $subnet_config, $with_ranges) };
+
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..0271e19 100644
--- a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
+++ b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
@@ -122,7 +122,7 @@ sub add_ip_mapping {
}
sub configure_subnet {
- my ($class, $config, $dhcpid, $vnetid, $subnet_config) = @_;
+ my ($class, $config, $dhcpid, $vnetid, $subnet_config, $with_ranges) = @_;
die "No gateway defined for subnet $subnet_config->{id}"
if !$subnet_config->{gateway};
@@ -140,6 +140,9 @@ sub configure_subnet {
push @{$config}, "dhcp-option=tag:$tag,$option_string:dns-server,$subnet_config->{'dhcp-dns-server'}"
if $subnet_config->{'dhcp-dns-server'};
+ if (!$with_ranges) {
+ $class->configure_range($config, $dhcpid, $vnetid, $subnet_config, undef);
+ }
}
sub configure_range {
diff --git a/src/PVE/Network/SDN/Dhcp/Plugin.pm b/src/PVE/Network/SDN/Dhcp/Plugin.pm
index 1757915..3ad4b7f 100644
--- a/src/PVE/Network/SDN/Dhcp/Plugin.pm
+++ b/src/PVE/Network/SDN/Dhcp/Plugin.pm
@@ -33,7 +33,7 @@ sub configure_range {
}
sub configure_subnet {
- my ($class, $config, $dhcpid, $vnetid, $subnet_config) = @_;
+ my ($class, $config, $dhcpid, $vnetid, $subnet_config, $with_ranges) = @_;
die 'implement in sub class';
}
--
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
next prev parent reply other threads:[~2024-11-28 17:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20241128170942.4717-1-lou.lecrivain@wdz.de>
2024-11-28 17:09 ` [pve-devel] SPAM: [PATCH pve-network 1/2] vnet: do not skip if no range is defined, ask for allocation inside prefix instead Lou Lecrivain via pve-devel
2024-12-05 16:08 ` Stefan Hanreich
2024-11-28 17:09 ` Lou Lecrivain via pve-devel [this message]
2024-12-05 16:20 ` [pve-devel] SPAM: [PATCH pve-network 2/2] dhcp: generate dhcp-range for dnsmasq even when no dhcp_ranges exist Stefan Hanreich
2024-12-06 10:33 ` Lou Lecrivain via pve-devel
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.835.1732813827.391.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