* [pve-devel] [PATCH network] api: sdn: fix null vmid for tap/veth ports on bridges api call
@ 2025-11-18 13:54 Gabriel Goller
2025-11-18 14:19 ` Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Gabriel Goller @ 2025-11-18 13:54 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-18 14:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-18 13:54 [pve-devel] [PATCH network] api: sdn: fix null vmid for tap/veth ports on bridges api call Gabriel Goller
2025-11-18 14:19 ` Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox