When creating a vlan zone and vnet, pve-network looks at all the
physical bridge ports (slaves) and adds them to the generated vlan
bridge. The zone plugin gets all the bridge interfaces using
`/sys/class/net` and then filters them using a regex. With the
introduction of network interface pinning, the restrictions on network
interface names have gotten more liberal - they're not required to
have specific prefixes anymore. The check for physical interfaces in
the zones plugin needs to be adjusted to reflect those changes,
otherwise the generated SDN configuration does not contain any pinned
physical ports and therefore doesn't work. Use the provided helper
from PVE::IPRoute2 instead, that adheres to the new naming policy and
uses `ip link` to determine the physical ports of the bridge, instead
of relying on a regex.

This improves the previous commit 4f19480b - which only allowed the
nic / if prefixes, which solved the issue when using the default
prefix, but not when using a custom prefix.

Fixes: 4f19480b04315afb5dc23e0130463acaea35db18
Signed-off-by: Stefan Hanreich <[email protected]>
---
 src/PVE/Network/SDN/Zones/Plugin.pm | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm 
b/src/PVE/Network/SDN/Zones/Plugin.pm
index 6dc2f65..826ebdf 100644
--- a/src/PVE/Network/SDN/Zones/Plugin.pm
+++ b/src/PVE/Network/SDN/Zones/Plugin.pm
@@ -4,6 +4,7 @@ use strict;
 use warnings;
 
 use PVE::Tools qw(run_command);
+use PVE::IPRoute2;
 use PVE::JSONSchema;
 use PVE::Cluster;
 use PVE::Network;
@@ -341,18 +342,7 @@ sub is_vlanaware {
 
 sub get_bridge_ifaces {
     my ($bridge) = @_;
-
-    my @bridge_ifaces = ();
-    my $dir = "/sys/class/net/$bridge/brif";
-    PVE::Tools::dir_glob_foreach(
-        $dir,
-        '(((eth|bond|nic|if)\d+|en[^.]+)(\.\d+)?)',
-        sub {
-            push @bridge_ifaces, $_[0];
-        },
-    );
-
-    return @bridge_ifaces;
+    return PVE::IPRoute2::get_physical_bridge_ports($bridge);
 }
 
 sub datacenter_config {
-- 
2.47.3


_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to