[pve-devel] [PATCH network] api: sdn: fix null vmid for tap/veth ports on bridges api call
Gabriel Goller
g.goller at proxmox.com
Tue Nov 18 14:54:45 CET 2025
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 at proxmox.com>
Reported-by: Friedrich Weber <f.weber at 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
More information about the pve-devel
mailing list