Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 May 2009 01:47:37 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192782 - head/sys/fs/nfsserver
Message-ID:  <200905260147.n4Q1lbf8042671@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Tue May 26 01:47:37 2009
New Revision: 192782
URL: http://svn.freebsd.org/changeset/base/192782

Log:
  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)

Modified:
  head/sys/fs/nfsserver/nfs_nfsdkrpc.c

Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdkrpc.c	Tue May 26 01:16:09 2009	(r192781)
+++ head/sys/fs/nfsserver/nfs_nfsdkrpc.c	Tue May 26 01:47:37 2009	(r192782)
@@ -82,6 +82,14 @@ SYSCTL_INT(_vfs_newnfs, OID_AUTO, nfs_pr
     &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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905260147.n4Q1lbf8042671>