* [pve-devel] [PATCH installer 1/2] common: pinning: require first character to be lower-case ascii
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
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
2 siblings, 0 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2025-11-18 15:15 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply [flat|nested] 4+ messages in thread* [pve-devel] [PATCH installer 2/2] sys: net: fix error-message for interface names first character
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 ` [pve-devel] [PATCH installer 1/2] common: pinning: require first character to be lower-case ascii Stoiko Ivanov
@ 2025-11-18 15:15 ` 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
2 siblings, 0 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2025-11-18 15:15 UTC (permalink / raw)
To: pve-devel
This follows the similar commit for the TUI installer, but as the
validation here was in accordance to the one in pve-common, only
adapts the error-message (and affected test-cases).
Fixes: 2033a35 ("sys: net: pinning: make interface name checks stricter")
Reported-by: Robert Obkircher <r.obkircher@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
Proxmox/Sys/Net.pm | 2 +-
test/validate-link-pin-map.pl | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Proxmox/Sys/Net.pm b/Proxmox/Sys/Net.pm
index f6a0940..37feee1 100644
--- a/Proxmox/Sys/Net.pm
+++ b/Proxmox/Sys/Net.pm
@@ -341,7 +341,7 @@ sub validate_link_pin_map : prototype($) {
}
if ($name !~ m/^[a-z]/) {
- die "interface name '$name' for '$mac' is invalid: name must start with a letter\n";
+ die "interface name '$name' for '$mac' is invalid: name must start with a lower-case letter\n";
}
if ($name !~ m/^[a-zA-Z_][a-zA-Z0-9_]*$/) {
diff --git a/test/validate-link-pin-map.pl b/test/validate-link-pin-map.pl
index 3a95aab..3fbd0e4 100755
--- a/test/validate-link-pin-map.pl
+++ b/test/validate-link-pin-map.pl
@@ -45,14 +45,14 @@ is(
eval { validate_link_pin_map({ 'ab:cd:ef:12:34:56' => '0nic' }) };
is(
$@,
- "interface name '0nic' for 'ab:cd:ef:12:34:56' is invalid: name must start with a letter\n",
+ "interface name '0nic' for 'ab:cd:ef:12:34:56' is invalid: name must start with a lower-case letter\n",
"name starting with number is rejected",
);
eval { validate_link_pin_map({ 'ab:cd:ef:12:34:56' => '_a' }) };
is(
$@,
- "interface name '_a' for 'ab:cd:ef:12:34:56' is invalid: name must start with a letter\n",
+ "interface name '_a' for 'ab:cd:ef:12:34:56' is invalid: name must start with a lower-case letter\n",
"name starting with underscore is rejected",
);
--
2.47.3
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 4+ messages in thread* [pve-devel] applied: [PATCH installer 0/2] nic pinning: require first character to be lower-case
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 ` [pve-devel] [PATCH installer 1/2] common: pinning: require first character to be lower-case ascii Stoiko Ivanov
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 ` Thomas Lamprecht
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2025-11-18 16:31 UTC (permalink / raw)
To: pve-devel, Stoiko Ivanov
On Tue, 18 Nov 2025 16:15:25 +0100, Stoiko Ivanov wrote:
> The regex for validating NICs in pve-common starts with /^[a-z].../
> getting 'name must start with a letter' to a pinned nic-name of 'ABC' is
> confusing. Additionally there was a discrepancy in validating the nic-name
> in the rust-based installers (is_ascii_alphabetic also matches upper-case
> letters, whereas the perl-regex required [a-z])
>
> Align the validation with the version in pve-common.
>
> [...]
Applied, thanks!
[1/2] common: pinning: require first character to be lower-case ascii
commit: 47700a50ab4a8e3322aaa69f6a7ea584519b98e5
[2/2] sys: net: fix error-message for interface names first character
commit: fc9e72091861b0f0981c8a4153c4017839478af7
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 4+ messages in thread