summaryrefslogtreecommitdiffstats
path: root/utils/nfsd
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2009-08-14 13:33:02 -0400
committerSteve Dickson <steved@redhat.com>2009-08-14 13:33:02 -0400
commit513acad321c325207a9d8f7f0129253b0e2b6d11 (patch)
treed2e74229c663b704039934bc7f29f0d769a63a08 /utils/nfsd
parent094b26031a376050d8610d055eb01c7949ad6547 (diff)
downloadnfs-utils-513acad321c325207a9d8f7f0129253b0e2b6d11.tar.gz
nfs-utils-513acad321c325207a9d8f7f0129253b0e2b6d11.tar.xz
nfs-utils-513acad321c325207a9d8f7f0129253b0e2b6d11.zip
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@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/nfsd')
-rw-r--r--utils/nfsd/nfssvc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
index 106f6e7..ee862b2 100644
--- a/utils/nfsd/nfssvc.c
+++ b/utils/nfsd/nfssvc.c
@@ -81,6 +81,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);
@@ -128,6 +133,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 (%m)\n", errno);
+ rc = errno;
+ goto error;
+ }
+#endif /* IPV6_SUPPORTED */
if (addr->ai_protocol == IPPROTO_TCP &&
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))) {
xlog(L_ERROR, "unable to set SO_REUSEADDR on %s "