aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 45fac56b40f9..23e5865d984c 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -312,6 +312,58 @@ static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt)
312 xprt->address_strings[RPC_DISPLAY_HEX_PORT] = buf; 312 xprt->address_strings[RPC_DISPLAY_HEX_PORT] = buf;
313} 313}
314 314
315static void xs_format_ipv6_peer_addresses(struct rpc_xprt *xprt)
316{
317 struct sockaddr_in6 *addr = (struct sockaddr_in6 *) &xprt->addr;
318 char *buf;
319
320 buf = kzalloc(40, GFP_KERNEL);
321 if (buf) {
322 snprintf(buf, 40, NIP6_FMT,
323 NIP6(addr->sin6_addr));
324 }
325 xprt->address_strings[RPC_DISPLAY_ADDR] = buf;
326
327 buf = kzalloc(8, GFP_KERNEL);
328 if (buf) {
329 snprintf(buf, 8, "%u",
330 ntohs(addr->sin6_port));
331 }
332 xprt->address_strings[RPC_DISPLAY_PORT] = buf;
333
334 buf = kzalloc(8, GFP_KERNEL);
335 if (buf) {
336 if (xprt->prot == IPPROTO_UDP)
337 snprintf(buf, 8, "udp");
338 else
339 snprintf(buf, 8, "tcp");
340 }
341 xprt->address_strings[RPC_DISPLAY_PROTO] = buf;
342
343 buf = kzalloc(64, GFP_KERNEL);
344 if (buf) {
345 snprintf(buf, 64, "addr="NIP6_FMT" port=%u proto=%s",
346 NIP6(addr->sin6_addr),
347 ntohs(addr->sin6_port),
348 xprt->prot == IPPROTO_UDP ? "udp" : "tcp");
349 }
350 xprt->address_strings[RPC_DISPLAY_ALL] = buf;
351
352 buf = kzalloc(36, GFP_KERNEL);
353 if (buf) {
354 snprintf(buf, 36, NIP6_SEQFMT,
355 NIP6(addr->sin6_addr));
356 }
357 xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = buf;
358
359 buf = kzalloc(8, GFP_KERNEL);
360 if (buf) {
361 snprintf(buf, 8, "%4hx",
362 ntohs(addr->sin6_port));
363 }
364 xprt->address_strings[RPC_DISPLAY_HEX_PORT] = buf;
365}
366
315static void xs_free_peer_addresses(struct rpc_xprt *xprt) 367static void xs_free_peer_addresses(struct rpc_xprt *xprt)
316{ 368{
317 int i; 369 int i;