Re: [Spice-devel] RFC: spice-server default listen behaviour change

2012-06-15 Thread Gerd Hoffmann
  Hi,

 This is pretty important wrt dual-stack configurations because they can
 be implemented with just slight changes to spice server (unlike the old
 RFE requesting listening on multiple addresses):
 
 * when no addr= or ipvx options are set, listen on ::0

spice-server sets ai.ai_flags = AI_PASSIVE | AI_ADDRCONFIG, which
should make getaddrinfo() pick something reasonable, specifically listen
on ipv6 only if the machine actually has ipv6 connectivity.

I think this is the behavior we want here.

 * when ipv4 and no addr= option is set, listen on 0.0.0.0

Works today.

 * when ipv6 is set, set IPV6_ONLY to 1 to make sure that spice server
 won't listen on ipv4

Trivially to add, see patch.

 * when conflicting ipvx and addr= options are set, error out (this
 already works fine)

Works today indeed.

cheers,
  Gerd
diff --git a/server/reds.c b/server/reds.c
index c54d30c..16f3087 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2943,9 +2943,15 @@ static int reds_init_socket(const char *addr, int 
portnr, int family)
 setsockopt(slisten,SOL_SOCKET,SO_REUSEADDR,(void*)on,sizeof(on));
 #ifdef IPV6_V6ONLY
 if (e-ai_family == PF_INET6) {
-/* listen on both ipv4 and ipv6 */
-setsockopt(slisten,IPPROTO_IPV6,IPV6_V6ONLY,(void*)off,
-   sizeof(off));
+if (family == PF_INET6) {
+/* we've been asked to listen on ipv6 only. */
+setsockopt(slisten,IPPROTO_IPV6,IPV6_V6ONLY,(void*)on,
+   sizeof(on));
+} else {
+/* listen on both ipv4 and ipv6 */
+setsockopt(slisten,IPPROTO_IPV6,IPV6_V6ONLY,(void*)off,
+   sizeof(off));
+}
 }
 #endif
 if (bind(slisten, e-ai_addr, e-ai_addrlen) == 0) {
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] RFC: spice-server default listen behaviour change

2012-06-15 Thread David Jaša
(I missed engine-devel@ previously because of typo :()

just two additions I missed yesterday:

David Jaša píše v Čt 14. 06. 2012 v 17:32 +0200:
 Hi,
 
 I learned few things about ipv6 lately. Most importantly about
 dual-socket that means that a process that opens ::0 automatically
 listens on both ipv4 _and_ ipv6 unless it sets IPV6_ONLY option of
 setsockopt() to 0.
 
 This is pretty important wrt dual-stack configurations because they can
 be implemented with just slight changes to spice server (unlike the old
 RFE requesting listening on multiple addresses):
 
 * when no addr= or ipvx options are set, listen on ::0
 
 * when ipv4 and no addr= option is set, listen on 0.0.0.0
 
 * when ipv6 is set, set IPV6_ONLY to 1 to make sure that spice server
 won't listen on ipv4
 
 * when conflicting ipvx and addr= options are set, error out (this
 already works fine)
 

* new spice-server feature: add option to bind to a selected interface
regardless of its addresses

 This will affect upper layers though, given bugs like
 https://bugzilla.redhat.com/show_bug.cgi?id=832121 , but it seems to me
 like the step in the right direction. Any thoughts/comments before I
 file this as a bug?

oVirt could leverage the last bullet to add dual-stack support pretty
much transparently if the display network is defined by dns name. Is
there an interest in this?

 
 David
 

-- 

David Jaša, RHCE

SPICE QE based in Brno
GPG Key: 22C33E24 
Fingerprint: 513A 060B D1B4 2A72 7F0D 0278 B125 CD00 22C3 3E24




___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] RFC: spice-server default listen behaviour change

