all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH installer v5 04/23] install: do not rely on interface name map to be fully populated
Date: Fri,  6 Nov 2026 14:10:33 +0100	[thread overview]
Message-ID: <20261106131058.804870-5-c.heiss@proxmox.com> (raw)
In-Reply-To: <20261106131058.804870-1-c.heiss@proxmox.com>

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 <c.heiss@proxmox.com>
---
Changes v4 -> v5:
  * no changes

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(
     <<EOT
@@ -194,4 +197,51 @@ EOT
     , 'gateway learned from IPv6 router advertisements is not configured statically',
 );
 
+# Check that unpinnable interfaces (e.g. virtual ones) keep their kernel-assigned name
+Proxmox::Install::Config::merge({
+    network_interface_pin_map => $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(
+    <<EOT
+auto nic0
+iface nic0 inet static
+	address 192.168.0.10/24
+	gateway 192.168.0.1
+
+iface dummy inet manual
+
+iface nic1 inet manual
+EOT
+    , 'unpinnable names keep their kernel name',
+);
+
 done_testing();
-- 
2.56.0





  parent reply	other threads:[~2026-11-06 13:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 13:10 [PATCH installer v5 00/23] fix #2164: add bond and vlan setup across all installers Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 01/23] install: run make tidy Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 02/23] tree-wide: use `MacAddress` type instead of string for MAC addresses Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 03/23] install: factor out ifupdown2 config generation into own subroutine Christoph Heiss
2026-11-06 13:10 ` Christoph Heiss [this message]
2026-11-06 13:10 ` [PATCH installer v5 05/23] install: config: add option for setting up bond on management interface Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 06/23] install: config: add option for setting up vlan " Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 07/23] install: network: set up management bond if requested Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 08/23] install: network: set up vlan on management interface " Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 09/23] gui: network: factor out name pinning into advanced options dialog Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 10/23] gui: network: add bond setup options to " Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 11/23] gui: network: add vlan setup options to advanced network dialog Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 12/23] auto: pass through management network bond options to low-level installer Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 13/23] auto: pass through management network vlan " Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 14/23] tui: drop long obsolete comment about logo formatting Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 15/23] tui: views: add widget for displaying a group of checkboxes Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 16/23] tui: network: factor out name pinning into advanced options dialog Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 17/23] tui: network: match form label style when enabling/disabling elements Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 18/23] tui: network: add bond setup options to advanced network dialog Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 19/23] tui: network: add vlan " Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 20/23] gui: network: split advanced options dialog into tabs Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 21/23] tui: " Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 22/23] gui: network: list bond member candidates sharing a MAC address once Christoph Heiss
2026-11-06 13:10 ` [PATCH installer v5 23/23] tui: " Christoph Heiss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261106131058.804870-5-c.heiss@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal