From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 837591FF146 for ; Tue, 12 May 2026 13:22:10 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4ED38FA46; Tue, 12 May 2026 13:22:10 +0200 (CEST) From: Gabriel Goller To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox-widget-toolkit 3/4] toolkit: Add IP/CIDR validator with full prefix range checks Date: Tue, 12 May 2026 13:21:22 +0200 Message-ID: <20260512112129.224619-4-g.goller@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260512112129.224619-1-g.goller@proxmox.com> References: <20260512112129.224619-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: 1778584782504 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: 4ZT54OJDZUWYCF7UUBC4MKLDBFPLKAVZ X-Message-ID-Hash: 4ZT54OJDZUWYCF7UUBC4MKLDBFPLKAVZ 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). To preserve backwards compatibility and not break anything, keep the old IP64CIDRAddress (with cidr ranges 8-32, 8-128) around. Signed-off-by: Gabriel Goller --- src/Toolkit.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Toolkit.js b/src/Toolkit.js index c2ae90a1e65c..290ec03efaf6 100644 --- a/src/Toolkit.js +++ b/src/Toolkit.js @@ -65,6 +65,22 @@ Ext.apply(Ext.form.field.VTypes, { IP64CIDRAddressText: gettext('Example') + ': 192.168.1.1/24 2001:DB8::42/64', IP64CIDRAddressMask: /[A-Fa-f0-9.:/]/, + 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.:/]/, + MacAddress: function (v) { return /^([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}$/.test(v); }, -- 2.47.3