network edit: allow bridges to have any valid interface name

Allow the web UI to accept bridge interfaces with any valid interface
name, rather than being limited to the arbitrary "vmbr" prefix.

Limiting to at most 10 characters, since SDN possibly adds a .XXXX
prefix for Vlans. Since the hard limit for network interface names is
15 characters, limiting it to 10 characters here enables SDN to append
the VLAN prefix in any case.

Originally-by: Jillian Morgan <jillian.morgan@primordial.ca>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
 [ TL: avoid far away intermediate variable ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Stefan Hanreich 2024-04-12 10:07:37 +02:00 committed by Thomas Lamprecht
parent 2e454014e0
commit 9ffe9009fb
2 changed files with 3 additions and 3 deletions

View File

@ -76,7 +76,7 @@ Ext.apply(Ext.form.field.VTypes, {
MacPrefixText: gettext('Example') + ': 02:8f - ' + gettext('only unicast addresses are allowed'),
BridgeName: function(v) {
return (/^vmbr\d{1,4}$/).test(v);
return (/^[a-zA-Z][a-zA-Z0-9_]{0,9}$/).test(v);
},
VlanName: function(v) {
if (Proxmox.Utils.VlanInterface_match.test(v)) {
@ -86,7 +86,7 @@ Ext.apply(Ext.form.field.VTypes, {
}
return true;
},
BridgeNameText: gettext('Format') + ': vmbr<b>N</b>, where 0 <= <b>N</b> <= 9999',
BridgeNameText: gettext('Format') + ': alphanumeric string starting with a character',
BondName: function(v) {
return (/^bond\d{1,4}$/).test(v);

View File

@ -254,7 +254,7 @@ Ext.define('Proxmox.node.NetworkEdit', {
value: me.iface,
vtype: iface_vtype,
allowBlank: false,
maxLength: 15,
maxLength: iface_vtype === 'BridgeName' ? 10 : 15,
autoEl: {
tag: 'div',
'data-qtip': gettext('For example, vmbr0.100, vmbr0, vlan0.100, vlan0'),