From: Christoph Hellwig Subject: Re: [PATCH 07/25] SUNRPC: create API for getting remote peer address Date: Wed, 9 Aug 2006 16:06:17 +0100 Message-ID: <20060809150617.GB9984@infradead.org> References: <20060809144716.3914.62804.stgit@picasso.dsl.sfldmi.ameritech.net> <20060809145906.3914.27977.stgit@picasso.dsl.sfldmi.ameritech.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: nfs@lists.sourceforge.net, trond.myklebust@fys.uio.no Return-path: Received: from sc8-sf-mx2-b.sourceforge.net ([10.3.1.92] helo=mail.sourceforge.net) by sc8-sf-list2-new.sourceforge.net with esmtp (Exim 4.43) id 1GApdV-000134-MG for nfs@lists.sourceforge.net; Wed, 09 Aug 2006 08:06:23 -0700 Received: from pentafluge.infradead.org ([213.146.154.40]) by mail.sourceforge.net with esmtps (TLSv1:AES256-SHA:256) (Exim 4.44) id 1GApdV-0006ca-9j for nfs@lists.sourceforge.net; Wed, 09 Aug 2006 08:06:22 -0700 To: Chuck Lever In-Reply-To: <20060809145906.3914.27977.stgit@picasso.dsl.sfldmi.ameritech.net> List-Id: "Discussion of NFS under Linux development, interoperability, and testing." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nfs-bounces@lists.sourceforge.net Errors-To: nfs-bounces@lists.sourceforge.net On Wed, Aug 09, 2006 at 10:59:06AM -0400, Chuck Lever wrote: > Provide an API for retrieving the remote peer address without allowing > direct access to the rpc_xprt struct. > > Test-plan: > Compile kernel with CONFIG_NFS enabled. > > Signed-off-by: Chuck Lever > --- > > include/linux/sunrpc/clnt.h | 1 + > net/sunrpc/clnt.c | 21 +++++++++++++++++++++ > 2 files changed, 22 insertions(+), 0 deletions(-) > > diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h > index 2e68ac0..65196b0 100644 > --- a/include/linux/sunrpc/clnt.h > +++ b/include/linux/sunrpc/clnt.h > @@ -123,6 +123,7 @@ void rpc_setbufsize(struct rpc_clnt *, > size_t rpc_max_payload(struct rpc_clnt *); > void rpc_force_rebind(struct rpc_clnt *); > int rpc_ping(struct rpc_clnt *clnt, int flags); > +size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); > > /* > * Helper function for NFSroot support > diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c > index bff350e..da377eb 100644 > --- a/net/sunrpc/clnt.c > +++ b/net/sunrpc/clnt.c > @@ -536,6 +536,27 @@ rpc_call_setup(struct rpc_task *task, st > task->tk_action = rpc_exit_task; > } > > +/** > + * rpc_peeraddr - extract remote peer address from clnt's xprt > + * @clnt: RPC client structure > + * @buf: target buffer > + * @size: length of target buffer > + * > + * Returns the number of bytes that are actually in the stored address. > + */ > +size_t rpc_peeraddr(struct rpc_clnt *clnt, struct sockaddr *buf, size_t bufsize) > +{ > + size_t bytes; > + struct rpc_xprt *xprt = clnt->cl_xprt; > + > + bytes = sizeof(xprt->addr); > + if (bytes > bufsize) > + bytes = bufsize; > + memcpy(buf, &clnt->cl_xprt->addr, bytes); > + return sizeof(xprt->addr); > +} > +EXPORT_SYMBOL(rpc_peeraddr); Shouldn't all these be _GPL exports? The transport switch is something internal to the NFS client that shouldn't be seen as public at all and could be changed at any time. ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ NFS maillist - NFS@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs