From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: trond.myklebust@netapp.com, trond.myklebust@fys.uio.no,
linux-nfs@vger.kernel.org
Subject: Re: [PATCH 3/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets
Date: Thu, 14 Aug 2008 16:38:33 -0400 [thread overview]
Message-ID: <20080814203833.GK23859@fieldses.org> (raw)
In-Reply-To: <74E488BD-DB15-41CD-AD30-A8A5213BC140@oracle.com>
On Thu, Aug 14, 2008 at 04:34:14PM -0400, Chuck Lever wrote:
> On Aug 14, 2008, at 4:05 PM, J. Bruce Fields wrote:
>> On Wed, Aug 13, 2008 at 06:39:54PM -0400, Chuck Lever wrote:
>>> My plan is to use an AF_INET listener on systems that support only
>>> IPv4,
>>> and an AF_INET6 listener on systems that can support IPv6. Incoming
>>> IPv4 packets will be posted to an AF_INET6 listener with a mapped
>>> IPv4
>>> address.
>>
>> How will the nfs server choose whether to use AF_INET or AF_INET6?
>> Will
>> we need some new user interface?
>
> [PATCH 2/8] changes svc_create() to take an additional argument which
> specifies the listener's address family. This value is stored in
> svc_serv.
Right, but I'm asking about the nfsd server, not the rpc server, and the
user interface, not the in-kernel interface: so suppose I'm a server
administrator, and want my nfs server to listen for ipv6 connections.
Will there be some switch I'll need to flip?
--b.
>
>>> Max Matveev <makc@sgi.com> says:
>>> Creating a single listener can be dangerous - if net.ipv6.bindv6only
>>> is enabled then it's possible to create another listener in v4
>>> namespace on the same port and steal the traffic from the "unifed"
>>> listener. You need to disable V6ONLY explicitly via a sockopt to
>>> stop
>>> that.
>>>
>>> Set appropriate socket option on RPC server listener sockets to
>>> prevent
>>> this.
>>>
>>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>>> ---
>>>
>>> net/sunrpc/svcsock.c | 13 +++++++++++++
>>> 1 files changed, 13 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
>>> index 3e65719..f91377c 100644
>>> --- a/net/sunrpc/svcsock.c
>>> +++ b/net/sunrpc/svcsock.c
>>> @@ -1114,6 +1114,7 @@ static struct svc_sock
>>> *svc_setup_socket(struct svc_serv *serv,
>>> struct svc_sock *svsk;
>>> struct sock *inet;
>>> int pmap_register = !(flags & SVC_SOCK_ANONYMOUS);
>>> + int val;
>>>
>>> dprintk("svc: svc_setup_socket %p\n", sock);
>>> if (!(svsk = kzalloc(sizeof(*svsk), GFP_KERNEL))) {
>>> @@ -1146,6 +1147,18 @@ static struct svc_sock
>>> *svc_setup_socket(struct svc_serv *serv,
>>> else
>>> svc_tcp_init(svsk, serv);
>>>
>>> + /*
>>> + * We start one listener per sv_serv. We want AF_INET
>>> + * requests to be automatically shunted to our AF_INET6
>>> + * listener using a mapped IPv4 address. Make sure
>>> + * no-one starts an equivalent IPv4 listener, which
>>> + * would steal our incoming connections.
>>> + */
>>> + val = 0;
>>> + if (serv->sv_family == AF_INET6)
>>> + kernel_setsockopt(sock, SOL_IPV6, IPV6_V6ONLY,
>>> + (char *)&val, sizeof(val));
>>> +
>>> dprintk("svc: svc_setup_socket created %p (inet %p)\n",
>>> svsk, svsk->sk_sk);
>>>
>>>
>
> --
> Chuck Lever
> chuck[dot]lever[at]oracle[dot]com
>
>
>
next prev parent reply other threads:[~2008-08-14 20:38 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-13 22:39 [PATCH 0/8] Support rpcbind v4 in kernel's RPC server Chuck Lever
[not found] ` <20080813223653.13068.9467.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-08-13 22:39 ` [PATCH 1/8] NFS: nfs_parsed_mount_options can use unsigned int Chuck Lever
[not found] ` <20080813223937.13068.47032.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-09-23 19:42 ` Trond Myklebust
2008-08-13 22:39 ` [PATCH 2/8] SUNRPC: Add address family field to svc_serv data structure Chuck Lever
2008-08-13 22:39 ` [PATCH 3/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets Chuck Lever
[not found] ` <20080813223953.13068.97829.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-08-14 20:05 ` J. Bruce Fields
2008-08-14 20:34 ` Chuck Lever
2008-08-14 20:38 ` J. Bruce Fields [this message]
2008-08-14 20:45 ` Chuck Lever
2008-08-20 19:31 ` J. Bruce Fields
2008-08-21 12:11 ` Le Rouzic
2008-08-21 14:41 ` J. Bruce Fields
2008-08-21 15:32 ` Le Rouzic
2008-08-21 16:20 ` Chuck Lever
[not found] ` <76bd70e30808210920y3db1b07cyccbe40e1b4582c12-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-21 21:26 ` J. Bruce Fields
2008-08-13 22:40 ` [PATCH 4/8] SUNRPC: Use proper INADDR_ANY when setting up RPC services on IPv6 Chuck Lever
2008-08-13 22:40 ` [PATCH 5/8] SUNRPC: Split portmap unregister API into separate function Chuck Lever
2008-08-13 22:40 ` [PATCH 6/8] SUNRPC: Refactor svc_register() Chuck Lever
[not found] ` <20080813224016.13068.29786.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-08-14 20:36 ` J. Bruce Fields
2008-08-14 21:11 ` Chuck Lever
2008-08-13 22:40 ` [PATCH 7/8] SUNRPC: Use new rpcb_v4_register() interface in svc_register() Chuck Lever
2008-08-13 22:40 ` [PATCH 8/8] SUNRPC: Add kernel build option to disable server-side use of rpcbind v3/v4 Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080814203833.GK23859@fieldses.org \
--to=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@fys.uio.no \
--cc=trond.myklebust@netapp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox