From owner-svn-src-head@FreeBSD.ORG Tue May 26 01:47:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E6B4106564A; Tue, 26 May 2009 01:47:38 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 12EA98FC0C; Tue, 26 May 2009 01:47:38 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q1lbl3042672; Tue, 26 May 2009 01:47:37 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q1lbf8042671; Tue, 26 May 2009 01:47:37 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905260147.n4Q1lbf8042671@svn.freebsd.org> From: Rick Macklem Date: Tue, 26 May 2009 01:47:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192782 - head/sys/fs/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 01:47:38 -0000 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);