aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2007-08-06 11:57:02 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-10-09 17:15:52 -0400
commitfbfe3cc677c1a62ca6472abf24d03d4bf9f03a55 (patch)
tree65c5f2138ba7d8ce51c4fa2f983c25827502416b /net/sunrpc/xprtsock.c
parent0c43b3d81cca46ab2469f8802f8bd68b49f1b2a5 (diff)
SUNRPC: Add hex-formatted address support to rpc_peeraddr2str()
Add support for the NFS client's need to export volume information with IP addresses formatted in hex instead of decimal. This isn't used yet, but subsequent patches (not in this series) will change the NFS client to use this functionality. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index b3f40b8dbcba..8a684d873111 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -296,6 +296,20 @@ static void xs_format_peer_addresses(struct rpc_xprt *xprt)
296 xprt->prot == IPPROTO_UDP ? "udp" : "tcp"); 296 xprt->prot == IPPROTO_UDP ? "udp" : "tcp");
297 } 297 }
298 xprt->address_strings[RPC_DISPLAY_ALL] = buf; 298 xprt->address_strings[RPC_DISPLAY_ALL] = buf;
299
300 buf = kzalloc(10, GFP_KERNEL);
301 if (buf) {
302 snprintf(buf, 10, "%02x%02x%02x%02x",
303 NIPQUAD(addr->sin_addr.s_addr));
304 }
305 xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = buf;
306
307 buf = kzalloc(8, GFP_KERNEL);
308 if (buf) {
309 snprintf(buf, 8, "%4hx",
310 ntohs(addr->sin_port));
311 }
312 xprt->address_strings[RPC_DISPLAY_HEX_PORT] = buf;
299} 313}
300 314
301static void xs_free_peer_addresses(struct rpc_xprt *xprt) 315static void xs_free_peer_addresses(struct rpc_xprt *xprt)