From: Peter Staubach <staubach@redhat.com>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: trond.myklebust@fys.uio.no,
aurelien.charbon-Z51IpKcfGtLk1uMJSBkQmQ@public.gmane.org,
linux-nfs@vger.kernel.org
Subject: Re: [PATCH 01/27] SUNRPC: rpc_create() default hostname should support AF_INET6 addresses
Date: Mon, 10 Dec 2007 15:23:48 -0500 [thread overview]
Message-ID: <475DA054.7010002@redhat.com> (raw)
In-Reply-To: <20071210195623.2823.13011.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
Chuck Lever wrote:
> If the ULP doesn't pass a hostname string to rpc_create(), it manufactures
> one based on the passed-in address. Be smart enough to handle an AF_INET6
> address properly in this case.
>
> Move the default servername logic before the xprt_create_transport() call
> to simplify error handling in rpc_create().
>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>
> net/sunrpc/clnt.c | 32 +++++++++++++++++++++++++++-----
> 1 files changed, 27 insertions(+), 5 deletions(-)
>
> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
> index 76be83e..c297161 100644
> --- a/net/sunrpc/clnt.c
> +++ b/net/sunrpc/clnt.c
> @@ -30,6 +30,7 @@
> #include <linux/smp_lock.h>
> #include <linux/utsname.h>
> #include <linux/workqueue.h>
> +#include <linux/in6.h>
>
> #include <linux/sunrpc/clnt.h>
> #include <linux/sunrpc/rpc_pipe_fs.h>
> @@ -247,7 +248,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
> .addrlen = args->addrsize,
> .timeout = args->timeout
> };
> - char servername[20];
> + char servername[48];
>
>
Just out of curiosity, how or why was 48 chosen?
Thanx...
ps
> xprt = xprt_create_transport(&xprtargs);
> if (IS_ERR(xprt))
> @@ -258,13 +259,34 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
> * up a string representation of the passed-in address.
> */
> if (args->servername == NULL) {
> - struct sockaddr_in *addr =
> - (struct sockaddr_in *) args->address;
> - snprintf(servername, sizeof(servername), NIPQUAD_FMT,
> - NIPQUAD(addr->sin_addr.s_addr));
> + servername[0] = '\0';
> + switch (args->address->sa_family) {
> + case AF_INET: {
> + struct sockaddr_in *sin =
> + (struct sockaddr_in *)args->address;
> + snprintf(servername, sizeof(servername), NIPQUAD_FMT,
> + NIPQUAD(sin->sin_addr.s_addr));
> + break;
> + }
> + case AF_INET6: {
> + struct sockaddr_in6 *sin =
> + (struct sockaddr_in6 *)args->address;
> + snprintf(servername, sizeof(servername), NIP6_FMT,
> + NIP6(sin->sin6_addr));
> + break;
> + }
> + default:
> + /* caller wants default server name, but
> + * address family isn't recognized. */
> + return ERR_PTR(-EINVAL);
> + }
> args->servername = servername;
> }
>
> + xprt = xprt_create_transport(&xprtargs);
> + if (IS_ERR(xprt))
> + return (struct rpc_clnt *)xprt;
> +
> /*
> * By default, kernel RPC client connects from a reserved port.
> * CAP_NET_BIND_SERVICE will not be set for unprivileged requesters,
>
> -
> 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:[~2007-12-10 20:24 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-10 19:56 [PATCH 00/27] IPv6 infrastructure for NFS client Chuck Lever
[not found] ` <20071210195106.2823.43884.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2007-12-10 19:56 ` [PATCH 01/27] SUNRPC: rpc_create() default hostname should support AF_INET6 addresses Chuck Lever
[not found] ` <20071210195623.2823.13011.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2007-12-10 20:23 ` Peter Staubach [this message]
2007-12-10 20:37 ` Chuck Lever
2007-12-10 20:55 ` Peter Staubach
2007-12-10 19:56 ` [PATCH 02/27] SUNRPC: Fix socket address handling in rpcb_clnt Chuck Lever
2007-12-10 19:56 ` [PATCH 03/27] SUNRPC: RPC version numbers are u32 Chuck Lever
2007-12-10 19:56 ` [PATCH 04/27] SUNRPC: Move universal address definitions to global header Chuck Lever
2007-12-10 19:56 ` [PATCH 05/27] NFS: Ensure NFSv4 SETCLIENTID send buffer is large enough Chuck Lever
2007-12-10 19:57 ` [PATCH 06/27] NFS: Increase size of cl_ipaddr field to hold IPv6 addresses Chuck Lever
2007-12-10 19:57 ` [PATCH 07/27] NFS: Enable NFS client to generate CLIENTID strings with " Chuck Lever
2007-12-10 19:57 ` [PATCH 08/27] NFS: eliminate NIPQUAD(clp->cl_addr.sin_addr) Chuck Lever
2007-12-10 19:57 ` [PATCH 09/27] NFS: Move dprintks from callback.c to callback_proc.c Chuck Lever
2007-12-10 19:57 ` [PATCH 10/27] NFS: Address a couple of nits in nfs_follow_referral() Chuck Lever
2007-12-10 19:57 ` [PATCH 11/27] NFS: Add support for AF_INET6 addresses in nfs_compare_super() Chuck Lever
2007-12-10 19:57 ` [PATCH 12/27] NFS: Verify IPv6 addresses properly Chuck Lever
2007-12-10 19:57 ` [PATCH 13/27] NFS: Make setting a port number agostic Chuck Lever
2007-12-10 19:58 ` [PATCH 14/27] NFS: Set default port for NFSv4, with support for AF_INET6 Chuck Lever
2007-12-10 19:58 ` [PATCH 15/27] NFS: Add support for AF_INET6 addresses in __nfs_find_client() Chuck Lever
2007-12-10 19:58 ` [PATCH 16/27] NFS: Expand server address storage in nfs_client struct Chuck Lever
2007-12-10 19:58 ` [PATCH 17/27] NFS: Change cb_getattrargs to pass "struct sockaddr *" instead of sockaddr_in Chuck Lever
2007-12-10 19:58 ` [PATCH 18/27] NFS: Change cb_recallargs " Chuck Lever
2007-12-10 19:58 ` [PATCH 19/27] NFS: Make nfs_alloc_client() take (sockaddr, len) " Chuck Lever
2007-12-10 19:58 ` [PATCH 20/27] NFS: Change nfs_find_client() to take "struct sockaddr *" Chuck Lever
2007-12-10 19:58 ` [PATCH 21/27] NFS: Change nfs_get_client() to take sockaddr * Chuck Lever
2007-12-10 19:58 ` [PATCH 22/27] NFS: Change nfs4_set_client() to accept struct " Chuck Lever
2007-12-10 19:59 ` [PATCH 23/27] NFS: Adjust nfs_clone_mount structure to store "struct sockaddr *" Chuck Lever
2007-12-10 19:59 ` [PATCH 24/27] NFS: Remove the NIPQUAD from nfs_try_mount Chuck Lever
2007-12-10 19:59 ` [PATCH 25/27] NFS: Refactor mount option address parsing into separate function Chuck Lever
2007-12-10 19:59 ` [PATCH 26/27] NFS: Support non-IPv4 addresses in nfs_parsed_mount_data Chuck Lever
2007-12-10 19:59 ` [PATCH 27/27] NFS: Pull covers off IPv6 address parsing 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=475DA054.7010002@redhat.com \
--to=staubach@redhat.com \
--cc=aurelien.charbon-Z51IpKcfGtLk1uMJSBkQmQ@public.gmane.org \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@fys.uio.no \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.