]> xenbits.xensource.com Git - libvirt.git/commitdiff
rpc: treat EADDRNOTAVAIL as non-fatal when listening
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 24 Jul 2018 14:15:14 +0000 (15:15 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Wed, 25 Jul 2018 15:55:55 +0000 (16:55 +0100)
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 <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/rpc/virnetsocket.c

index f9163f928c6d55cd35648074514f561eae0be211..55de3b2aadc3bd196d656310af2ea3eca7ad069e 100644 (file)
@@ -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;
             }