public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH pve-network] sdn: ipam: fix dual-stack per-MAC lookup in the PVE plugin
@ 2026-08-24 13:42 Hannes Laimer
  0 siblings, 0 replies; only message in thread
From: Hannes Laimer @ 2026-08-24 13:42 UTC (permalink / raw)
  To: pve-devel

The subnet loop skipped every remaining subnet once a v6 address was
found, dropping a v4 record living in a later subnet. Which subnet comes
first is hash order, so in a dual-stack zone the v4 half of the answer
went missing at random. The intended v4 short-circuit never fired
either, since subnet keys are CIDR strings and ip_is_ipv4 returns false
for those.

Skip a subnet only when its own family is already answered.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
 src/PVE/Network/SDN/Ipams/PVEPlugin.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Network/SDN/Ipams/PVEPlugin.pm b/src/PVE/Network/SDN/Ipams/PVEPlugin.pm
index d2aba1e..a26da57 100644
--- a/src/PVE/Network/SDN/Ipams/PVEPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/PVEPlugin.pm
@@ -287,8 +287,9 @@ sub get_ips_from_mac {
     my $subnets = $dbzone->{subnets};
 
     for my $subnet (keys %$subnets) {
-        next if Net::IP::ip_is_ipv4($subnet) && $ip4;
-        next if $ip6;
+        # subnet keys are CIDRs, Net::IP only recognizes bare IPs
+        my ($network) = split(m|/|, $subnet);
+        next if Net::IP::ip_is_ipv4($network) ? $ip4 : $ip6;
         my $ips = $subnets->{$subnet}->{ips};
         for my $ip (keys %$ips) {
             my $ipobject = $ips->{$ip};
-- 
2.47.3





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-24 13:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-24 13:42 [PATCH pve-network] sdn: ipam: fix dual-stack per-MAC lookup in the PVE plugin Hannes Laimer

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