From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-manager 05/10] ui: sdn: fabrics: wireguard: block saving invalid interface values
Date: Fri, 20 Nov 2026 17:00:20 +0100 [thread overview]
Message-ID: <20261120160026.512565-6-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20261120160026.512565-1-s.hanreich@proxmox.com>
ExtJS fields only publish valid values to their binding, so entering
an out-of-range MTU or listen port left the previous value in the
interface record. Since the interface panel never reported itself as
invalid, the edit window allowed saving and submitted that previous
value.
Publish invalid values to the interface record as well and validate
all interfaces in the panel, so saving stays blocked while any
interface has an invalid value, even after selecting another one.
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
.../sdn/fabrics/wireguard/InterfacePanel.js | 50 +++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/www/manager6/sdn/fabrics/wireguard/InterfacePanel.js b/www/manager6/sdn/fabrics/wireguard/InterfacePanel.js
index 1a90c09d..8c5def67 100644
--- a/www/manager6/sdn/fabrics/wireguard/InterfacePanel.js
+++ b/www/manager6/sdn/fabrics/wireguard/InterfacePanel.js
@@ -353,6 +353,13 @@ Ext.define('PVE.sdn.Fabric.WireGuard.InterfacePanel', {
minValue: 1,
maxValue: 65535,
isFormField: false,
+ // publish invalid values too, so the interface does not silently keep its
+ // previous value; the panel validates the interfaces instead
+ publishValue: function () {
+ if (this.rendered) {
+ this.publishState('value', this.getValue());
+ }
+ },
},
{
fieldLabel: gettext('IPv4 Address'),
@@ -375,6 +382,13 @@ Ext.define('PVE.sdn.Fabric.WireGuard.InterfacePanel', {
minValue: 1280,
maxValue: 65535,
isFormField: false,
+ // publish invalid values too, so the interface does not silently keep its
+ // previous value; the panel validates the interfaces instead
+ publishValue: function () {
+ if (this.rendered) {
+ this.publishState('value', this.getValue());
+ }
+ },
},
{
xtype: 'pveSDNWireGuardPeerSelector',
@@ -393,6 +407,7 @@ Ext.define('PVE.sdn.Fabric.WireGuard.InterfacePanel', {
],
previousDirty: false,
+ previousValid: true,
controller: {
xclass: 'Ext.app.ViewController',
@@ -518,6 +533,35 @@ Ext.define('PVE.sdn.Fabric.WireGuard.InterfacePanel', {
);
},
+ isInterfaceValid: function (iface) {
+ let { listen_port: listenPort, mtu } = iface.data;
+
+ // values parsed from the configuration are strings, entered values are numbers
+ let isUnsetOrInRange = (value, min, max) => {
+ if (value === null || value === undefined || value === '') {
+ return true;
+ }
+ let number = Number(value);
+ return Number.isInteger(number) && number >= min && number <= max;
+ };
+
+ return isUnsetOrInRange(listenPort, 1, 65535) && isUnsetOrInRange(mtu, 1280, 65535);
+ },
+
+ isValid: function () {
+ let me = this;
+
+ if (me.isDisabled()) {
+ return true;
+ }
+
+ return me
+ .getViewModel()
+ .getStore('interfaces')
+ .getData()
+ .items.every((iface) => me.isInterfaceValid(iface));
+ },
+
initComponent: function () {
let me = this;
@@ -534,6 +578,12 @@ Ext.define('PVE.sdn.Fabric.WireGuard.InterfacePanel', {
me.previousDirty = dirtyStatus;
me.fireEvent('dirtychange');
}
+
+ let validStatus = me.isValid();
+ if (validStatus !== me.previousValid) {
+ me.previousValid = validStatus;
+ me.fireEvent('validitychange', me, validStatus);
+ }
};
me.lookupReference('peerSelector').on({
--
2.47.3
next prev parent reply other threads:[~2026-11-20 16:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 16:00 [PATCH docs/manager/network/proxmox-perl-rs 00/10] WireGuard fabric follow-ups Stefan Hanreich
2026-11-20 16:00 ` [PATCH proxmox-perl-rs 01/10] pve-rs: sdn: fabrics: wireguard: return empty status for non-member nodes Stefan Hanreich
2026-11-20 16:00 ` [PATCH proxmox-perl-rs 02/10] pve-rs: sdn: status: wireguard: only report type of WireGuard interfaces Stefan Hanreich
2026-11-20 16:00 ` [PATCH proxmox-perl-rs 03/10] pve-rs: sdn: status: wireguard: only report running interface keys and ports Stefan Hanreich
2026-11-20 16:00 ` [PATCH pve-network 04/10] api: fabric status: document omitted WireGuard interface values Stefan Hanreich
2026-11-20 16:00 ` Stefan Hanreich [this message]
2026-11-20 16:00 ` [PATCH pve-manager 06/10] ui: sdn: fabrics: wireguard: show persistent keepalive of neighbors Stefan Hanreich
2026-11-20 16:00 ` [PATCH pve-manager 07/10] ui: sdn: fabrics: wireguard: show '-' for unknown status values Stefan Hanreich
2026-11-20 16:00 ` [PATCH pve-manager 08/10] ui: sdn: fabrics: wireguard: add reload button to status grids Stefan Hanreich
2026-11-20 16:00 ` [PATCH pve-manager 09/10] ui: sdn: fabrics: wireguard: support resetting the interfaces Stefan Hanreich
2026-11-20 16:00 ` [PATCH pve-docs 10/10] sdn: fabrics: wireguard: document status values and keepalive column Stefan Hanreich
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=20261120160026.512565-6-s.hanreich@proxmox.com \
--to=s.hanreich@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