summaryrefslogtreecommitdiff
path: root/src/PVE/Network/SDN/Subnets.pm
diff options
context:
space:
mode:
authorStefan Hanreich <s.hanreich@proxmox.com>2023-11-21 13:40:12 +0100
committerWolfgang Bumiller <w.bumiller@proxmox.com>2023-11-21 14:48:36 +0100
commit04e1c8ed739bb04afcf9abdef5f64ef7e79d18ad (patch)
treeea369b139a7e7547331665d4ce19adeb4f089179 /src/PVE/Network/SDN/Subnets.pm
parent5ab15238af15645a8ebbdf5703f365e0c6644b41 (diff)
dhcp: fix allocating IP for every defined dhcp-range
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>
Diffstat (limited to 'src/PVE/Network/SDN/Subnets.pm')
-rw-r--r--src/PVE/Network/SDN/Subnets.pm2
1 files changed, 1 insertions, 1 deletions
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);