@@ -129,6 +129,31 @@ static ssize_t rpc_sysfs_xprt_srcaddr_show(struct kobject *kobj,
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
{
@@ -404,6 +429,9 @@ static struct kobj_attribute rpc_sysfs_xprt_dstaddr = __ATTR(dstaddr,
404
429
static struct kobj_attribute rpc_sysfs_xprt_srcaddr = __ATTR (srcaddr ,
405
430
0644 , rpc_sysfs_xprt_srcaddr_show , NULL );
406
431
432
+ static struct kobj_attribute rpc_sysfs_xprt_xprtsec = __ATTR (xprtsec ,
433
+ 0644 , rpc_sysfs_xprt_xprtsec_show , NULL );
434
+
407
435
static struct kobj_attribute rpc_sysfs_xprt_info = __ATTR (xprt_info ,
408
436
0444 , rpc_sysfs_xprt_info_show , NULL );
409
437
@@ -413,6 +441,7 @@ static struct kobj_attribute rpc_sysfs_xprt_change_state = __ATTR(xprt_state,
413
441
static struct attribute * rpc_sysfs_xprt_attrs [] = {
414
442
& rpc_sysfs_xprt_dstaddr .attr ,
415
443
& rpc_sysfs_xprt_srcaddr .attr ,
444
+ & rpc_sysfs_xprt_xprtsec .attr ,
416
445
& rpc_sysfs_xprt_info .attr ,
417
446
& rpc_sysfs_xprt_change_state .attr ,
418
447
NULL ,
0 commit comments