all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH network] api: sdn: fix null vmid for tap/veth ports on bridges api call
Date: Tue, 18 Nov 2025 14:54:45 +0100	[thread overview]
Message-ID: <20251118135447.337323-1-g.goller@proxmox.com> (raw)

When using an interface without a firewall on a VM or container, it
results in tap<vmid>i<index> or veth<vmid>i<index> bridge ports.
Previously, a single regex with multiple options caused incorrect
capture group variables, $1 and $2 would always refer to the first group
(fwpr) even if we matched on e.g. `veth`. Split into separate matches.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
Reported-by: Friedrich Weber <f.weber@proxmox.com>
---
 src/PVE/API2/Network/SDN/Nodes/Zone.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/PVE/API2/Network/SDN/Nodes/Zone.pm b/src/PVE/API2/Network/SDN/Nodes/Zone.pm
index f86ad1ead271..c1e48da70dd1 100644
--- a/src/PVE/API2/Network/SDN/Nodes/Zone.pm
+++ b/src/PVE/API2/Network/SDN/Nodes/Zone.pm
@@ -269,7 +269,13 @@ __PACKAGE__->register_method({
                     name => $ifname,
                 };
 
-                if ($ifname =~ m/^(?:fwpr(\d+)p(\d+)|veth(\d+)i(\d+)|tap(\d+)i(\d+))$/) {
+                if ($ifname =~ m/^fwpr(\d+)p(\d+)$/) {
+                    $port->{vmid} = $1;
+                    $port->{index} = "net$2";
+                } elsif ($ifname =~ m/^veth(\d+)i(\d+)$/) {
+                    $port->{vmid} = $1;
+                    $port->{index} = "net$2";
+                } elsif ($ifname =~ m/^tap(\d+)i(\d+)$/) {
                     $port->{vmid} = $1;
                     $port->{index} = "net$2";
                 }
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


             reply	other threads:[~2025-11-18 13:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-18 13:54 Gabriel Goller [this message]
2025-11-18 14:19 ` Thomas Lamprecht

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=20251118135447.337323-1-g.goller@proxmox.com \
    --to=g.goller@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