public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer 1/2] common: pinning: require first character to be lower-case ascii
Date: Tue, 18 Nov 2025 16:15:26 +0100	[thread overview]
Message-ID: <20251118151532.592423-2-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20251118151532.592423-1-s.ivanov@proxmox.com>

the validation regex in pve-common is:
`/^[a-z][a-z0-9_]{1,20}([:\.]\d+)?$/` [0]
and thus requires the first byte of an interface to be lower-case
ascii.
Adapt the error-message and the validation accordingly

[0] https://git.proxmox.com/?p=pve-common.git;a=blob;f=src/PVE/JSONSchema.pm;h=827889950b9165dd22e7b12e934d08fd8b21e855;hb=HEAD#l680

Fixes: aa0ddcd ("common: pinning: make interface name checks stricter")
Reported-by: Robert Obkircher <r.obkircher@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 proxmox-installer-common/src/options.rs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/proxmox-installer-common/src/options.rs b/proxmox-installer-common/src/options.rs
index 8f3b3aa..5933df8 100644
--- a/proxmox-installer-common/src/options.rs
+++ b/proxmox-installer-common/src/options.rs
@@ -524,9 +524,9 @@ impl NetworkInterfacePinningOptions {
             }
 
             // Mimicking the `pve-iface` schema verification
-            if !name.starts_with(|c: char| c.is_ascii_alphabetic()) {
+            if !name.starts_with(|c: char| c.is_ascii_lowercase()) {
                 bail!(
-                    "interface name '{name}' for '{mac}' is invalid: name must start with a letter"
+                    "interface name '{name}' for '{mac}' is invalid: name must start with a lower-case letter"
                 );
             }
 
@@ -1034,7 +1034,7 @@ mod tests {
         assert!(res.is_err());
         assert_eq!(
             res.unwrap_err().to_string(),
-            "interface name '0nic' for 'ab:cd:ef:12:34:56' is invalid: name must start with a letter"
+            "interface name '0nic' for 'ab:cd:ef:12:34:56' is invalid: name must start with a lower-case letter"
         );
 
         options
@@ -1045,7 +1045,7 @@ mod tests {
         assert!(res.is_err());
         assert_eq!(
             res.unwrap_err().to_string(),
-            "interface name '_a' for 'ab:cd:ef:12:34:56' is invalid: name must start with a letter"
+            "interface name '_a' for 'ab:cd:ef:12:34:56' is invalid: name must start with a lower-case letter"
         );
     }
 
-- 
2.47.3



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


  reply	other threads:[~2025-11-18 15:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-18 15:15 [pve-devel] [PATCH installer 0/2] nic pinning: require first character to be lower-case Stoiko Ivanov
2025-11-18 15:15 ` Stoiko Ivanov [this message]
2025-11-18 15:15 ` [pve-devel] [PATCH installer 2/2] sys: net: fix error-message for interface names first character Stoiko Ivanov
2025-11-18 16:31 ` [pve-devel] applied: [PATCH installer 0/2] nic pinning: require first character to be lower-case Thomas Lamprecht

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=20251118151532.592423-2-s.ivanov@proxmox.com \
    --to=s.ivanov@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal