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: [pve-devel] [PATCH installer] auto: answer: netif pinning: transform mac addresses into lowercase
Date: Wed, 14 Jan 2026 15:51:56 +0100	[thread overview]
Message-ID: <20260114145208.1500825-1-c.heiss@proxmox.com> (raw)

Users may specify MAC addresses in the network interface pinning map in
an uppercase format, which is more common than lowercase in some
environments.

This would then cause the auto-installer to mistakenly consider these
addresses as unknown - thus just unconditionally convert all MAC
addresses to lowercase while parsing.

Reported-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 proxmox-auto-installer/src/answer.rs          |  7 ++++-
 proxmox-auto-installer/tests/parse-answer.rs  |  1 +
 ...terface_pinning_uppercase_mac_address.json | 30 +++++++++++++++++++
 ...terface_pinning_uppercase_mac_address.toml | 22 ++++++++++++++
 4 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning_uppercase_mac_address.json
 create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning_uppercase_mac_address.toml

diff --git a/proxmox-auto-installer/src/answer.rs b/proxmox-auto-installer/src/answer.rs
index 1e455ca..d12e088 100644
--- a/proxmox-auto-installer/src/answer.rs
+++ b/proxmox-auto-installer/src/answer.rs
@@ -225,8 +225,13 @@ impl TryFrom<NetworkInAnswer> for Network {
         let interface_name_pinning = match network.interface_name_pinning {
             Some(opts) if opts.enabled => {
                 let opts = NetworkInterfacePinningOptions {
-                    mapping: opts.mapping,
+                    mapping: opts
+                        .mapping
+                        .iter()
+                        .map(|(k, v)| (k.to_lowercase(), v.clone()))
+                        .collect(),
                 };
+
                 opts.verify()?;
                 Some(opts)
             }
diff --git a/proxmox-auto-installer/tests/parse-answer.rs b/proxmox-auto-installer/tests/parse-answer.rs
index 696fe1f..7dd4a9d 100644
--- a/proxmox-auto-installer/tests/parse-answer.rs
+++ b/proxmox-auto-installer/tests/parse-answer.rs
@@ -130,6 +130,7 @@ mod tests {
             hashed_root_password,
             minimal,
             network_interface_pinning,
+            network_interface_pinning_uppercase_mac_address,
             nic_matching,
             specific_nic,
             zfs,
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning_uppercase_mac_address.json b/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning_uppercase_mac_address.json
new file mode 100644
index 0000000..76723c8
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning_uppercase_mac_address.json
@@ -0,0 +1,30 @@
+{
+  "autoreboot": 1,
+  "cidr": "192.168.1.114/24",
+  "country": "at",
+  "dns": "192.168.1.254",
+  "domain": "testinstall",
+  "filesys": "ext4",
+  "gateway": "192.168.1.1",
+  "hdsize": 223.57088470458984,
+  "existing_storage_auto_rename": 1,
+  "hostname": "pveauto",
+  "keymap": "de",
+  "mailto": "mail@no.invalid",
+  "mngmt_nic": "mgmt",
+  "network_interface_pin_map": {
+    "1c:34:da:5c:5e:24": "nic2",
+    "1c:34:da:5c:5e:25": "nic3",
+    "24:8a:07:1e:05:bc": "lan0",
+    "24:8a:07:1e:05:bd": "lan1",
+    "5a:47:32:dd:c7:47": "nic8",
+    "a0:36:9f:0a:b3:82": "nic6",
+    "a0:36:9f:0a:b3:83": "nic7",
+    "b4:2e:99:ac:ad:b4": "mgmt",
+    "b4:2e:99:ac:ad:b5": "nic1"
+  },
+  "root_password": { "plain": "12345678" },
+  "target_hd": "/dev/sda",
+  "timezone": "Europe/Vienna",
+  "first_boot": { "enabled": 0 }
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning_uppercase_mac_address.toml b/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning_uppercase_mac_address.toml
new file mode 100644
index 0000000..6681fe9
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning_uppercase_mac_address.toml
@@ -0,0 +1,22 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.interface-name-pinning]
+enabled = true
+
+[network.interface-name-pinning.mapping]
+"24:8A:07:1E:05:BC" = "lan0"
+"24:8A:07:1E:05:BD" = "lan1"
+"B4:2E:99:AC:AD:B4" = "mgmt"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
-- 
2.52.0



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


                 reply	other threads:[~2026-01-14 14:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260114145208.1500825-1-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