On Jun 3, 2009, at 4:16 PM, Steve Dickson wrote:
Chuck Lever wrote:
On Jun 3, 2009, at 3:52 PM, Jeff Layton wrote:
Allow nfssvc_setfds to properly deal with AF_INET6.
IPv6 sockets for knfsd can't be allowed to accept IPv4 packets.
Set the
correct option to prevent that from occurring on IPv6 sockets.
Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
support/nfs/nfssvc.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/support/nfs/nfssvc.c b/support/nfs/nfssvc.c
index 89fb5be..19f1a4c 100644
--- a/support/nfs/nfssvc.c
+++ b/support/nfs/nfssvc.c
@@ -76,6 +76,11 @@ nfssvc_setfds(const struct addrinfo *hints, const
char *node, const char *port)
case AF_INET:
family = "inet";
break;
+#ifdef IPV6_SUPPORTED
+ case AF_INET6:
+ family = "inet6";
+ break;
+#endif /* IPV6_SUPPORTED */
default:
xlog(L_ERROR, "Unknown address family specified: %d\n",
hints->ai_family);
@@ -123,6 +128,15 @@ nfssvc_setfds(const struct addrinfo *hints,
const
char *node, const char *port)
rc = errno;
goto error;
}
+#ifdef IPV6_SUPPORTED
+ if (addr->ai_family == AF_INET6 &&
+ setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY, &on,
sizeof(on))) {
+ xlog(L_ERROR, "unable to set IPV6_V6ONLY: "
+ "errno %d (%s)\n", errno, strerror(errno));
I'm still looking at the other patches, but I notice you could use %m
here too.
I kinda like having both... the errno *and* the error string...
You can use %m and print the errno too.
--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html