summaryrefslogtreecommitdiffstats
path: root/source/n/nfs-utils/ignore_unsupported_address_types_in_nfssvc_setfds.diff
blob: 6384888e9258b51c81c13f3f76fb3792c536b9b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From: Christoph Hellwig <hch at lst.de>
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 <chuck.lever at oracle.com>
Signed-off-by: Christoph Hellwig <hch at lst.de>

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 &&
--