From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 75D021FF170 for ; Thu, 24 Jul 2025 16:49:02 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 757CF3E3BA; Thu, 24 Jul 2025 16:50:11 +0200 (CEST) From: Stefan Hanreich To: pve-devel@lists.proxmox.com Date: Thu, 24 Jul 2025 16:49:57 +0200 Message-Id: <20250724144959.374061-2-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250724144959.374061-1-s.hanreich@proxmox.com> References: <20250724144959.374061-1-s.hanreich@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.195 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 Subject: [pve-devel] [PATCH pve-common 1/1] inotify/interfaces: use ip link for detecting physical interfaces 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" The parser for /e/n/i relied on PHYSICAL_NIC_RE for detecting physical interfaces. In order to allow arbitrary interface names for pinning physical interfaces, switch over to detecting physical interfaces via 'ip link' instead. Signed-off-by: Stefan Hanreich --- src/PVE/INotify.pm | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm index 7466c40..d7e5add 100644 --- a/src/PVE/INotify.pm +++ b/src/PVE/INotify.pm @@ -878,6 +878,8 @@ sub __read_etc_network_interfaces { my $ifaces = $config->{ifaces} = {}; my $options = $config->{options} = []; + my $altnames = PVE::Network::altname_mapping($ip_links); + my $options_alternatives = { 'ovs_mtu' => 'mtu', 'bond-slaves' => 'slaves', @@ -1042,7 +1044,7 @@ OUTER: for my $iface_name (keys $ip_links->%*) { my $ip_link = $ip_links->{$iface_name}; - next if $iface_name !~ m/^$PVE::Network::PHYSICAL_NIC_RE$/; + next if !PVE::Network::ip_link_is_physical($ip_link); for my $altname ($ip_link->{altnames}->@*) { if ($ifaces->{$altname}) { @@ -1072,6 +1074,9 @@ OUTER: foreach my $iface (sort keys %$ifaces) { my $d = $ifaces->{$iface}; $d->{type} = 'unknown'; + + my $ip_link = $ip_links->{$altnames->{$iface} // $iface}; + if (defined $d->{'bridge_ports'}) { $d->{type} = 'bridge'; if (!defined($d->{bridge_stp})) { @@ -1140,7 +1145,7 @@ OUTER: $ifaces->{$raw_iface}->{exists} = 0; $d->{exists} = 0; } - } elsif ($iface =~ m/^$PVE::Network::PHYSICAL_NIC_RE$/) { + } elsif ($ip_link && PVE::Network::ip_link_is_physical($ip_link)) { if (!$d->{ovs_type}) { $d->{type} = 'eth'; } elsif ($d->{ovs_type} eq 'OVSPort') { @@ -1550,16 +1555,12 @@ sub __write_etc_network_interfaces { if ($d->{type} eq 'OVSPort' || $d->{type} eq 'OVSIntPort' || $d->{type} eq 'OVSBond') { my $brname = $used_ports->{$iface}; if (!$brname || !$ifaces->{$brname}) { - if ($iface =~ /^$PVE::Network::PHYSICAL_NIC_RE/) { - $ifaces->{$iface} = { - type => 'eth', - exists => 1, - method => 'manual', - families => ['inet'], - }; - } else { - delete $ifaces->{$iface}; - } + $ifaces->{$iface} = { + type => 'eth', + exists => 1, + method => 'manual', + families => ['inet'], + }; next; } my $bd = $ifaces->{$brname}; -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel