From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 8ED201FF179 for ; Wed, 10 Dec 2025 19:42:28 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 16A053353; Wed, 10 Dec 2025 19:42:51 +0100 (CET) From: Stefan Hanreich To: pve-devel@lists.proxmox.com Date: Wed, 10 Dec 2025 19:42:43 +0100 Message-ID: <20251210184247.448937-2-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251210184247.448937-1-s.hanreich@proxmox.com> References: <20251210184247.448937-1-s.hanreich@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.222 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record URIBL_SBL_A 0.1 Contains URL's A record listed in the Spamhaus SBL blocklist [188.114.96.3] Subject: [pve-devel] [PATCH pve-common 1/1] fix #7118: fix bridge port detection when plugging netdev with vlan X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" 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 --- 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 pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel