From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 199811FF0B2 for ; Mon, 24 Aug 2026 15:42:57 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id E33E42160B; Mon, 24 Aug 2026 15:42:54 +0200 (CEST) From: Hannes Laimer 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 Message-ID: <20260824134244.1066515-1-h.laimer@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1787578940430 X-SPAM-LEVEL: Spam detection results: 0 AWL 1.101 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: QT7DY6X3E3RWWEXVMSUZ2IO2ANAZIV6F X-Message-ID-Hash: QT7DY6X3E3RWWEXVMSUZ2IO2ANAZIV6F X-MailFrom: h.laimer@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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