aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sunrpc/clnt.h1
-rw-r--r--net/sunrpc/clnt.c21
2 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 2e68ac0aa022..65196b03f0ab 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -123,6 +123,7 @@ void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
123size_t rpc_max_payload(struct rpc_clnt *); 123size_t rpc_max_payload(struct rpc_clnt *);
124void rpc_force_rebind(struct rpc_clnt *); 124void rpc_force_rebind(struct rpc_clnt *);
125int rpc_ping(struct rpc_clnt *clnt, int flags); 125int rpc_ping(struct rpc_clnt *clnt, int flags);
126size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
126 127
127/* 128/*
128 * Helper function for NFSroot support 129 * Helper function for NFSroot support
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index d003c2f5688f..94768cf5fd5b 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -533,6 +533,27 @@ rpc_call_setup(struct rpc_task *task, struct rpc_message *msg, int flags)
533 task->tk_action = rpc_exit_task; 533 task->tk_action = rpc_exit_task;
534} 534}
535 535
536/**
537 * rpc_peeraddr - extract remote peer address from clnt's xprt
538 * @clnt: RPC client structure
539 * @buf: target buffer
540 * @size: length of target buffer
541 *
542 * Returns the number of bytes that are actually in the stored address.
543 */
544size_t rpc_peeraddr(struct rpc_clnt *clnt, struct sockaddr *buf, size_t bufsize)
545{
546 size_t bytes;
547 struct rpc_xprt *xprt = clnt->cl_xprt;
548
549 bytes = sizeof(xprt->addr);
550 if (bytes > bufsize)
551 bytes = bufsize;
552 memcpy(buf, &clnt->cl_xprt->addr, bytes);
553 return sizeof(xprt->addr);
554}
555EXPORT_SYMBOL(rpc_peeraddr);
556
536void 557void
537rpc_setbufsize(struct rpc_clnt *clnt, unsigned int sndsize, unsigned int rcvsize) 558rpc_setbufsize(struct rpc_clnt *clnt, unsigned int sndsize, unsigned int rcvsize)
538{ 559{