Skip to contentSkip to conversation

rpc.nfsd: Do not fail when all address families are not support.

PATCH In review Steve Dickson 1 participant 2 messages Oct 2, 2017 – Oct 5, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rpc.nfsd: Do not fail when all address families are not support.

Commit 2f8a6020 introduce a regression causing rpc.nfsd to fail when IPv6 is not supported. rpc.nfsd should not fail when there is at least one bounded socket.

---
 utils/nfsd/nfssvc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
utils/nfsd/nfssvc.c +4 -2
index e8609c1..fc36792 100644
@@ -112,7 +112,7 @@ static int
 nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port)
 {
 	int fd, on = 1, fac = L_ERROR;
-	int sockfd = -1, rc = 0;
+	int sockfd = -1, rc = 0, bounded = 0;
 	struct addrinfo *addrhead = NULL, *addr;
 	char *proto, *family;
 
@@ -233,6 +233,8 @@ nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port)
 			rc = errno;
 			goto error;
 		}
+		bounded++;
+
 		close(fd);
 		close(sockfd);
 		sockfd = fd = -1;
@@ -245,7 +247,7 @@ error:
 		close(sockfd);
 	if (addrhead)
 		freeaddrinfo(addrhead);
-	return rc;
+	return (bounded ? 0 : rc);
 }
 
 int
Signature · 1 line
2.13.5
#1 lore raw
Quoted 5 lines · Steve Dickson

Commit 2f8a6020 introduce a regression causing rpc.nfsd to fail when IPv6 is not supported. rpc.nfsd should not fail when there is at least one bounded socket.

Committed....

steved.

Quoted 36 lines
---
 utils/nfsd/nfssvc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
utils/nfsd/nfssvc.c +4 -2
index e8609c1..fc36792 100644
@@ -112,7 +112,7 @@ static int
 nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port)
 {
 	int fd, on = 1, fac = L_ERROR;
-	int sockfd = -1, rc = 0;
+	int sockfd = -1, rc = 0, bounded = 0;
 	struct addrinfo *addrhead = NULL, *addr;
 	char *proto, *family;
 
@@ -233,6 +233,8 @@ nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port)
 			rc = errno;
 			goto error;
 		}
+		bounded++;
+
 		close(fd);
 		close(sockfd);
 		sockfd = fd = -1;
@@ -245,7 +247,7 @@ error:
 		close(sockfd);
 	if (addrhead)
 		freeaddrinfo(addrhead);
-	return rc;
+	return (bounded ? 0 : rc);
 }
 
 int