Nice catch - Thanks!
On Mon, 1 Dec 2025 11:53:53 +0100
Fiona Ebner <[email protected]> wrote:
> Am 26.11.25 um 7:08 PM schrieb Stoiko Ivanov:
> > + static RE: OnceLock<Regex> = OnceLock::new();
> > + let re = RE.get_or_init(|| {
> > + RegexBuilder::new(r"^[a-z][a-z0-9_]{1,20}([:\.]\d+)?$")
>
> Should the later part with a colon really be allowed? On the new test
> ISO, a name like 'nicat:3' will be accepted, but won't actually work
> later when booting:
given the back and forth [0] of trying to get this in sync with
pve-common's JSONSchema.pm I did use the literal regex from there on
purpose...
> "Interface name is not valid or too long, ignoring assignment: nicat:3"
...not considering that these are interface-names for the kernel, while
`prefix:\d` and `prefix\.\d` are syntax for /etc/network/interfaces
(the former for aliaseses (having a second ip/network on one interface),
the latter for VLAN tags).
It would probably make sense to add a separate validation for kernel iface
names somewhere centrally and use/reference that (everywhere), but I'd like
to avoid to deviate here from the one thing we (afaict?) always reference
when we deal with "NIC names".
Apart from disallowing the `([:\.]\d+)?` trailer - this would also
restrict the length to 15 characters fwict.
In practical terms I don't think keeping it as is has a large potential
for regression (not expecting many users to touch the advanced mappings,
and even if they add :\d there they'd notice after rebooting the first
time).
>
> I guess the dot can make sense if there are multiple NICs, so you could
> have e.g. 'nic0' and 'nic0.3'?
see above - afaict in Debian/ifupdown terms these are used for
vlan-interfaces (and might lead to unexpected results if used for plain
nic-names (did not test this though))
[0] e.g.
https://lore.proxmox.com/all/[email protected]/
https://lore.proxmox.com/all/[email protected]/
https://lore.proxmox.com/all/[email protected]/
_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel