svn commit: r360324 - in projects/nfs-over-tls/sys: modules/krpc rpc rpc/rpcsec_tls
Rick Macklem
rmacklem at FreeBSD.org
Sat Apr 25 21:41:40 UTC 2020
Author: rmacklem
Date: Sat Apr 25 21:41:38 2020
New Revision: 360324
URL: https://svnweb.freebsd.org/changeset/base/360324
Log:
Fix the krpc.ko build.
Also, modify the code so that the syscall is registered during module
loading.
Modified:
projects/nfs-over-tls/sys/modules/krpc/Makefile
projects/nfs-over-tls/sys/rpc/rpc_generic.c
projects/nfs-over-tls/sys/rpc/rpcsec_tls.h
projects/nfs-over-tls/sys/rpc/rpcsec_tls/rpctls_impl.c
Modified: projects/nfs-over-tls/sys/modules/krpc/Makefile
==============================================================================
--- projects/nfs-over-tls/sys/modules/krpc/Makefile Sat Apr 25 21:41:09 2020 (r360323)
+++ projects/nfs-over-tls/sys/modules/krpc/Makefile Sat Apr 25 21:41:38 2020 (r360324)
@@ -1,6 +1,6 @@
# $FreeBSD$
-.PATH: ${SRCTOP}/sys/rpc
+.PATH: ${SRCTOP}/sys/rpc ${SRCTOP}/sys/rpc/rpcsec_tls
KMOD= krpc
SRCS= auth_none.c \
auth_unix.c \
@@ -21,8 +21,38 @@ SRCS= auth_none.c \
svc_auth_unix.c \
svc_dg.c \
svc_generic.c \
- svc_vc.c \
+ svc_vc.c
-SRCS+= opt_inet6.h
+SRCS+= rpctls_impl.c auth_tls.c
+
+SRCS+= opt_inet6.h opt_kern_tls.h
+
+SRCS+= rpctlscd.h rpctlscd_xdr.c rpctlscd_clnt.c
+CLEANFILES= rpctlscd.h rpctlscd_xdr.c rpctlscd_clnt.c
+
+S= ${SRCTOP}/sys
+
+rpctlscd.h: $S/rpc/rpcsec_tls/rpctlscd.x
+ RPCGEN_CPP=${CPP:Q} rpcgen -hM $S/rpc/rpcsec_tls/rpctlscd.x | grep -v pthread.h > rpctlscd.h
+
+rpctlscd_xdr.c: $S/rpc/rpcsec_tls/rpctlscd.x
+ RPCGEN_CPP=${CPP:Q} rpcgen -c $S/rpc/rpcsec_tls/rpctlscd.x -o rpctlscd_xdr.c
+
+rpctlscd_clnt.c: $S/rpc/rpcsec_tls/rpctlscd.x
+ RPCGEN_CPP=${CPP:Q} rpcgen -lM $S/rpc/rpcsec_tls/rpctlscd.x | grep -v string.h > rpctlscd_clnt.c
+
+SRCS+= rpctlssd.h rpctlssd_xdr.c rpctlssd_clnt.c
+CLEANFILES= rpctlssd.h rpctlssd_xdr.c rpctlssd_clnt.c
+
+S= ${SRCTOP}/sys
+
+rpctlssd.h: $S/rpc/rpcsec_tls/rpctlssd.x
+ RPCGEN_CPP=${CPP:Q} rpcgen -hM $S/rpc/rpcsec_tls/rpctlssd.x | grep -v pthread.h > rpctlssd.h
+
+rpctlssd_xdr.c: $S/rpc/rpcsec_tls/rpctlssd.x
+ RPCGEN_CPP=${CPP:Q} rpcgen -c $S/rpc/rpcsec_tls/rpctlssd.x -o rpctlssd_xdr.c
+
+rpctlssd_clnt.c: $S/rpc/rpcsec_tls/rpctlssd.x
+ RPCGEN_CPP=${CPP:Q} rpcgen -lM $S/rpc/rpcsec_tls/rpctlssd.x | grep -v string.h > rpctlssd_clnt.c
.include <bsd.kmod.mk>
Modified: projects/nfs-over-tls/sys/rpc/rpc_generic.c
==============================================================================
--- projects/nfs-over-tls/sys/rpc/rpc_generic.c Sat Apr 25 21:41:09 2020 (r360323)
+++ projects/nfs-over-tls/sys/rpc/rpc_generic.c Sat Apr 25 21:41:38 2020 (r360324)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
#include <rpc/rpc.h>
#include <rpc/nettype.h>
#include <rpc/rpcsec_gss.h>
+#include <rpc/rpcsec_tls.h>
#include <rpc/rpc_com.h>
#include <rpc/krpc.h>
@@ -963,8 +964,22 @@ _rpc_copym_into_ext_pgs(struct mbuf *mp, int maxextsiz
static int
krpc_modevent(module_t mod, int type, void *data)
{
+ int error = 0;
- return (0);
+ switch (type) {
+ case MOD_LOAD:
+ error = rpctls_init();
+ break;
+ case MOD_UNLOAD:
+ /*
+ * Cannot be unloaded, since the rpctlssd or rpctlscd daemons
+ * might be performing a rpctls syscall.
+ */
+ /* FALLTHROUGH */
+ default:
+ error = EOPNOTSUPP;
+ }
+ return (error);
}
static moduledata_t krpc_mod = {
"krpc",
Modified: projects/nfs-over-tls/sys/rpc/rpcsec_tls.h
==============================================================================
--- projects/nfs-over-tls/sys/rpc/rpcsec_tls.h Sat Apr 25 21:41:09 2020 (r360323)
+++ projects/nfs-over-tls/sys/rpc/rpcsec_tls.h Sat Apr 25 21:41:38 2020 (r360324)
@@ -48,7 +48,11 @@
enum clnt_stat rpctls_connect(CLIENT *newclient, struct socket *so,
uint64_t *sslp);
enum clnt_stat rpctls_cl_disconnect(uint64_t sec, uint64_t usec, uint64_t ssl);
-enum clnt_stat rpctls_srv_disconnect(uint64_t sec, uint64_t usec, uint64_t ssl);
+enum clnt_stat rpctls_srv_disconnect(uint64_t sec, uint64_t usec,
+ uint64_t ssl);
+
+/* Initialization function for rpcsec_tls. */
+int rpctls_init(void);
/* String for AUTH_TLS reply verifier. */
#define RPCTLS_START_STRING "STARTTLS"
Modified: projects/nfs-over-tls/sys/rpc/rpcsec_tls/rpctls_impl.c
==============================================================================
--- projects/nfs-over-tls/sys/rpc/rpcsec_tls/rpctls_impl.c Sat Apr 25 21:41:09 2020 (r360323)
+++ projects/nfs-over-tls/sys/rpc/rpcsec_tls/rpctls_impl.c Sat Apr 25 21:41:38 2020 (r360324)
@@ -93,14 +93,16 @@ static enum clnt_stat rpctls_server(struct socket *so,
uint32_t *flags, uint64_t *sslp,
uid_t *uid, int *ngrps, gid_t **gids);
-static void
-rpctls_init(void *dummy)
+int
+rpctls_init(void)
{
int error;
error = syscall_helper_register(rpctls_syscalls, SY_THR_STATIC_KLD);
- if (error != 0)
+ if (error != 0) {
printf("rpctls_init: cannot register syscall\n");
+ return (error);
+ }
mtx_init(&rpctls_connect_lock, "rpctls_connect_lock", NULL,
MTX_DEF);
mtx_init(&rpctls_server_lock, "rpctls_server_lock", NULL,
@@ -108,8 +110,8 @@ rpctls_init(void *dummy)
rpctls_null_verf.oa_flavor = AUTH_NULL;
rpctls_null_verf.oa_base = RPCTLS_START_STRING;
rpctls_null_verf.oa_length = strlen(RPCTLS_START_STRING);
+ return (0);
}
-SYSINIT(rpctls_init, SI_SUB_KMEM, SI_ORDER_ANY, rpctls_init, NULL);
int
sys_gssd_syscall(struct thread *td, struct gssd_syscall_args *uap)
More information about the svn-src-projects
mailing list