From c31fef7f4beb736f6cfe29a2de6d769c7c1e780d Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Fri, 30 Oct 2015 09:18:21 -0400 Subject: nfsd: ignore unsupported address types in nfssvc_setfds Just continue and try a different record returned from getaddrinfo if the kernel does not support an address family. This fixes nfsd startup on kernels without IPv6 support. Suggested-by: Chuck Lever Signed-off-by: Christoph Hellwig Signed-off-by: Steve Dickson --- utils/nfsd/nfssvc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c index a2b11d8..fc11d23 100644 --- a/utils/nfsd/nfssvc.c +++ b/utils/nfsd/nfssvc.c @@ -174,15 +174,14 @@ nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port) sockfd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol); if (sockfd < 0) { - if (errno == EAFNOSUPPORT) - xlog(L_NOTICE, "address family %s not " - "supported by protocol %s", - family, proto); - else + if (errno != EAFNOSUPPORT) { xlog(L_ERROR, "unable to create %s %s socket: " "errno %d (%m)", family, proto, errno); - rc = errno; - goto error; + rc = errno; + goto error; + } + addr = addr->ai_next; + continue; } #ifdef IPV6_SUPPORTED if (addr->ai_family == AF_INET6 && -- cgit