Interface name does not allow dash

saruspete

New Member
Apr 26, 2025
3
1
3
Hello,

Is there any reason to not allow dashes "-" in interface names ?
In my case, my ifaces used to be named like "vmbr-intprv" or "wg-user".

I changed file/usr/share/perl5/PVE/JSONSchema.pm the regex in sub pve_verify_iface with:
Perl:
if ($id !~ m/^[a-z][a-z0-9_-]{1,20}([:\.]\d+)?$/i) {
(simply added the - at the end of [a-z0-9_-], so it's not understood as a regex range)
restarted pve-proxy and it's working as expected.

Is it just a mistake in the regex, or is there an underlying reason to not allow dashes in iface name ?
The kernel does not make any check on the name (see net/core/dev.c), so even uppercase chars should be allowed.

Thanks,
 
Hi,
often such checks err on the side of being more restrictive. It would need to be checked in detail if this can be relaxed or if some code paths won't handle this nicely yet. Feel free to open a feature request on the bug tracker (after checking none exists yet): https://bugzilla.proxmox.com/

Note that your change will be lost after the next upgrade of the relevant package, if you can rename the interfaces instead, that would be a more robust solution.
 
Hello Fiona,

Thanks for the update, I've created bug 6366 for that issue.

Also after re-reading my comment, please disregard the "uppercase" allowed, as the regex modifier /i makes the regex case insensitive. So it's only the dash that is the issue.

Best regards
 
  • Like
Reactions: fiona
Hi,
ifupdown2 interprets them as ranges under some circumstances
could you elaborate a bit more or do you have a reference for this? At least it doesn't do so with a naive example for me:
Code:
auto enp6s19-21
iface enp6s19-21 inet dhcp
Code:
[I] root@pve8a1 ~# ifreload -a
Cannot find device "enp6s19-21"
 
A while back I ran into problems with a bridge called "br-lab" that went away when I renamed it to "brlab". System was mostly vanilla Debian stabe (other then replacing ifupdown with ifupdown2).

I fail to reproduce it now but iirc the error suggested ranges. I didn't check the docs back then as I remembered ranges being supported on cumulus linux. Checking it now that might be limited to the frontend.

I guess it might have been something unrelated as the config is quite complex.
 
  • Like
Reactions: fiona
The only reference I can find on internet about dashes in interface name is indeed under Cumulus:

https://docs.nvidia.com/networking-...Ports/Interface-Configuration-and-Management/

Interface Name Limitations​

Interface names can be a maximum of 15 characters. You cannot use a number for the first character and you cannot include a dash (-) in the name. In addition, you cannot use any name that matches with the regular expression .{0,13}\-v.*.

In the source of ifupdown2, the only reference to ranges I could find is in utils.py but expects to be within [ ] to be considered a range. Which is not allowed in the current or proposed regex, so we should be find here too.