From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id A09501FF09C for ; Mon, 02 Nov 2026 13:47:42 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 9717E2180F; Mon, 02 Nov 2026 13:47:14 +0100 (CET) From: Christoph Heiss To: pve-devel@lists.proxmox.com Subject: [PATCH installer v4 12/30] install: do not rely on interface name map to be fully populated Date: Mon, 2 Nov 2026 13:45:18 +0100 Message-ID: <20261102124539.1008075-13-c.heiss@proxmox.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261102124539.1008075-1-c.heiss@proxmox.com> References: <20261102124539.1008075-1-c.heiss@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1793623605432 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.210 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: TYWTDYMXWVDPIGY55AVJYAQV7ZVLRYSQ X-Message-ID-Hash: TYWTDYMXWVDPIGY55AVJYAQV7ZVLRYSQ X-MailFrom: c.heiss@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Interfaces without a pinned ID, i.e. virtual links, never get an entry in the interface name pinning map. Should the live environment have such an interface, the configuration would contain a stanza without an interface name for it, so fall back to its kernel name instead. While this hasn't been a problem yet AFAIK, better be safe than sorry. Signed-off-by: Christoph Heiss --- Changes v3 -> v4: * no changes Changes v2 -> v3: * add test and expanded commit message, as proposed by Thomas Changes v1 -> v2: * no changes Proxmox/Install.pm | 6 +++- test/generate-ifupdown2-config.pl | 58 ++++++++++++++++++++++++++++--- 2 files changed, 59 insertions(+), 5 deletions(-) diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm index a98571f..6c7af3d 100644 --- a/Proxmox/Install.pm +++ b/Proxmox/Install.pm @@ -852,7 +852,11 @@ sub generate_ifupdown2_config { foreach my $iface (sort keys $interfaces->%*) { my $if = $interfaces->{$iface}; - my $name = defined($netif_pin_map) ? $netif_pin_map->{ $if->{mac} } : $if->{name}; + my $name = + defined($netif_pin_map) + && defined($netif_pin_map->{ $if->{mac} }) + ? $netif_pin_map->{ $if->{mac} } + : $if->{name}; next if $name eq $ethdev; diff --git a/test/generate-ifupdown2-config.pl b/test/generate-ifupdown2-config.pl index 5c1794e..7f92e4f 100755 --- a/test/generate-ifupdown2-config.pl +++ b/test/generate-ifupdown2-config.pl @@ -49,6 +49,11 @@ EOT ); } +my $pin_map = { + '12:34:56:ab:cd:ef' => 'nic0', + 'ab:cd:ef:12:34:56' => 'nic1', +}; + # global config $proxmox_install_runenv->redefine( get => sub { @@ -123,10 +128,8 @@ EOT # interface name pinning test Proxmox::Install::Config::merge({ - network_interface_pin_map => { - '12:34:56:ab:cd:ef' => 'nic0', - 'ab:cd:ef:12:34:56' => 'nic1', - }, + mngmt_nic => 'eno1', + network_interface_pin_map => $pin_map, }); is_generated( < $pin_map, + cidr => '192.168.0.10/24', + gateway => '192.168.0.1', +}); +set_config(bridge => 0); +$proxmox_install_runenv->redefine( + get => sub { + return { + network => { + interfaces => { + eno1 => { + mac => '12:34:56:ab:cd:ef', + index => 1, + name => 'eno1', + }, + eno2 => { + mac => 'ab:cd:ef:12:34:56', + index => 2, + name => 'eno2', + }, + dummy => { + mac => 'aa:bb:cc:dd:ee:ff', + index => 3, + name => 'dummy', + }, + }, + }, + }; + }, +); + +is_generated( + <