[pve-devel] [PATCH installer v2 15/15] gui: add support for pinning network interface names

Christoph Heiss c.heiss at proxmox.com
Thu Nov 6 13:06:28 CET 2025


On Thu Nov 6, 2025 at 10:15 AM CET, Stoiko Ivanov wrote:
> Thanks for tackling this! the first experience with this in GUI/TUI was
> good and I'm looking forward to having this available in our installers!

Thanks for taking a look at it!

>
> I ran into an issue and difference of behavior between GUI/TUI (and from a
> quick grep in our codebase between TUI and our API types) - my test was
> using single character iface names ('a', '_').
>
> Comment inline:
> On Thu, 30 Oct 2025 12:06:17 +0100
> Christoph Heiss <c.heiss at proxmox.com> wrote:
[..]
>> +    $dialog->signal_connect(
>> +        response => sub {
>> +            my $new_mapping = {};
>> +            my $reverse_mapping = {};
>> +            foreach my $mac (keys %$inputs) {
>> +                my $name = $inputs->{$mac}->get_text();
>> +
>> +                if (!defined($name) || $name eq '') {
>> +                    Proxmox::UI::message(
>> +                        "interface name mapping for '$mac' cannot be empty", $dialog,
>> +                    );
>> +                    return;
>> +                }
>> +
>> +                if (length($name) > MAX_IFNAME_LEN) {
>> +                    Proxmox::UI::message(
>> +                        "interface name mapping '$name' for '$mac' cannot be longer than "
>> +                            . MAX_IFNAME_LEN
>> +                            . " characters",
>> +                        $dialog,
>> +                    );
>> +                    return;
>> +                }
>> +
>> +                if ($name =~ m/^[0-9]/) {
>> +                    Proxmox::UI::message(
>> +                        "interface name mapping '$name' for '$mac' is invalid: must not start with a number",
>> +                        $dialog,
>> +                    );
>> +                    return;
>> +                }
>> +
>> +                if ($name !~ m/^[a-zA-Z][a-zA-Z0-9_]+$/) {
>> +                    Proxmox::UI::message(
>> +                        "interface name mapping '$name' for '$mac' is invalid: "
>> +                            . "must only consist alphanumeric characters and underscores",
> I received this as error-message when using 'a' as nic-name - so the error
> message does not cover that case - but looking through your other patches
> and also a bit later through json-schema:
> pve-common/src/PVE/JSONSchema.pm - this regex here seems correct - and the

Yeah, it's _mostly_ modeled after that regex, minus the VLAN & co parts.

> checks in the TUI are allowing too much (another nit there is the
> error-message when using '_' as interface name ('must not start with a
> number').

Thanks for testing that pretty thoroughly! I will go through all the
cases again.

>
> I did not check if we have similar inconsistencies in our rust-based
> pinning vs. the perl-based one - but if possible unifying what is allowed
> in all our installer interfaces would be good (most likely by disallowing
> the single-character ifaces)

Disallowing single-character names would be indeed correct, since that
is what the rest of our tooling enforces AFAICS.

I actually thought about (finally) introducing perlmod into the
installer, so that we don't have to keep duplicating all checks between
Perl and Rust, for the GUI and TUI/auto-installer, respectively.

> I'll give the autoinstaller a spin on one of our test-boxes with many
> interfaces next.




More information about the pve-devel mailing list