2012-06-15 Thread David Jaša
Gerd Hoffmann píše v Pá 15. 06. 2012 v 10:36 +0200:
 Hi,
 
  This is pretty important wrt dual-stack configurations because they can
  be implemented with just slight changes to spice server (unlike the old
  RFE requesting listening on multiple addresses):
  
  * when no addr= or ipvx options are set, listen on ::0
 
 spice-server sets ai.ai_flags = AI_PASSIVE | AI_ADDRCONFIG, which
 should make getaddrinfo() pick something reasonable, specifically listen
 on ipv6 only if the machine actually has ipv6 connectivity.
 

I don't think that listening on IPv6 exclusively is good when the host
has both IPv4 and IPv6 connectivity. Think about dual stack setups where
the spice-server host is defined by host name that can resolve to both
IPv6 and IPv4 addresses.

David

 I think this is the behavior we want here.
 
  * when ipv4 and no addr= option is set, listen on 0.0.0.0
 
 Works today.
 
  * when ipv6 is set, set IPV6_ONLY to 1 to make sure that spice server
  won't listen on ipv4
 
 Trivially to add, see patch.
 
  * when conflicting ipvx and addr= options are set, error out (this
  already works fine)
 
 Works today indeed.
 
 cheers,
   Gerd
 ___
 Spice-devel mailing list
 Spice-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/spice-devel

-- 

David Jaša, RHCE

SPICE QE based in Brno
GPG Key: 22C33E24 
Fingerprint: 513A 060B D1B4 2A72 7F0D 0278 B125 CD00 22C3 3E24



___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] RFC: spice-server default listen behaviour change

2012-06-15 Thread Gerd Hoffmann
On 06/15/12 11:02, David Jaša wrote:
 Gerd Hoffmann píše v Pá 15. 06. 2012 v 10:36 +0200:
 Hi,

 This is pretty important wrt dual-stack configurations because they can
 be implemented with just slight changes to spice server (unlike the old
 RFE requesting listening on multiple addresses):

 * when no addr= or ipvx options are set, listen on ::0

 spice-server sets ai.ai_flags = AI_PASSIVE | AI_ADDRCONFIG, which
 should make getaddrinfo() pick something reasonable, specifically listen
 on ipv6 only if the machine actually has ipv6 connectivity.

 
 I don't think that listening on IPv6 exclusively is good when the host
 has both IPv4 and IPv6 connectivity.

Huh?  Oh, I see you can read the sentence two ways:

(1) specifically listen on ipv6 only, if the machine actually has ipv6
connectivity

(2) specifically listen on ipv6, only if the machine actually has ipv6
connectivity

I mean (2), i.e. do not create a ipv6 socket if the machine has no ipv6
connectivity.

When creating a ipv6 socket IPV6_ONLY should be clear by default indeed,
so both ipv4 and ipv6 will work.

cheers,
  Gerd
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] RFC: spice-server default listen behaviour change

2012-06-14 Thread David Jaša
Hi,

I learned few things about ipv6 lately. Most importantly about
dual-socket that means that a process that opens ::0 automatically
listens on both ipv4 _and_ ipv6 unless it sets IPV6_ONLY option of
setsockopt() to 0.

This is pretty important wrt dual-stack configurations because they can
be implemented with just slight changes to spice server (unlike the old
RFE requesting listening on multiple addresses):

* when no addr= or ipvx options are set, listen on ::0

* when ipv4 and no addr= option is set, listen on 0.0.0.0

* when ipv6 is set, set IPV6_ONLY to 1 to make sure that spice server
won't listen on ipv4

* when conflicting ipvx and addr= options are set, error out (this
already works fine)

This will affect upper layers though, given bugs like
https://bugzilla.redhat.com/show_bug.cgi?id=832121 , but it seems to me
like the step in the right direction. Any thoughts/comments before I
file this as a bug?

David

-- 

David Jaša, RHCE

SPICE QE based in Brno
GPG Key: 22C33E24 
Fingerprint: 513A 060B D1B4 2A72 7F0D 0278 B125 CD00 22C3 3E24



___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel