From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 90BAB1FF13A for ; Wed, 13 May 2026 10:34:44 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B71463BAB; Wed, 13 May 2026 10:34:39 +0200 (CEST) From: Gabriel Goller To: pve-devel@lists.proxmox.com Subject: [PATCH pve-manager v2 4/4] toolkit: Add IP/CIDR validator with full prefix range checks Date: Wed, 13 May 2026 10:34:23 +0200 Message-ID: <20260513083430.63529-5-g.goller@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260513083430.63529-1-g.goller@proxmox.com> References: <20260513083430.63529-1-g.goller@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1778661161236 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.028 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: LEBOXL64T6B377T6CSTWKFE7AXNPU7MD X-Message-ID-Hash: LEBOXL64T6B377T6CSTWKFE7AXNPU7MD X-MailFrom: g.goller@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Introduce an IP64FullRangeCIDRAddress validator that accepts IPv4 and IPv6 CIDR addresses with the full prefix range of 0-32 and 0-128. This is useful when e.g. selecting a prefix on the route-map, where 0.0.0.0/0 is a valid prefix (allow-all). Place it here instead of in proxmox-widget-toolkit, because its probably not gonna be used anywhere else for now. To preserve backwards compatibility and not break anything, keep the old IP64CIDRAddress (with cidr ranges 8-32, 8-128) around (in proxmox-widget-toolkit). Signed-off-by: Gabriel Goller --- www/manager6/Toolkit.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/www/manager6/Toolkit.js b/www/manager6/Toolkit.js index ac73f8a7b526..e345b0a8ad07 100644 --- a/www/manager6/Toolkit.js +++ b/www/manager6/Toolkit.js @@ -14,6 +14,22 @@ Ext.apply(Ext.form.field.VTypes, { IP64AddressListMask: /[A-Fa-f0-9,:.; ]/, PciIdText: gettext('Example') + ': 0x8086', PciId: (v) => /^0x[0-9a-fA-F]{4}$/.test(v), + + IP64FullRangeCIDRAddress: function (v) { + let result = Proxmox.Utils.IP64_cidr_match.exec(v); + if (result === null) { + return false; + } + if (result[1] !== undefined) { + return result[1] >= 0 && result[1] <= 128; + } else if (result[2] !== undefined) { + return result[2] >= 0 && result[2] <= 32; + } else { + return false; + } + }, + IP64FullRangeCIDRAddressText: gettext('Example') + ': 192.168.1.1/24 2001:DB8::42/64', + IP64FullRangeCIDRAddressMask: /[A-Fa-f0-9.:/]/, }); Ext.define('PVE.form.field.Display', { -- 2.47.3