From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Wolfgang Bumiller <w.bumiller@proxmox.com>
Subject: Re: [pve-devel] [PATCH v2 manager] ad #3140: allow interface suffix in dns entries
Date: Wed, 25 Nov 2020 10:54:18 +0100 [thread overview]
Message-ID: <c4f991fa-244b-44e4-9a7f-e5bedcc2b8c2@proxmox.com> (raw)
In-Reply-To: <20201125085412.5205-1-w.bumiller@proxmox.com>
On 25.11.20 09:54, Wolfgang Bumiller wrote:
> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> ---
> Changes to v1:
> * moved helper to PVE.Utils
> * lint fixups
>
> www/manager6/Toolkit.js | 17 ++---------------
> www/manager6/Utils.js | 30 ++++++++++++++++++++++++++++++
> www/manager6/lxc/DNS.js | 2 +-
> 3 files changed, 33 insertions(+), 16 deletions(-)
>
> 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})?)$/).test(v);
> },
> QemuStartDateText: gettext('Format') + ': "now" or "2006-06-17T16:01:21" or "2006-06-17"',
> - IP64AddressList: function(v) {
> - var list = v.split(/[\ \,\;]+/);
> - var i;
> - for (i = 0; i < list.length; i++) {
> - if (list[i] == '') {
> - continue;
> - }
> -
> - if (!Proxmox.Utils.IP64_match.test(list[i])) {
> - return false;
> - }
> - }
> -
> - return true;
> - },
> + IP64AddressList: v => PVE.Utils.verify_ip64_address_list(v, false),
> + IP64AddressWithSuffixList: v => PVE.Utils.verify_ip64_address_list(v, true),
> IP64AddressListText: gettext('Example') + ': 192.168.1.1,192.168.1.2',
> 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 = value.split(/[ ,;]+/);
> + let i;
> + for (i = 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] === '') {
> + continue;
> + }
> +
> + let addr = list[i];
> + if (with_suffix) {
> + let parts = addr.split('%');
> + addr = 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;
> + },
> },
>
> singleton: true,
prev parent reply other threads:[~2020-11-25 9:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-25 8:54 Wolfgang Bumiller
2020-11-25 9:54 ` Thomas Lamprecht [this message]
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=c4f991fa-244b-44e4-9a7f-e5bedcc2b8c2@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=w.bumiller@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