[pve-devel] [PATCH installer 1/2] common: pinning: require first character to be lower-case ascii

Stoiko Ivanov s.ivanov at proxmox.com
Tue Nov 18 16:15:26 CET 2025


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 at proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov at 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





More information about the pve-devel mailing list