public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
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	[thread overview]
Message-ID: <20260512112129.224619-4-g.goller@proxmox.com> (raw)
In-Reply-To: <20260512112129.224619-1-g.goller@proxmox.com>

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 <g.goller@proxmox.com>
---
 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





  parent reply	other threads:[~2026-05-12 11:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12 11:21 [PATCH common/manager/network/proxmox-widget-toolkit 0/4] Extend prefix-list CIDR range Gabriel Goller
2026-05-12 11:21 ` [PATCH pve-common 1/4] jsonschema: add full-range CIDR JSON schema formats Gabriel Goller
2026-05-12 11:21 ` [PATCH pve-network 2/4] sdn: prefix-list: allow full prefix CIDR range Gabriel Goller
2026-05-12 11:21 ` Gabriel Goller [this message]
2026-05-12 11:21 ` [PATCH pve-manager 4/4] sdn: prefix-lists: change prefix format to allow bigger subnets Gabriel Goller
2026-05-12 22:09 ` [PATCH common/manager/network/proxmox-widget-toolkit 0/4] Extend prefix-list CIDR range Thomas Lamprecht
2026-05-13  8:35   ` Gabriel Goller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260512112129.224619-4-g.goller@proxmox.com \
    --to=g.goller@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal