public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v3 manager] ad #3140: allow interface suffix in dns entries
@ 2020-11-25 10:36 Wolfgang Bumiller
  2020-11-25 11:08 ` Dietmar Maurer
  2020-11-25 12:31 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 2 replies; 9+ messages in thread
From: Wolfgang Bumiller @ 2020-11-25 10:36 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
---
changes to v2:
* use `for of` loop in verify_ip64_address_list

 www/manager6/Toolkit.js | 17 ++---------------
 www/manager6/Utils.js   | 27 +++++++++++++++++++++++++++
 www/manager6/lxc/DNS.js |  2 +-
 3 files changed, 30 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..6e6498a2 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1612,6 +1612,33 @@ Ext.define('PVE.Utils', { utilities: {
 	"Host": 4,
 	"_default_": 5, // includes custom models
     },
+
+    verify_ip64_address_list: function(value, with_suffix) {
+	for (let addr of value.split(/[ ,;]+/)) {
+	    if (addr === '') {
+		continue;
+	    }
+
+	    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,
diff --git a/www/manager6/lxc/DNS.js b/www/manager6/lxc/DNS.js
index a15db5a9..b1e03920 100644
--- a/www/manager6/lxc/DNS.js
+++ b/www/manager6/lxc/DNS.js
@@ -41,7 +41,7 @@ Ext.define('PVE.lxc.DNSInputPanel', {
 	    {
 		xtype: 'proxmoxtextfield',
 		fieldLabel: gettext('DNS servers'),
-		vtype: 'IP64AddressList',
+		vtype: 'IP64AddressWithSuffixList',
 		allowBlank: true,
 		emptyText: gettext('use host settings'),
 		name: 'nameserver',
-- 
2.20.1





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [pve-devel] [PATCH v3 manager] ad #3140: allow interface suffix in dns entries
  2020-11-25 10:36 [pve-devel] [PATCH v3 manager] ad #3140: allow interface suffix in dns entries Wolfgang Bumiller
@ 2020-11-25 11:08 ` Dietmar Maurer
  2020-11-25 11:22   ` Dietmar Maurer
  2020-11-25 11:22   ` Stoiko Ivanov
  2020-11-25 12:31 ` [pve-devel] applied: " Thomas Lamprecht
  1 sibling, 2 replies; 9+ messages in thread
From: Dietmar Maurer @ 2020-11-25 11:08 UTC (permalink / raw)
  To: Proxmox VE development discussion, Wolfgang Bumiller

What kind of format is that? RFC2373 does not mention it. Please can
you give me a hint?


> On 11/25/2020 11:36 AM Wolfgang Bumiller <w.bumiller@proxmox.com> wrote:
> 
>  
> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> ---
> changes to v2:
> * use `for of` loop in verify_ip64_address_list
> 
>  www/manager6/Toolkit.js | 17 ++---------------
>  www/manager6/Utils.js   | 27 +++++++++++++++++++++++++++
>  www/manager6/lxc/DNS.js |  2 +-
>  3 files changed, 30 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..6e6498a2 100644
> --- a/www/manager6/Utils.js
> +++ b/www/manager6/Utils.js
> @@ -1612,6 +1612,33 @@ Ext.define('PVE.Utils', { utilities: {
>  	"Host": 4,
>  	"_default_": 5, // includes custom models
>      },
> +
> +    verify_ip64_address_list: function(value, with_suffix) {
> +	for (let addr of value.split(/[ ,;]+/)) {
> +	    if (addr === '') {
> +		continue;
> +	    }
> +
> +	    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,
> diff --git a/www/manager6/lxc/DNS.js b/www/manager6/lxc/DNS.js
> index a15db5a9..b1e03920 100644
> --- a/www/manager6/lxc/DNS.js
> +++ b/www/manager6/lxc/DNS.js
> @@ -41,7 +41,7 @@ Ext.define('PVE.lxc.DNSInputPanel', {
>  	    {
>  		xtype: 'proxmoxtextfield',
>  		fieldLabel: gettext('DNS servers'),
> -		vtype: 'IP64AddressList',
> +		vtype: 'IP64AddressWithSuffixList',
>  		allowBlank: true,
>  		emptyText: gettext('use host settings'),
>  		name: 'nameserver',
> -- 
> 2.20.1
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [pve-devel] [PATCH v3 manager] ad #3140: allow interface suffix in dns entries
  2020-11-25 11:08 ` Dietmar Maurer
@ 2020-11-25 11:22   ` Dietmar Maurer
  2020-11-25 11:34     ` Wolfgang Bumiller
  2020-11-25 11:22   ` Stoiko Ivanov
  1 sibling, 1 reply; 9+ messages in thread
From: Dietmar Maurer @ 2020-11-25 11:22 UTC (permalink / raw)
  To: Proxmox VE development discussion, Wolfgang Bumiller

Answering myself, it is defined in RFC4007.

But "man resolv.conf" say address must be RFC2373 ?


> On 11/25/2020 12:08 PM Dietmar Maurer <dietmar@proxmox.com> wrote:
> 
>  
> What kind of format is that? RFC2373 does not mention it. Please can
> you give me a hint?
>




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [pve-devel] [PATCH v3 manager] ad #3140: allow interface suffix in dns entries
  2020-11-25 11:08 ` Dietmar Maurer
  2020-11-25 11:22   ` Dietmar Maurer
@ 2020-11-25 11:22   ` Stoiko Ivanov
  1 sibling, 0 replies; 9+ messages in thread
From: Stoiko Ivanov @ 2020-11-25 11:22 UTC (permalink / raw)
  To: Dietmar Maurer; +Cc: Proxmox VE development discussion, Wolfgang Bumiller

On Wed, 25 Nov 2020 12:08:39 +0100 (CET)
Dietmar Maurer <dietmar@proxmox.com> wrote:

> What kind of format is that? RFC2373 does not mention it. Please can
> you give me a hint?
was curious myself - since I know the format but wasn't sure where it's
specified. ripe has a nice explanation:
https://labs.ripe.net/Members/philip_homburg/whats-the-deal-with-ipv6-link-local-addresses
and refers to https://tools.ietf.org/html/rfc4007



> 
> 
> > On 11/25/2020 11:36 AM Wolfgang Bumiller <w.bumiller@proxmox.com> wrote:
> > 
> >  
> > Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> > ---
> > changes to v2:
> > * use `for of` loop in verify_ip64_address_list
> > 
> >  www/manager6/Toolkit.js | 17 ++---------------
> >  www/manager6/Utils.js   | 27 +++++++++++++++++++++++++++
> >  www/manager6/lxc/DNS.js |  2 +-
> >  3 files changed, 30 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..6e6498a2 100644
> > --- a/www/manager6/Utils.js
> > +++ b/www/manager6/Utils.js
> > @@ -1612,6 +1612,33 @@ Ext.define('PVE.Utils', { utilities: {
> >  	"Host": 4,
> >  	"_default_": 5, // includes custom models
> >      },
> > +
> > +    verify_ip64_address_list: function(value, with_suffix) {
> > +	for (let addr of value.split(/[ ,;]+/)) {
> > +	    if (addr === '') {
> > +		continue;
> > +	    }
> > +
> > +	    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,
> > diff --git a/www/manager6/lxc/DNS.js b/www/manager6/lxc/DNS.js
> > index a15db5a9..b1e03920 100644
> > --- a/www/manager6/lxc/DNS.js
> > +++ b/www/manager6/lxc/DNS.js
> > @@ -41,7 +41,7 @@ Ext.define('PVE.lxc.DNSInputPanel', {
> >  	    {
> >  		xtype: 'proxmoxtextfield',
> >  		fieldLabel: gettext('DNS servers'),
> > -		vtype: 'IP64AddressList',
> > +		vtype: 'IP64AddressWithSuffixList',
> >  		allowBlank: true,
> >  		emptyText: gettext('use host settings'),
> >  		name: 'nameserver',
> > -- 
> > 2.20.1
> > 
> > 
> > 
> > _______________________________________________
> > pve-devel mailing list
> > pve-devel@lists.proxmox.com
> > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel  
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [pve-devel] [PATCH v3 manager] ad #3140: allow interface suffix in dns entries
  2020-11-25 11:22   ` Dietmar Maurer
@ 2020-11-25 11:34     ` Wolfgang Bumiller
  2020-11-25 11:39       ` Dietmar Maurer
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Bumiller @ 2020-11-25 11:34 UTC (permalink / raw)
  To: Dietmar Maurer, Proxmox VE development discussion

> On 11/25/2020 12:22 PM Dietmar Maurer <dietmar@proxmox.com> wrote:
> 
>  
> Answering myself, it is defined in RFC4007.
> 
> But "man resolv.conf" say address must be RFC2373 ?

It'll still work. It's a very common notation for link local addresses,
since with multiple interfaces you have multiple routes with the exact
same prefix (including length). One `fe80::/64 dev <iface>` entry for
every ipv6 enabled interface, so things such as `ping fe80::1` don't
know what to do, so you need to either add `-I IFACE` or use
`fe80::1%IFACE`.

`getaddrinfo()` also generally supports it, so any application using
it properly will work fine with this.
(eg. `ssh foo@fe80::1%eth0` works)




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [pve-devel] [PATCH v3 manager] ad #3140: allow interface suffix in dns entries
  2020-11-25 11:34     ` Wolfgang Bumiller
@ 2020-11-25 11:39       ` Dietmar Maurer
  2020-11-25 11:51         ` Wolfgang Bumiller
  0 siblings, 1 reply; 9+ messages in thread
From: Dietmar Maurer @ 2020-11-25 11:39 UTC (permalink / raw)
  To: Wolfgang Bumiller, Proxmox VE development discussion

Thanks for the info. But what encoding does that text use? I cannot find that in RFC4007 (they only
talk about strings and text).

> > Answering myself, it is defined in RFC4007.
> > 
> > But "man resolv.conf" say address must be RFC2373 ?
> 
> It'll still work. It's a very common notation for link local addresses,
> since with multiple interfaces you have multiple routes with the exact
> same prefix (including length). One `fe80::/64 dev <iface>` entry for
> every ipv6 enabled interface, so things such as `ping fe80::1` don't
> know what to do, so you need to either add `-I IFACE` or use
> `fe80::1%IFACE`.
> 
> `getaddrinfo()` also generally supports it, so any application using
> it properly will work fine with this.
> (eg. `ssh foo@fe80::1%eth0` works)




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [pve-devel] [PATCH v3 manager] ad #3140: allow interface suffix in dns entries
  2020-11-25 11:39       ` Dietmar Maurer
@ 2020-11-25 11:51         ` Wolfgang Bumiller
  2020-11-25 11:57           ` Dietmar Maurer
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Bumiller @ 2020-11-25 11:51 UTC (permalink / raw)
  To: Dietmar Maurer, Proxmox VE development discussion

What text do you mean exactly? The interface name?
Arbitrary null-terminated byte string...
(Yes I can name an interface "---" or 💩 (poop-emoji)...,
neither of which our iface schema in JSONSchema.pm would allow...)

> On 11/25/2020 12:39 PM Dietmar Maurer <dietmar@proxmox.com> wrote:
> 
>  
> Thanks for the info. But what encoding does that text use? I cannot find that in RFC4007 (they only
> talk about strings and text).
> 
> > > Answering myself, it is defined in RFC4007.
> > > 
> > > But "man resolv.conf" say address must be RFC2373 ?
> > 
> > It'll still work. It's a very common notation for link local addresses,
> > since with multiple interfaces you have multiple routes with the exact
> > same prefix (including length). One `fe80::/64 dev <iface>` entry for
> > every ipv6 enabled interface, so things such as `ping fe80::1` don't
> > know what to do, so you need to either add `-I IFACE` or use
> > `fe80::1%IFACE`.
> > 
> > `getaddrinfo()` also generally supports it, so any application using
> > it properly will work fine with this.
> > (eg. `ssh foo@fe80::1%eth0` works)




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [pve-devel] [PATCH v3 manager] ad #3140: allow interface suffix in dns entries
  2020-11-25 11:51         ` Wolfgang Bumiller
@ 2020-11-25 11:57           ` Dietmar Maurer
  0 siblings, 0 replies; 9+ messages in thread
From: Dietmar Maurer @ 2020-11-25 11:57 UTC (permalink / raw)
  To: Wolfgang Bumiller, Proxmox VE development discussion

> What text do you mean exactly? The interface name?
> Arbitrary null-terminated byte string...

Ok

> (Yes I can name an interface "---" or 💩 (poop-emoji)...,
> neither of which our iface schema in JSONSchema.pm would allow...)

great.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [pve-devel] applied: [PATCH v3 manager] ad #3140: allow interface suffix in dns entries
  2020-11-25 10:36 [pve-devel] [PATCH v3 manager] ad #3140: allow interface suffix in dns entries Wolfgang Bumiller
  2020-11-25 11:08 ` Dietmar Maurer
@ 2020-11-25 12:31 ` Thomas Lamprecht
  1 sibling, 0 replies; 9+ messages in thread
From: Thomas Lamprecht @ 2020-11-25 12:31 UTC (permalink / raw)
  To: Proxmox VE development discussion, Wolfgang Bumiller

On 25.11.20 11:36, Wolfgang Bumiller wrote:
> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> ---
> changes to v2:
> * use `for of` loop in verify_ip64_address_list
> 
>  www/manager6/Toolkit.js | 17 ++---------------
>  www/manager6/Utils.js   | 27 +++++++++++++++++++++++++++
>  www/manager6/lxc/DNS.js |  2 +-
>  3 files changed, 30 insertions(+), 16 deletions(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-11-25 12:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 10:36 [pve-devel] [PATCH v3 manager] ad #3140: allow interface suffix in dns entries Wolfgang Bumiller
2020-11-25 11:08 ` Dietmar Maurer
2020-11-25 11:22   ` Dietmar Maurer
2020-11-25 11:34     ` Wolfgang Bumiller
2020-11-25 11:39       ` Dietmar Maurer
2020-11-25 11:51         ` Wolfgang Bumiller
2020-11-25 11:57           ` Dietmar Maurer
2020-11-25 11:22   ` Stoiko Ivanov
2020-11-25 12:31 ` [pve-devel] applied: " Thomas Lamprecht

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