When tagging a network device with a VLAN tag, tap_plug checks if the bridge is vlan-aware and, if it isn't, creates a VLAN subinterface and a respective bridge for that VLAN for the physical interfaces that are enslaved on the bridge. The detection of physical interfaces relied on a regex that only allowed certain prefixes. Since the introduction of network-interface-pinning, the rules for network interface naming have been changed, and physical network interfaces are not restricted to certain prefixes anymore. Therefore, use the newly provided helper from IPRoute2 that uses `ip link` to obtain the physical bridge ports, instead of a regex.
Signed-off-by: Stefan Hanreich <[email protected]> --- src/PVE/Network.pm | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/PVE/Network.pm b/src/PVE/Network.pm index 67c9601..9a8449a 100644 --- a/src/PVE/Network.pm +++ b/src/PVE/Network.pm @@ -683,16 +683,7 @@ sub activate_bridge_vlan { my $bridgevlan = "${bridge}v$tag"; - my @ifaces = (); - my $dir = "/sys/class/net/$bridge/brif"; - PVE::Tools::dir_glob_foreach( - $dir, - '(((eth|bond)\d+|en[^.]+)(\.\d+)?)', - sub { - push @ifaces, $_[0]; - }, - ); - + my @ifaces = get_physical_bridge_ports($bridge); die "no physical interface on bridge '$bridge'\n" if scalar(@ifaces) == 0; lock_network(sub { @@ -973,6 +964,16 @@ sub is_ovs_bridge { die "failed to query OVS to determine type of '$bridge': $res\n"; } +sub get_physical_bridge_ports { + my ($bridge, $ip_links) = @_; + + $ip_links = ip_link_details() if !defined($ip_links); + + return grep { + ip_link_is_physical($ip_links->{$_}) && $ip_links->{$_}->{master} eq $bridge + } keys $ip_links->%*; +} + sub ip_link_details { my $link_json = ''; -- 2.47.3 _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
