diff options
author | rmacklem <rmacklem@FreeBSD.org> | 2009-05-26 01:47:37 +0000 |
---|---|---|
committer | rmacklem <rmacklem@FreeBSD.org> | 2009-05-26 01:47:37 +0000 |
commit | 82cde148a49e00d754f21881c65bd1af11b13350 (patch) | |
tree | 34bc34715d50cb4c678ecd2c32fcbc8e6a9bede4 /sys/fs | |
parent | 7373601dad427f535fd013e34d928a374f90b701 (diff) | |
download | FreeBSD-src-82cde148a49e00d754f21881c65bd1af11b13350.zip FreeBSD-src-82cde148a49e00d754f21881c65bd1af11b13350.tar.gz |
Add two sysctl variables to the experimental nfs server, so
that the range of versions of NFS handled by the server can
be limited. The nfsd daemon must be restarted after these
sysctl variables are changed, in order for the change to take
effect.
Approved by: kib (mentor)
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/nfsserver/nfs_nfsdkrpc.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/sys/fs/nfsserver/nfs_nfsdkrpc.c b/sys/fs/nfsserver/nfs_nfsdkrpc.c index dde5f3b..e117955 100644 --- a/sys/fs/nfsserver/nfs_nfsdkrpc.c +++ b/sys/fs/nfsserver/nfs_nfsdkrpc.c @@ -82,6 +82,14 @@ SYSCTL_INT(_vfs_newnfs, OID_AUTO, nfs_privport, CTLFLAG_RW, &nfs_privport, 0, "Only allow clients using a privileged port for NFSv2 and 3"); +static int nfs_minvers = NFS_VER2; +SYSCTL_INT(_vfs_newnfs, OID_AUTO, server_min_nfsvers, CTLFLAG_RW, + &nfs_minvers, 0, "The lowest version of NFS handled by the server"); + +static int nfs_maxvers = NFS_VER4; +SYSCTL_INT(_vfs_newnfs, OID_AUTO, server_max_nfsvers, CTLFLAG_RW, + &nfs_maxvers, 0, "The highest version of NFS handled by the server"); + static int nfs_proc(struct nfsrv_descript *, u_int32_t, struct socket *, u_int64_t, struct nfsrvcache **); @@ -353,9 +361,15 @@ nfsrvd_addsock(struct file *fp) fp->f_ops = &badfileops; fp->f_data = NULL; xprt->xp_sockref = ++sockref; - svc_reg(xprt, NFS_PROG, NFS_VER2, nfssvc_program, NULL); - svc_reg(xprt, NFS_PROG, NFS_VER3, nfssvc_program, NULL); - svc_reg(xprt, NFS_PROG, NFS_VER4, nfssvc_program, NULL); + if (nfs_minvers == NFS_VER2) + svc_reg(xprt, NFS_PROG, NFS_VER2, nfssvc_program, + NULL); + if (nfs_minvers <= NFS_VER3 && nfs_maxvers >= NFS_VER3) + svc_reg(xprt, NFS_PROG, NFS_VER3, nfssvc_program, + NULL); + if (nfs_maxvers >= NFS_VER4) + svc_reg(xprt, NFS_PROG, NFS_VER4, nfssvc_program, + NULL); } return (0); |