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) {
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list