* [pve-devel] SPAM: [PATCH pve-network 1/2] vnet: do not skip if no range is defined, ask for allocation inside prefix instead
[not found] <20241128170942.4717-1-lou.lecrivain@wdz.de>
@ 2024-11-28 17:09 ` Lou Lecrivain via pve-devel
2024-12-05 16:08 ` Stefan Hanreich
2024-11-28 17:09 ` [pve-devel] SPAM: [PATCH pve-network 2/2] dhcp: generate dhcp-range for dnsmasq even when no dhcp_ranges exist Lou Lecrivain via pve-devel
1 sibling, 1 reply; 5+ messages in thread
From: Lou Lecrivain via pve-devel @ 2024-11-28 17:09 UTC (permalink / raw)
To: pve-devel; +Cc: Lou Lecrivain
[-- Attachment #1: Type: message/rfc822, Size: 5055 bytes --]
From: Lou Lecrivain <lou.lecrivain@wdz.de>
To: pve-devel@lists.proxmox.com
Subject: SPAM: [PATCH pve-network 1/2] vnet: do not skip if no range is defined, ask for allocation inside prefix instead
Date: Thu, 28 Nov 2024 18:09:41 +0100
Message-ID: <20241128170942.4717-2-lou.lecrivain@wdz.de>
Signed-off-by: lou lecrivain <lou.lecrivain@wdz.de>
---
src/PVE/Network/SDN/Vnets.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/PVE/Network/SDN/Vnets.pm b/src/PVE/Network/SDN/Vnets.pm
index 45292e3..30e8fdb 100644
--- a/src/PVE/Network/SDN/Vnets.pm
+++ b/src/PVE/Network/SDN/Vnets.pm
@@ -118,11 +118,11 @@ sub add_next_free_cidr {
my $network = $subnet->{network};
next if Net::IP::ip_get_version($network) != $ipversion || $ips->{$ipversion};
- next if !$subnet->{'dhcp-range'};
+ my $subnet_dhcprange = !$subnet->{'dhcp-range'} ? 0 : $dhcprange;
$subnetcount++;
eval {
- $ip = PVE::Network::SDN::Subnets::add_next_free_ip($zone, $subnetid, $subnet, $hostname, $mac, $vmid, $skipdns, $dhcprange);
+ $ip = PVE::Network::SDN::Subnets::add_next_free_ip($zone, $subnetid, $subnet, $hostname, $mac, $vmid, $skipdns, $subnet_dhcprange);
};
die $@ if $@;
--
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pve-devel] SPAM: [PATCH pve-network 2/2] dhcp: generate dhcp-range for dnsmasq even when no dhcp_ranges exist
[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-11-28 17:09 ` Lou Lecrivain via pve-devel
2024-12-05 16:20 ` Stefan Hanreich
1 sibling, 1 reply; 5+ messages in thread
From: Lou Lecrivain via pve-devel @ 2024-11-28 17:09 UTC (permalink / raw)
To: pve-devel; +Cc: Lou Lecrivain
[-- 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
^ permalink raw reply [flat|nested] 5+ messages in thread