[libvirt] virNetSocketNewListenTCP tries just one address

Daniel P. Berrangé berrange at redhat.com
Tue Mar 27 08:56:45 UTC 2018


On Tue, Mar 27, 2018 at 09:57:13AM +0200, Olaf Hering wrote:
> To rescue this bug from the noise in a subthread:
> 
> If a hostname resolves to more than one address and the host currently
> configured itself for just IPv4, doing a bind() to some IPv6 address
> will fail. As a result an error is returned instead of continuing with
> the next item in 'runp'.
> 
> > Mär 20 09:35:52 macintyre-old libvirtd[4527]: 2018-03-20 08:35:52.521+0000: 4531: error : virNetSocketNewListenTCP:389 : Unable to bind to port: Cannot assign requested address
> 
> After further debugging:
> 
> 27672 16:04:46.774906 socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP) = 35
> 27672 16:04:46.775041 setsockopt(35, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
> 27672 16:04:46.775172 setsockopt(35, SOL_IPV6, IPV6_V6ONLY, [1], 4) = 0
> 27672 16:04:46.775302 bind(35, {sa_family=AF_INET6, sin6_port=htons(49152), inet_pton(AF_INET6, "2620:113:80c0:8000:10:161:8:197", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 EADDRNOTAVAIL (Cannot assign requested address)
> 27672 16:04:46.775455 gettid()          = 27672
> 27672 16:04:46.775590 write(4, "2018-03-20 15:04:46.775+0000: 27672: error : virNetSocketNewListenTCP:389 : Unable to bind to port: Cannot assign requested address\n", 132) = 132
> 27672 16:04:46.775742 gettid()          = 27672
> 27672 16:04:46.775875 write(4, "2018-03-20 15:04:46.775+0000: 27672: info : virObjectUnref:350 : OBJECT_UNREF: obj=0x7fa4bc003530\n", 98) = 98
> 27672 16:04:46.776026 gettid()          = 27672
> 
> So for some reason libvirtd tries to bind to ipv6 even if the host does
> not have that ipv6 address at this point, only the link-local address.
> Not sure if there is a way to detect that within libvirt. Perhaps it
> should just move on with the runp list and try the next one?

It looks like the virNetSocketNewListenTCP only treats EAFNOSUPPORT as an
error to continue with - everything else is fatal. At very least we need
to add EADDRNOTAVAIL too.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list