Re: [PATCH] SUNRPC: @clnt specifies auth flavor of RPC ping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2023-05-22 at 22:37 -0400, Chuck Lever wrote:
> On Mon, May 22, 2023 at 05:21:22PM -0400, Chuck Lever wrote:
> > From: Chuck Lever <chuck.lever@xxxxxxxxxx>
> > 
> > When connecting, we don't want to send both a NULL ping and an
> > RPC_AUTH_TLS probe, because, except for the detection of RPC-with-
> > TLS support, both serve effectively the same purpose.
> > 
> > Modify rpc_ping() so it can send a TLS probe when @clnt's flavor
> > is RPC_AUTH_TLS. All other callers continue to use AUTH_NONE.
> > 
> > Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
> > ---
> >  net/sunrpc/clnt.c |   14 +++++++++++++-
> >  1 file changed, 13 insertions(+), 1 deletion(-)
> > 
> > Does it help to replace 4/12 with this?  Compile-tested only.
> > 
> > 
> > diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
> > index 4cdb539b5854..274ad74cb2bd 100644
> > --- a/net/sunrpc/clnt.c
> > +++ b/net/sunrpc/clnt.c
> > @@ -2826,10 +2826,22 @@ EXPORT_SYMBOL_GPL(rpc_call_null);
> >  
> >  static int rpc_ping(struct rpc_clnt *clnt)
> >  {
> > +       struct rpc_message msg = {
> > +               .rpc_proc = &rpcproc_null,
> > +       };
> > +       struct rpc_task_setup task_setup_data = {
> > +               .rpc_client = clnt,
> > +               .rpc_message = &msg,
> > +               .callback_ops = &rpc_null_ops,
> > +               .flags = RPC_TASK_SOFT | RPC_TASK_SOFTCONN,
> > +       };
> >         struct rpc_task *task;
> >         int status;
> >  
> > -       task = rpc_call_null_helper(clnt, NULL, NULL, 0, NULL,
> > NULL);
> > +       if (clnt->cl_auth->au_flavor != RPC_AUTH_TLS)
> > +               flags |= RPC_TASK_NULLCREDS;
> 
> Obviously this needs to be:
> 
>                 task_setup_data.flags |= RPC_TASK_NULLCREDS;
> 
> This has been fixed in the topic-rpc-with-tls-upcall branch.

rpc_ping() should not need to know about the existence of AUTH_TLS.

Let's rather add in a struct rpc_authops callback connect_ping() (?)
that knows how to call rpc_ping() with the appropriate creds. For the
AUTH types other than AUTH_TLS, that will be a generic call with the
AUTH_NULL cred.

Then let's get rid of the RPC_TASK_NULLCREDS wart altogether.

> 
> > +
> > +       task = rpc_run_task(&task_setup_data);
> >         if (IS_ERR(task))
> >                 return PTR_ERR(task);
> >         status = task->tk_status;
> > 
> > 

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@xxxxxxxxxxxxxxx






[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux