summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2025-01-22 18:18:12 +0300
committerAnna Schumaker <anna.schumaker@oracle.com>2025-01-22 23:53:31 +0300
commit918b8e3b3ffda3602a0179b7b9b904f89561c03e (patch)
tree37c1a6996dc6e099c17007ba3a6f3ed4766d2b9f /net
parenteb3fabde15bccdf34f1c9b35a83aa4c0dacbb4ca (diff)
downloadlinux-918b8e3b3ffda3602a0179b7b9b904f89561c03e.tar.xz
sunrpc: add netns inum and srcaddr to debugfs rpc_xprt info
The output format should provide a value that matches the one in the /proc/<pid>/ns/net symlink. This makes it simpler to match the rpc_xprt and rpc_clnt to a particular container. Also, when the xprt defines the get_srcaddr operation, use that to display the source address as well. Signed-off-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/debugfs.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c
index e4a4c547c70c..32417db340de 100644
--- a/net/sunrpc/debugfs.c
+++ b/net/sunrpc/debugfs.c
@@ -182,6 +182,18 @@ xprt_info_show(struct seq_file *f, void *v)
seq_printf(f, "addr: %s\n", xprt->address_strings[RPC_DISPLAY_ADDR]);
seq_printf(f, "port: %s\n", xprt->address_strings[RPC_DISPLAY_PORT]);
seq_printf(f, "state: 0x%lx\n", xprt->state);
+ seq_printf(f, "netns: %u\n", xprt->xprt_net->ns.inum);
+
+ if (xprt->ops->get_srcaddr) {
+ int ret, buflen;
+ char buf[INET6_ADDRSTRLEN];
+
+ buflen = ARRAY_SIZE(buf);
+ ret = xprt->ops->get_srcaddr(xprt, buf, buflen);
+ if (ret < 0)
+ ret = sprintf(buf, "<closed>");
+ seq_printf(f, "saddr: %.*s\n", ret, buf);
+ }
return 0;
}