@@ -78,8 +78,8 @@ static struct opaque_auth rpctls_null_verf;
78
78
KRPC_VNET_DECLARE (uint64_t , svc_vc_tls_handshake_success );
79
79
KRPC_VNET_DECLARE (uint64_t , svc_vc_tls_handshake_failed );
80
80
81
- KRPC_VNET_DEFINE_STATIC ( CLIENT * , rpctls_connect_handle ) ;
82
- KRPC_VNET_DEFINE_STATIC ( CLIENT * , rpctls_server_handle ) ;
81
+ static CLIENT * rpctls_connect_handle ;
82
+ static CLIENT * rpctls_server_handle ;
83
83
84
84
struct upsock {
85
85
RB_ENTRY (upsock ) tree ;
@@ -127,28 +127,6 @@ rpctls_client_nl_create(const char *group, const rpcprog_t program,
127
127
return (cl );
128
128
}
129
129
130
- static void
131
- rpctls_vnetinit (const void * unused __unused )
132
- {
133
-
134
- KRPC_VNET (rpctls_connect_handle ) =
135
- rpctls_client_nl_create ("tlsclnt" , RPCTLSCD , RPCTLSCDVERS );
136
- KRPC_VNET (rpctls_server_handle ) =
137
- rpctls_client_nl_create ("tlsserv" , RPCTLSSD , RPCTLSSDVERS );
138
- }
139
- VNET_SYSINIT (rpctls_vnetinit , SI_SUB_VNET_DONE , SI_ORDER_ANY ,
140
- rpctls_vnetinit , NULL );
141
-
142
- static void
143
- rpctls_cleanup (void * unused __unused )
144
- {
145
-
146
- clnt_destroy (KRPC_VNET (rpctls_connect_handle ));
147
- clnt_destroy (KRPC_VNET (rpctls_server_handle ));
148
- }
149
- VNET_SYSUNINIT (rpctls_cleanup , SI_SUB_VNET_DONE , SI_ORDER_ANY ,
150
- rpctls_cleanup , NULL );
151
-
152
130
int
153
131
rpctls_init (void )
154
132
{
@@ -163,6 +141,10 @@ rpctls_init(void)
163
141
rpctls_null_verf .oa_flavor = AUTH_NULL ;
164
142
rpctls_null_verf .oa_base = RPCTLS_START_STRING ;
165
143
rpctls_null_verf .oa_length = strlen (RPCTLS_START_STRING );
144
+ rpctls_connect_handle = rpctls_client_nl_create ("tlsclnt" ,
145
+ RPCTLSCD , RPCTLSCDVERS );
146
+ rpctls_server_handle = rpctls_client_nl_create ("tlsserv" ,
147
+ RPCTLSSD , RPCTLSSDVERS );
166
148
return (0 );
167
149
}
168
150
@@ -271,7 +253,6 @@ rpctls_connect(CLIENT *newclient, char *certname, struct socket *so,
271
253
.cl = newclient ,
272
254
.server = false,
273
255
};
274
- CLIENT * cl = KRPC_VNET (rpctls_connect_handle );
275
256
276
257
/* First, do the AUTH_TLS NULL RPC. */
277
258
memset (& ext , 0 , sizeof (ext ));
@@ -298,7 +279,7 @@ rpctls_connect(CLIENT *newclient, char *certname, struct socket *so,
298
279
} else
299
280
arg .certname .certname_len = 0 ;
300
281
arg .socookie = (uint64_t )so ;
301
- stat = rpctlscd_connect_2 (& arg , & res , cl );
282
+ stat = rpctlscd_connect_2 (& arg , & res , rpctls_connect_handle );
302
283
if (stat == RPC_SUCCESS )
303
284
* reterr = res .reterr ;
304
285
else
@@ -323,11 +304,10 @@ rpctls_cl_handlerecord(void *socookie, uint32_t *reterr)
323
304
struct rpctlscd_handlerecord_arg arg ;
324
305
struct rpctlscd_handlerecord_res res ;
325
306
enum clnt_stat stat ;
326
- CLIENT * cl = KRPC_VNET (rpctls_connect_handle );
327
307
328
308
/* Do the handlerecord upcall. */
329
309
arg .socookie = (uint64_t )socookie ;
330
- stat = rpctlscd_handlerecord_2 (& arg , & res , cl );
310
+ stat = rpctlscd_handlerecord_2 (& arg , & res , rpctls_connect_handle );
331
311
if (stat == RPC_SUCCESS )
332
312
* reterr = res .reterr ;
333
313
return (stat );
@@ -339,11 +319,10 @@ rpctls_srv_handlerecord(void *socookie, uint32_t *reterr)
339
319
struct rpctlssd_handlerecord_arg arg ;
340
320
struct rpctlssd_handlerecord_res res ;
341
321
enum clnt_stat stat ;
342
- CLIENT * cl = KRPC_VNET (rpctls_server_handle );
343
322
344
323
/* Do the handlerecord upcall. */
345
324
arg .socookie = (uint64_t )socookie ;
346
- stat = rpctlssd_handlerecord_2 (& arg , & res , cl );
325
+ stat = rpctlssd_handlerecord_2 (& arg , & res , rpctls_server_handle );
347
326
if (stat == RPC_SUCCESS )
348
327
* reterr = res .reterr ;
349
328
return (stat );
@@ -356,11 +335,10 @@ rpctls_cl_disconnect(void *socookie, uint32_t *reterr)
356
335
struct rpctlscd_disconnect_arg arg ;
357
336
struct rpctlscd_disconnect_res res ;
358
337
enum clnt_stat stat ;
359
- CLIENT * cl = KRPC_VNET (rpctls_connect_handle );
360
338
361
339
/* Do the disconnect upcall. */
362
340
arg .socookie = (uint64_t )socookie ;
363
- stat = rpctlscd_disconnect_2 (& arg , & res , cl );
341
+ stat = rpctlscd_disconnect_2 (& arg , & res , rpctls_connect_handle );
364
342
if (stat == RPC_SUCCESS )
365
343
* reterr = res .reterr ;
366
344
return (stat );
@@ -372,11 +350,10 @@ rpctls_srv_disconnect(void *socookie, uint32_t *reterr)
372
350
struct rpctlssd_disconnect_arg arg ;
373
351
struct rpctlssd_disconnect_res res ;
374
352
enum clnt_stat stat ;
375
- CLIENT * cl = KRPC_VNET (rpctls_server_handle );
376
353
377
354
/* Do the disconnect upcall. */
378
355
arg .socookie = (uint64_t )socookie ;
379
- stat = rpctlssd_disconnect_2 (& arg , & res , cl );
356
+ stat = rpctlssd_disconnect_2 (& arg , & res , rpctls_server_handle );
380
357
if (stat == RPC_SUCCESS )
381
358
* reterr = res .reterr ;
382
359
return (stat );
@@ -393,7 +370,6 @@ rpctls_server(SVCXPRT *xprt, uint32_t *flags, uid_t *uid, int *ngrps,
393
370
.xp = xprt ,
394
371
.server = true,
395
372
};
396
- CLIENT * cl = KRPC_VNET (rpctls_server_handle );
397
373
struct rpctlssd_connect_arg arg ;
398
374
struct rpctlssd_connect_res res ;
399
375
gid_t * gidp ;
@@ -407,7 +383,7 @@ rpctls_server(SVCXPRT *xprt, uint32_t *flags, uid_t *uid, int *ngrps,
407
383
/* Do the server upcall. */
408
384
res .gid .gid_val = NULL ;
409
385
arg .socookie = (uint64_t )xprt -> xp_socket ;
410
- stat = rpctlssd_connect_2 (& arg , & res , cl );
386
+ stat = rpctlssd_connect_2 (& arg , & res , rpctls_server_handle );
411
387
if (stat == RPC_SUCCESS ) {
412
388
* flags = res .flags ;
413
389
if ((* flags & (RPCTLS_FLAGS_CERTUSER |
0 commit comments