From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-network] dhcp: fix allocating IP for every defined dhcp-range
Date: Tue, 21 Nov 2023 13:40:12 +0100 [thread overview]
Message-ID: <20231121124012.233082-1-s.hanreich@proxmox.com> (raw)
Due to the wrong check an IP was allocated for every DHCP range,
instead of only allocating an IP in the first free DHCP range.
Suggested-By: Stefan Lendl <s.lendl@proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
The fix I talked about off-list was actually unrelated to this. It
prevented allocating IP addresses in multiple IPv4/6 subnets, not
allocating multiple IP addresses for multiple DHCP ranges. So I did
not remove anything in this patch.
src/PVE/Network/SDN/Subnets.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/PVE/Network/SDN/Subnets.pm b/src/PVE/Network/SDN/Subnets.pm
index b05b3d9..8e2a6aa 100644
--- a/src/PVE/Network/SDN/Subnets.pm
+++ b/src/PVE/Network/SDN/Subnets.pm
@@ -238,7 +238,7 @@ sub add_next_free_ip {
foreach my $range (@$dhcp_ranges) {
$ip = $plugin->add_range_next_freeip($plugin_config, $subnet, $range, $data);
- next if !$ip;
+ last if $ip;
}
} else {
$ip = $plugin->add_next_freeip($plugin_config, $subnetid, $subnet, $hostname, $mac, $vmid);
--
2.39.2
next reply other threads:[~2023-11-21 12:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-21 12:40 Stefan Hanreich [this message]
2023-11-21 13:51 ` [pve-devel] applied: " Wolfgang Bumiller
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=20231121124012.233082-1-s.hanreich@proxmox.com \
--to=s.hanreich@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal