From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id BE04063827 for ; Wed, 25 Nov 2020 10:54:20 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B3846175AB for ; Wed, 25 Nov 2020 10:54:20 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id C6E15175A1 for ; Wed, 25 Nov 2020 10:54:19 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8EBFF44071 for ; Wed, 25 Nov 2020 10:54:19 +0100 (CET) To: Proxmox VE development discussion , Wolfgang Bumiller References: <20201125085412.5205-1-w.bumiller@proxmox.com> From: Thomas Lamprecht Message-ID: Date: Wed, 25 Nov 2020 10:54:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Thunderbird/83.0 MIME-Version: 1.0 In-Reply-To: <20201125085412.5205-1-w.bumiller@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL -0.081 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -0.001 Looks like a legit reply (A) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH v2 manager] ad #3140: allow interface suffix in dns entries X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2020 09:54:20 -0000 On 25.11.20 09:54, Wolfgang Bumiller wrote: > Signed-off-by: Wolfgang Bumiller > --- > Changes to v1: > * moved helper to PVE.Utils > * lint fixups >=20 > www/manager6/Toolkit.js | 17 ++--------------- > www/manager6/Utils.js | 30 ++++++++++++++++++++++++++++++ > www/manager6/lxc/DNS.js | 2 +- > 3 files changed, 33 insertions(+), 16 deletions(-) >=20 > diff --git a/www/manager6/Toolkit.js b/www/manager6/Toolkit.js > index 55b127c5..0569d649 100644 > --- a/www/manager6/Toolkit.js > +++ b/www/manager6/Toolkit.js > @@ -9,21 +9,8 @@ Ext.apply(Ext.form.field.VTypes, { > return (/^(now|\d{4}-\d{1,2}-\d{1,2}(T\d{1,2}:\d{1,2}:\d{1,2})?)$/).t= est(v); > }, > QemuStartDateText: gettext('Format') + ': "now" or "2006-06-17T16:= 01:21" or "2006-06-17"', > - IP64AddressList: function(v) { > - var list =3D v.split(/[\ \,\;]+/); > - var i; > - for (i =3D 0; i < list.length; i++) { > - if (list[i] =3D=3D '') { > - continue; > - } > - > - if (!Proxmox.Utils.IP64_match.test(list[i])) { > - return false; > - } > - } > - > - return true; > - }, > + IP64AddressList: v =3D> PVE.Utils.verify_ip64_address_list(v, fals= e), > + IP64AddressWithSuffixList: v =3D> PVE.Utils.verify_ip64_address_li= st(v, true), > IP64AddressListText: gettext('Example') + ': 192.168.1.1,192.168.1= =2E2', > IP64AddressListMask: /[A-Fa-f0-9\,\:\.\;\ ]/ > }); > diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js > index 6d2f7a04..9330c49a 100644 > --- a/www/manager6/Utils.js > +++ b/www/manager6/Utils.js > @@ -1612,6 +1612,36 @@ Ext.define('PVE.Utils', { utilities: { > "Host": 4, > "_default_": 5, // includes custom models > }, > + > + verify_ip64_address_list: function(value, with_suffix) { > + let list =3D value.split(/[ ,;]+/); > + let i; > + for (i =3D 0; i < list.length; i++) { I know you mostly copied it but why not a slight cleanup? for (let addr of value.split(/[ ,;]+/)) { ... } saves about four lines without loosing clarity, IMO > + if (list[i] =3D=3D=3D '') { > + continue; > + } > + > + let addr =3D list[i]; > + if (with_suffix) { > + let parts =3D addr.split('%'); > + addr =3D parts[0]; > + > + if (parts.length > 2) { > + return false; > + } > + > + if (parts.length > 1 && !addr.startsWith('fe80:')) { > + return false; > + } > + } > + > + if (!Proxmox.Utils.IP64_match.test(addr)) { > + return false; > + } > + } > + > + return true; > + }, > }, > =20 > singleton: true,