From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: trond.myklebust@netapp.com, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 5/8] SUNRPC: Use new rpcb_v4_register() interface in svc_register()
Date: Fri, 18 Jul 2008 19:40:26 -0400 [thread overview]
Message-ID: <20080718234026.GD15850@fieldses.org> (raw)
In-Reply-To: <20080630224601.24887.59241.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
On Mon, Jun 30, 2008 at 06:46:01PM -0400, Chuck Lever wrote:
> In order to advertise NFS-related services on IPv6 interfaces via
> rpcbind, the kernel RPC server implementation must use
> rpcb_v4_register() instead of rpcb_register().
>
> Legacy support (register using portmapper/rpcbindv2) is still available.
> The new rpcbind version is not used unless enabled via a CONFIG option.
So a kernel built with CONFIG_SUNRPC_REGISTER_V4 will no longer support
old userspace?
--b.
>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>
> net/sunrpc/svc.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 73 insertions(+), 0 deletions(-)
>
>
> diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
> index c31a1e4..13cca03 100644
> --- a/net/sunrpc/svc.c
> +++ b/net/sunrpc/svc.c
> @@ -749,6 +749,74 @@ svc_exit_thread(struct svc_rqst *rqstp)
> }
> EXPORT_SYMBOL(svc_exit_thread);
>
> +#ifdef CONFIG_SUNRPC_REGISTER_V4
> +/*
> + * Registering kernel RPC services with rpcbind version 2 will work
> + * over either IPv4 or IPv6, since the Linux kernel always registers
> + * services for the "any" address.
> + *
> + * However, the local rpcbind daemon listens on either only AF_INET
> + * or AF_INET6 (never both). When it listens on AF_INET6, an rpcbind
> + * version 2 registration will result in registering the service at
> + * IN6ADDR_ANY, even if the RPC service being registered is not
> + * IPv6-enabled.
> + *
> + * Rpcbind version 4 allows us to be a little more specific. Kernel
> + * RPC services that don't yet support AF_INET6 can register
> + * themselves as IPv4-only with the local rpcbind daemon, even if the
> + * daemon is listening only on AF_INET6.
> + *
> + * And, registering IPv6-enabled kernel RPC services via AF_INET6
> + * verifies that the local user space rpcbind daemon is properly
> + * configured to support remote AF_INET6 rpcbind requests.
> + *
> + * An AF_INET6 registration request will fail if the local rpcbind
> + * daemon is not set up to listen on AF_INET6. Likewise, we fail
> + * AF_INET6 registration requests if svc_register() is configured to
> + * support only rpcbind version 2.
> + */
> +static int __svc_register(const u32 program, const u32 version,
> + const sa_family_t family,
> + const unsigned short protocol,
> + const unsigned short port)
> +{
> + struct sockaddr_in sin = {
> + .sin_family = AF_INET,
> + .sin_addr.s_addr = htonl(INADDR_ANY),
> + .sin_port = htons(port),
> + };
> + struct sockaddr_in6 sin6 = {
> + .sin6_family = AF_INET6,
> + .sin6_addr = IN6ADDR_ANY_INIT,
> + .sin6_port = htons(port),
> + };
> + struct sockaddr *sap;
> + char *netid;
> + int error, result;
> +
> + switch (family) {
> + case AF_INET:
> + sap = (struct sockaddr *)&sin;
> + netid = RPCBIND_NETID_TCP;
> + if (protocol == IPPROTO_UDP)
> + netid = RPCBIND_NETID_UDP;
> + break;
> + case AF_INET6:
> + sap = (struct sockaddr *)&sin6;
> + netid = RPCBIND_NETID_TCP6;
> + if (protocol == IPPROTO_UDP)
> + netid = RPCBIND_NETID_UDP6;
> + break;
> + default:
> + return -EAFNOSUPPORT;
> + }
> +
> + error = rpcb_v4_register(program, version, sap, netid, &result);
> + if (!result)
> + error = -EACCES;
> + return error;
> +}
> +#else
> static int __svc_register(const u32 program, const u32 version,
> sa_family_t family,
> const unsigned short protocol,
> @@ -756,11 +824,15 @@ static int __svc_register(const u32 program, const u32 version,
> {
> int error, result;
>
> + if (family != AF_INET)
> + return -EAFNOSUPPORT;
> +
> error = rpcb_register(program, version, protocol, port, &result);
> if (!result)
> error = -EACCES;
> return error;
> }
> +#endif
>
> /**
> * svc_register - register an RPC service with the local portmapper
> @@ -768,6 +840,7 @@ static int __svc_register(const u32 program, const u32 version,
> * @protocol: transport protocol number to advertise
> * @port: port to advertise
> *
> + * Service is registered for any address in serv's address family
> */
> int svc_register(const struct svc_serv *serv, const unsigned short protocol,
> const unsigned short port)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-07-18 23:41 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-30 22:45 [PATCH 0/8] rpcbind v4 support in net/sunrpc/svc* Chuck Lever
[not found] ` <20080630224147.24887.18730.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-06-30 22:45 ` [PATCH 1/8] SUNRPC: Add address family field to svc_serv data structure Chuck Lever
[not found] ` <20080630224529.24887.47412.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-07-03 21:14 ` J. Bruce Fields
2008-07-04 13:45 ` Chuck Lever
2008-06-30 22:45 ` [PATCH 2/8] SUNRPC: Use proper INADDR_ANY when setting up RPC services on IPv6 Chuck Lever
2008-06-30 22:45 ` [PATCH 3/8] SUNRPC: Split portmap unregister API into separate function Chuck Lever
[not found] ` <20080630224545.24887.61618.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-07-18 23:21 ` J. Bruce Fields
2008-07-21 3:17 ` Chuck Lever
[not found] ` <76bd70e30807202017hec9d1der1bbbf5c5dcedac45-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-07-23 16:58 ` J. Bruce Fields
2008-06-30 22:45 ` [PATCH 4/8] SUNRPC: Clean up svc_register Chuck Lever
[not found] ` <20080630224553.24887.73617.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-07-18 23:29 ` J. Bruce Fields
2008-07-21 19:24 ` Chuck Lever
2008-06-30 22:46 ` [PATCH 5/8] SUNRPC: Use new rpcb_v4_register() interface in svc_register() Chuck Lever
[not found] ` <20080630224601.24887.59241.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-07-18 23:40 ` J. Bruce Fields [this message]
2008-07-21 19:26 ` Chuck Lever
2008-06-30 22:46 ` [PATCH 6/8] SUNRPC: Add kernel build option to disable server-side use of rpcbind v3/v4 Chuck Lever
[not found] ` <20080630224609.24887.20585.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-07-18 23:42 ` J. Bruce Fields
2008-07-21 19:30 ` Chuck Lever
[not found] ` <76bd70e30807211230y4b7c2b21qa89d8cca05e08dab-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-07-30 16:18 ` J. Bruce Fields
2008-06-30 22:46 ` [PATCH 7/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets Chuck Lever
[not found] ` <20080630224616.24887.13171.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-07-19 1:05 ` J. Bruce Fields
2008-07-21 19:32 ` Chuck Lever
2008-06-30 22:46 ` [PATCH 8/8] NFS: Enable NFSv4 callback server to listen on AF_INET6 sockets Chuck Lever
2008-07-19 1:07 ` [PATCH 0/8] rpcbind v4 support in net/sunrpc/svc* J. Bruce Fields
2008-07-20 21:17 ` J. Bruce Fields
2008-07-21 19:07 ` Chuck Lever
[not found] ` <76bd70e30807211207q4fc509e0h4a1a560fe8097de7-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-07-23 21:53 ` J. Bruce Fields
2008-07-23 22:47 ` Chuck Lever
[not found] ` <76bd70e30807231547j19e9fd8dv7a14c2795226dcd6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-07-23 23:05 ` Trond Myklebust
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=20080718234026.GD15850@fieldses.org \
--to=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--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