@@ -129,6 +129,31 @@ static ssize_t rpc_sysfs_xprt_srcaddr_show(struct kobject *kobj,
129129 return ret ;
130130}
131131
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+
132157static ssize_t rpc_sysfs_xprt_info_show (struct kobject * kobj ,
133158 struct kobj_attribute * attr , char * buf )
134159{
@@ -404,6 +429,9 @@ static struct kobj_attribute rpc_sysfs_xprt_dstaddr = __ATTR(dstaddr,
404429static struct kobj_attribute rpc_sysfs_xprt_srcaddr = __ATTR (srcaddr ,
405430 0644 , rpc_sysfs_xprt_srcaddr_show , NULL );
406431
432+ static struct kobj_attribute rpc_sysfs_xprt_xprtsec = __ATTR (xprtsec ,
433+ 0644 , rpc_sysfs_xprt_xprtsec_show , NULL );
434+
407435static struct kobj_attribute rpc_sysfs_xprt_info = __ATTR (xprt_info ,
408436 0444 , rpc_sysfs_xprt_info_show , NULL );
409437
@@ -413,6 +441,7 @@ static struct kobj_attribute rpc_sysfs_xprt_change_state = __ATTR(xprt_state,
413441static struct attribute * rpc_sysfs_xprt_attrs [] = {
414442 & rpc_sysfs_xprt_dstaddr .attr ,
415443 & rpc_sysfs_xprt_srcaddr .attr ,
444+ & rpc_sysfs_xprt_xprtsec .attr ,
416445 & rpc_sysfs_xprt_info .attr ,
417446 & rpc_sysfs_xprt_change_state .attr ,
418447 NULL ,
0 commit comments