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?
The AI_ADDRCONFIG flag to getaddrinfo should have taken care of
filtering out IPv6 addresses if you only have the link-local one
(fe80::), but 2620:: looks like a legitimate unicast address.
Checking for EADDRNOTAVAIL here is intentional to catch configuration
errors (i.e. a typo in a literal listen address or misconfigured DNS).
Why does your hostname resolve to an unavailable address?
Jano