Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sunrpc: Add a sysfs attr for xprtsec

This allows the admin to check the TLS configuration for each xprt.

Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Link: https://lore.kernel.org/r/20250207204225.594002-3-anna@kernel.org
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>

authored by

Anna Schumaker and committed by
Trond Myklebust
41cb320b e171b965

+29
+29
net/sunrpc/sysfs.c
··· 129 129 return ret; 130 130 } 131 131 132 + static const char *xprtsec_strings[] = { 133 + [RPC_XPRTSEC_NONE] = "none", 134 + [RPC_XPRTSEC_TLS_ANON] = "tls-anon", 135 + [RPC_XPRTSEC_TLS_X509] = "tls-x509", 136 + }; 137 + 138 + static ssize_t rpc_sysfs_xprt_xprtsec_show(struct kobject *kobj, 139 + struct kobj_attribute *attr, 140 + char *buf) 141 + { 142 + struct rpc_xprt *xprt = rpc_sysfs_xprt_kobj_get_xprt(kobj); 143 + ssize_t ret; 144 + 145 + if (!xprt) { 146 + ret = sprintf(buf, "<closed>\n"); 147 + goto out; 148 + } 149 + 150 + ret = sprintf(buf, "%s\n", xprtsec_strings[xprt->xprtsec.policy]); 151 + xprt_put(xprt); 152 + out: 153 + return ret; 154 + 155 + } 156 + 132 157 static ssize_t rpc_sysfs_xprt_info_show(struct kobject *kobj, 133 158 struct kobj_attribute *attr, char *buf) 134 159 { ··· 429 404 static struct kobj_attribute rpc_sysfs_xprt_srcaddr = __ATTR(srcaddr, 430 405 0644, rpc_sysfs_xprt_srcaddr_show, NULL); 431 406 407 + static struct kobj_attribute rpc_sysfs_xprt_xprtsec = __ATTR(xprtsec, 408 + 0644, rpc_sysfs_xprt_xprtsec_show, NULL); 409 + 432 410 static struct kobj_attribute rpc_sysfs_xprt_info = __ATTR(xprt_info, 433 411 0444, rpc_sysfs_xprt_info_show, NULL); 434 412 ··· 441 413 static struct attribute *rpc_sysfs_xprt_attrs[] = { 442 414 &rpc_sysfs_xprt_dstaddr.attr, 443 415 &rpc_sysfs_xprt_srcaddr.attr, 416 + &rpc_sysfs_xprt_xprtsec.attr, 444 417 &rpc_sysfs_xprt_info.attr, 445 418 &rpc_sysfs_xprt_change_state.attr, 446 419 NULL,