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 pve-manager v2 4/4] toolkit: Add IP/CIDR validator with full prefix range checks
Date: Wed, 13 May 2026 10:34:23 +0200	[thread overview]
Message-ID: <20260513083430.63529-5-g.goller@proxmox.com> (raw)
In-Reply-To: <20260513083430.63529-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).
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 <g.goller@proxmox.com>
---
 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





  parent reply	other threads:[~2026-05-13  8:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13  8:34 [PATCH manager/network v2 0/4] Extend prefix-list CIDR range Gabriel Goller
2026-05-13  8:34 ` [PATCH pve-network v2 1/4] sdn: prefix-list: allow full prefix " Gabriel Goller
2026-05-13  8:34 ` [PATCH pve-network v2 2/4] sdn: add full-range CIDR JSON schema formats Gabriel Goller
2026-05-13  8:34 ` [PATCH pve-manager v2 3/4] sdn: prefix-lists: change prefix format to allow bigger subnets Gabriel Goller
2026-05-13  8:34 ` Gabriel Goller [this message]
2026-05-15  5:02 ` applied: [PATCH manager/network v2 0/4] Extend prefix-list CIDR range Thomas Lamprecht

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=20260513083430.63529-5-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