Thread (23 messages) 23 messages, 5 authors, 2023-05-23
STALE1121d

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

From: Chuck Lever <cel@kernel.org>
Date: 2023-05-22 21:21:38
Subsystem: kernel nfsd, sunrpc, and lockd servers, networking [general], nfs, sunrpc, and lockd clients, the rest · Maintainers: Chuck Lever, Jeff Layton, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Trond Myklebust, Anna Schumaker, Linus Torvalds

From: Chuck Lever <chuck.lever@oracle.com>

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@oracle.com>
---
 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;
+
+	task = rpc_run_task(&task_setup_data);
 	if (IS_ERR(task))
 		return PTR_ERR(task);
 	status = task->tk_status;

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help