Commit 7d21c0f9 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

SUNRPC: Set IPV6ONLY flag on PF_INET6 RPC listener sockets

We are about to convert to using separate RPC listener sockets for
PF_INET and PF_INET6.  This echoes the way IPv6 is handled in user
space by TI-RPC, and eliminates the need for ULPs to worry about
mapped IPv4 AF_INET6 addresses when doing address comparisons.

Start by setting the IPV6ONLY flag on PF_INET6 RPC listener sockets.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 26298caa
...@@ -1144,13 +1144,11 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv, ...@@ -1144,13 +1144,11 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
svc_tcp_init(svsk, serv); svc_tcp_init(svsk, serv);
/* /*
* We start one listener per sv_serv. We want AF_INET * If this is a PF_INET6 listener, we want to avoid
* requests to be automatically shunted to our PF_INET6 * getting requests from IPv4 remotes. Those should
* listener using a mapped IPv4 address. Make sure * be shunted to a PF_INET listener via rpcbind.
* no-one starts an equivalent IPv4 listener, which
* would steal our incoming connections.
*/ */
val = 0; val = 1;
if (inet->sk_family == PF_INET6) if (inet->sk_family == PF_INET6)
kernel_setsockopt(sock, SOL_IPV6, IPV6_V6ONLY, kernel_setsockopt(sock, SOL_IPV6, IPV6_V6ONLY,
(char *)&val, sizeof(val)); (char *)&val, sizeof(val));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment