virNetSocketCheckProtocols: handle EAI_NONAME as IPv6 unavailable

When running the test suite using "unshare -n" we might have IPv6 but no
configured addresses. Due to AI_ADDRCONFIG getaddrinfo then fails with
EAI_NONAME which we should then treat as IPv6 unavailable.

(cherry picked from commit fbb27088eec1b54fcd5a0950b11c31d27a2598d4)
This commit is contained in:
Guido Günther 2015-08-11 11:49:18 +02:00 committed by Cole Robinson
parent 58211ca54d
commit 85cf1ad5aa

View File

@ -183,7 +183,8 @@ int virNetSocketCheckProtocols(bool *hasIPv4,
if ((gaierr = getaddrinfo("::1", NULL, &hints, &ai)) != 0) {
if (gaierr == EAI_ADDRFAMILY ||
gaierr == EAI_FAMILY) {
gaierr == EAI_FAMILY ||
gaierr == EAI_NONAME) {
*hasIPv6 = false;
} else {
virReportError(VIR_ERR_INTERNAL_ERROR,