From: Daniel P. Berrangé Date: Tue, 24 Jul 2018 14:15:14 +0000 (+0100) Subject: rpc: treat EADDRNOTAVAIL as non-fatal when listening X-Git-Tag: v4.6.0-rc1~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2eb748d2599c6e9f8081e372a803f621fc7d0649;p=thirdparty%2Flibvirt.git rpc: treat EADDRNOTAVAIL as non-fatal when listening Consider creating a listener socket from a hostname that resolves to multiple addresses. It might be the case that the hostname resolves to both an IPv4 and IPv6 address because it is reachable over both protocols, but the IPv6 connectivity is provided off-host. In such a case no local NIC will have IPv6 and so bind() would fail with the EADDRNOTAVAIL errno. Thus it should be treated as non-fatal as long as at least one socket was succesfully bound. Reviewed-by: Jiri Denemark Signed-off-by: Daniel P. Berrangé --- diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index f9163f928c..55de3b2aad 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -382,7 +382,7 @@ int virNetSocketNewListenTCP(const char *nodename, #endif if (bind(fd, runp->ai_addr, runp->ai_addrlen) < 0) { - if (errno != EADDRINUSE) { + if (errno != EADDRINUSE && errno != EADDRNOTAVAIL) { virReportSystemError(errno, "%s", _("Unable to bind to port")); goto error; }