From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 769B096274 for ; Thu, 29 Feb 2024 11:41:09 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5F5D31A4ED for ; Thu, 29 Feb 2024 11:41:09 +0100 (CET) Received: from lana.proxmox.com (unknown [94.136.29.99]) by firstgate.proxmox.com (Proxmox) with ESMTP for ; Thu, 29 Feb 2024 11:41:05 +0100 (CET) Received: by lana.proxmox.com (Postfix, from userid 10043) id 259102C40B0; Thu, 29 Feb 2024 11:41:05 +0100 (CET) From: Stefan Hanreich To: pve-devel@lists.proxmox.com Date: Thu, 29 Feb 2024 11:41:01 +0100 Message-Id: <20240229104104.111188-4-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240229104104.111188-1-s.hanreich@proxmox.com> References: <20240229104104.111188-1-s.hanreich@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.356 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH v3 widget-toolkit 3/6] network: allow bridges to have any valid interface name X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Feb 2024 10:41:09 -0000 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 Signed-off-by: Stefan Hanreich --- src/Toolkit.js | 4 ++-- src/node/NetworkEdit.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Toolkit.js b/src/Toolkit.js index 6fd73f5..23d3a36 100644 --- a/src/Toolkit.js +++ b/src/Toolkit.js @@ -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') + ': vmbrN, where 0 <= N <= 9999', + BridgeNameText: gettext('Format') + ': alphanumeric string starting with a character', BondName: function(v) { return (/^bond\d{1,4}$/).test(v); diff --git a/src/node/NetworkEdit.js b/src/node/NetworkEdit.js index bb9add3..33113d9 100644 --- a/src/node/NetworkEdit.js +++ b/src/node/NetworkEdit.js @@ -38,6 +38,8 @@ Ext.define('Proxmox.node.NetworkEdit', { throw "unknown network device type specified"; } + let name_max_length = iface_vtype === 'BridgeName' ? 10 : 15; + me.subject = Proxmox.Utils.render_network_iface_type(me.iftype); let column1 = [], @@ -254,7 +256,7 @@ Ext.define('Proxmox.node.NetworkEdit', { value: me.iface, vtype: iface_vtype, allowBlank: false, - maxLength: 15, + maxLength: name_max_length, autoEl: { tag: 'div', 'data-qtip': gettext('For example, vmbr0.100, vmbr0, vlan0.100, vlan0'), -- 2.39.2