All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <chuck.lever@oracle.com>, linux-nfs@vger.kernel.org
Cc: trondmy@hammerspace.com
Subject: Re: [PATCH v2 05/15] SUNRPC: Plumb an API for setting transport layer security
Date: Mon, 18 Jul 2022 15:46:30 -0400	[thread overview]
Message-ID: <bd35c69731c9d658b4c7eea54106e2ba8dfdb513.camel@kernel.org> (raw)
In-Reply-To: <165452706106.1496.9556038561796216812.stgit@oracle-102.nfsv4.dev>

On Mon, 2022-06-06 at 10:51 -0400, Chuck Lever wrote:
> Add an initial set of policies along with fields for upper layers to
> pass the requested policy down to the transport layer.
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  include/linux/sunrpc/clnt.h |    9 +++++++++
>  include/linux/sunrpc/xprt.h |    2 ++
>  net/sunrpc/clnt.c           |    4 ++++
>  3 files changed, 15 insertions(+)
> 
> diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
> index cbdd20dc84b7..85c2f810d4bb 100644
> --- a/include/linux/sunrpc/clnt.h
> +++ b/include/linux/sunrpc/clnt.h
> @@ -58,6 +58,7 @@ struct rpc_clnt {
>  				cl_noretranstimeo: 1,/* No retransmit timeouts */
>  				cl_autobind : 1,/* use getport() */
>  				cl_chatty   : 1;/* be verbose */
> +	unsigned int		cl_xprtsec;	/* transport security policy */
>  
>  	struct rpc_rtt *	cl_rtt;		/* RTO estimator data */
>  	const struct rpc_timeout *cl_timeout;	/* Timeout strategy */
> @@ -139,6 +140,7 @@ struct rpc_create_args {
>  	struct svc_xprt		*bc_xprt;	/* NFSv4.1 backchannel */
>  	const struct cred	*cred;
>  	unsigned int		max_connect;
> +	unsigned int		xprtsec;
>  };
>  
>  struct rpc_add_xprt_test {
> @@ -162,6 +164,13 @@ struct rpc_add_xprt_test {
>  #define RPC_CLNT_CREATE_REUSEPORT	(1UL << 11)
>  #define RPC_CLNT_CREATE_CONNECTED	(1UL << 12)
>  
> +/* RPC transport layer security policies */
> +enum {
> +	RPC_XPRTSEC_NONE = 0,
> +	RPC_XPRTSEC_TLS_X509,
> +	RPC_XPRTSEC_TLS_PSK,
> +};
> +
>  struct rpc_clnt *rpc_create(struct rpc_create_args *args);
>  struct rpc_clnt	*rpc_bind_new_program(struct rpc_clnt *,
>  				const struct rpc_program *, u32);
> diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
> index 522bbf937957..d091ad2b7340 100644
> --- a/include/linux/sunrpc/xprt.h
> +++ b/include/linux/sunrpc/xprt.h
> @@ -228,6 +228,7 @@ struct rpc_xprt {
>  	 */
>  	unsigned long		bind_timeout,
>  				reestablish_timeout;
> +	unsigned int		xprtsec;
>  	unsigned int		connect_cookie;	/* A cookie that gets bumped
>  						   every time the transport
>  						   is reconnected */
> @@ -332,6 +333,7 @@ struct xprt_create {
>  	struct svc_xprt		*bc_xprt;	/* NFSv4.1 backchannel */
>  	struct rpc_xprt_switch	*bc_xps;
>  	unsigned int		flags;
> +	unsigned int		xprtsec;
>  };
>  
>  struct xprt_class {
> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
> index 8fd45de66882..6dcc88d45f5d 100644
> --- a/net/sunrpc/clnt.c
> +++ b/net/sunrpc/clnt.c
> @@ -385,6 +385,7 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args,
>  	if (!clnt)
>  		goto out_err;
>  	clnt->cl_parent = parent ? : clnt;
> +	clnt->cl_xprtsec = args->xprtsec;
>  
>  	err = rpc_alloc_clid(clnt);
>  	if (err)
> @@ -532,6 +533,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
>  		.addrlen = args->addrsize,
>  		.servername = args->servername,
>  		.bc_xprt = args->bc_xprt,
> +		.xprtsec = args->xprtsec,
>  	};
>  	char servername[48];
>  	struct rpc_clnt *clnt;
> @@ -726,6 +728,7 @@ int rpc_switch_client_transport(struct rpc_clnt *clnt,
>  	struct rpc_clnt *parent;
>  	int err;
>  
> +	args->xprtsec = clnt->cl_xprtsec;
>  	xprt = xprt_create_transport(args);
>  	if (IS_ERR(xprt))
>  		return PTR_ERR(xprt);
> @@ -2973,6 +2976,7 @@ int rpc_clnt_add_xprt(struct rpc_clnt *clnt,
>  
>  	if (!xprtargs->ident)
>  		xprtargs->ident = ident;
> +	xprtargs->xprtsec = clnt->cl_xprtsec;
>  	xprt = xprt_create_transport(xprtargs);
>  	if (IS_ERR(xprt)) {
>  		ret = PTR_ERR(xprt);
> 
> 

Reviewed-by: Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2022-07-18 19:46 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-06 14:50 [PATCH v2 00/15] RPC-with-TLS client side Chuck Lever
2022-06-06 14:50 ` [PATCH v2 01/15] SUNRPC: Fail faster on bad verifier Chuck Lever
2022-07-06 17:12   ` Jeff Layton
2022-06-06 14:50 ` [PATCH v2 02/15] SUNRPC: Widen rpc_task::tk_flags Chuck Lever
2022-07-06 17:14   ` Jeff Layton
2022-06-06 14:50 ` [PATCH v2 03/15] SUNRPC: Replace dprintk() call site in xs_data_ready Chuck Lever
2022-07-06 17:19   ` Jeff Layton
2022-07-06 18:10     ` Chuck Lever III
2022-06-06 14:50 ` [PATCH v2 04/15] NFS: Replace fs_context-related dprintk() call sites with tracepoints Chuck Lever
2022-07-06 18:44   ` Jeff Layton
2022-06-06 14:51 ` [PATCH v2 05/15] SUNRPC: Plumb an API for setting transport layer security Chuck Lever
2022-07-18 19:46   ` Jeff Layton [this message]
2022-06-06 14:51 ` [PATCH v2 06/15] SUNRPC: Trace the rpc_create_args Chuck Lever
2022-07-06 18:57   ` Jeff Layton
2022-07-06 19:04     ` Chuck Lever III
2022-06-06 14:51 ` [PATCH v2 07/15] SUNRPC: Refactor rpc_call_null_helper() Chuck Lever
2022-07-18 19:44   ` Jeff Layton
2022-06-06 14:51 ` [PATCH v2 08/15] SUNRPC: Add RPC client support for the RPC_AUTH_TLS auth flavor Chuck Lever
2022-06-06 14:51 ` [PATCH v2 09/15] SUNRPC: Ignore data_ready callbacks during TLS handshakes Chuck Lever
2022-06-06 14:51 ` [PATCH v2 10/15] SUNRPC: Capture cmsg metadata on client-side receive Chuck Lever
2022-07-18 19:53   ` Jeff Layton
2022-07-19 21:43     ` Chuck Lever III
2022-06-06 14:51 ` [PATCH v2 11/15] SUNRPC: Add a connect worker function for TLS Chuck Lever
2022-06-06 14:51 ` [PATCH v2 12/15] SUNRPC: Add RPC-with-TLS support to xprtsock.c Chuck Lever
2022-07-12 17:00   ` Benjamin Coddington
2022-07-18 20:10   ` Jeff Layton
2022-07-19 21:31     ` Chuck Lever III
2022-06-06 14:51 ` [PATCH v2 13/15] SUNRPC: Add RPC-with-TLS tracepoints Chuck Lever
2022-06-06 14:51 ` [PATCH v2 14/15] NFS: Have struct nfs_client carry a TLS policy field Chuck Lever
2022-06-06 14:52 ` [PATCH v2 15/15] NFS: Add an "xprtsec=" NFS mount option Chuck Lever
2022-07-18 20:24   ` Jeff Layton
2022-07-18 20:35     ` Chuck Lever III
2022-07-12 12:36 ` [PATCH v2 00/15] RPC-with-TLS client side Jeff Layton
2022-07-12 13:48   ` Chuck Lever III
2022-07-13  0:51     ` Rick Macklem
2022-07-13 13:22       ` Benjamin Coddington
2022-07-13 13:32         ` Chuck Lever III
2022-07-14 16:24     ` Benjamin Coddington
2022-07-18 20:25 ` Jeff Layton

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=bd35c69731c9d658b4c7eea54106e2ba8dfdb513.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trondmy@hammerspace.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 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.