From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 968961FF0A7 for ; Wed, 30 Sep 2026 09:47:59 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 21B5D217A8; Wed, 30 Sep 2026 09:46:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dualfroz.com; s=dkim; t=1790691812; h=from:subject:date:message-id:to:mime-version: content-transfer-encoding; bh=RNm7lyUPIw0QPkud0PLYAt5QLDrspJyvIZ1yEmnP/RY=; b=fkfucv6kR6Pg0Qwo7BkWYlI/pJco6o/AbL570SEwHlwxL1/137EF8Ldxkb7mejD3v5hJuu LBKfnTGy9jkDb8e/h35z/xE+OGH5Qh1QjZDLQtF+USRtOdYid0TEMZzFYI9upm63VM2Nt7 jl2qI5tRQ9AP5uhUuBTrkEqRFQham3WQ124IRY7xhpeuDG6YocPAlGNYy9/x32KNL0buhz Q+csHHXatrTzTfpLJfXr+YuRmuVJ7tVzpK3KnTwSAgk03eFT1JAsJS2pjAWMLMbICDUjXg vwvdsrktXevl5922RNKkp96m91VsuBkq3IltPbmUl1ZPoaiKsN0i6cl5v/6rmQ== From: Michal Fox To: pve-devel@lists.proxmox.com Subject: [PATCH manager] fix #7108: ui: ipset: do not offer aliases that are already added Date: Tue, 29 Sep 2026 16:23:31 +0200 Message-ID: <20260929142331.2990690-1-me@dualfroz.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.035 Adjusted score from AWL reputation of From: address DKIM_INVALID 0.1 DKIM or DK signature exists, but is not valid DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DMARC_PASS -0.1 DMARC pass policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record X-MailFrom: me@dualfroz.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation Message-ID-Hash: Z73YX6T425YSN3LWLR2RJBYYYFAOLBVA X-Message-ID-Hash: Z73YX6T425YSN3LWLR2RJBYYYFAOLBVA X-Mailman-Approved-At: Wed, 30 Sep 2026 09:46:15 +0200 X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: When adding an entry to an IPSet, the alias selector lists all aliases, including those that are already part of the IPSet. Selecting one of them only results in an "already exists" error from the API. Pass the current entries of the IPSet to the add window and filter the matching aliases out of the selector. Aliases are stored in the IPSet with the same scoped reference the selector uses as value, so an exact comparison is sufficient. Signed-off-by: Michal Fox --- www/manager6/form/IPRefSelector.js | 4 ++++ www/manager6/panel/IPSet.js | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/www/manager6/form/IPRefSelector.js b/www/manager6/form/IPRefSelector.js index 08fafd9b..7be09b6b 100644 --- a/www/manager6/form/IPRefSelector.js +++ b/www/manager6/form/IPRefSelector.js @@ -8,6 +8,9 @@ Ext.define('PVE.form.IPRefSelector', { ref_type: undefined, // undefined = any [undefined, 'ipset' or 'alias'] + // list of references that should not be offered, e.g. because they are already in use + excludeRefs: [], + valueField: 'scopedref', displayField: 'ref', notFoundIsValid: true, @@ -54,6 +57,7 @@ Ext.define('PVE.form.IPRefSelector', { property: 'ref', direction: 'ASC', }, + filters: [(rec) => !me.excludeRefs.includes(rec.data.scopedref)], }); var columns = []; diff --git a/www/manager6/panel/IPSet.js b/www/manager6/panel/IPSet.js index 9e0203a0..d510ae6d 100644 --- a/www/manager6/panel/IPSet.js +++ b/www/manager6/panel/IPSet.js @@ -187,6 +187,9 @@ Ext.define('PVE.IPSetCidrEdit', { cidr: undefined, + // entries already in the IPSet, not offered again when adding a new one + existingCidrs: [], + initComponent: function () { var me = this; @@ -211,6 +214,7 @@ Ext.define('PVE.IPSetCidrEdit', { xtype: 'pveIPRefSelector', name: 'cidr', ref_type: 'alias', + excludeRefs: me.existingCidrs, autoSelect: false, editable: true, base_url: me.list_refs_url, @@ -359,6 +363,7 @@ Ext.define( var win = Ext.create('PVE.IPSetCidrEdit', { base_url: me.base_url, list_refs_url: me.list_refs_url, + existingCidrs: store.collect('cidr'), }); win.show(); win.on('destroy', reload); -- 2.43.0