all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-network] sdn: ipam: fix dual-stack per-MAC lookup in the PVE plugin
Date: Mon, 24 Aug 2026 15:42:44 +0200	[thread overview]
Message-ID: <20260824134244.1066515-1-h.laimer@proxmox.com> (raw)

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





                 reply	other threads:[~2026-08-24 13:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260824134244.1066515-1-h.laimer@proxmox.com \
    --to=h.laimer@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