From owner-svn-src-head@FreeBSD.ORG Tue May 26 01:16:10 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 279ED1065674; Tue, 26 May 2009 01:16:10 +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 169018FC1F; Tue, 26 May 2009 01:16:10 +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 n4Q1G9dl042055; Tue, 26 May 2009 01:16:09 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q1G9Z1042053; Tue, 26 May 2009 01:16:09 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905260116.n4Q1G9Z1042053@svn.freebsd.org> From: Rick Macklem Date: Tue, 26 May 2009 01:16:09 +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: r192781 - in head/sys/fs: nfs 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:16:10 -0000 Author: rmacklem Date: Tue May 26 01:16:09 2009 New Revision: 192781 URL: http://svn.freebsd.org/changeset/base/192781 Log: Fix the handling of NFSv4 Illegal Operation number to conform to RFC3530 (the operation number in the reply must be set to the value for OP_ILLEGAL). Also cleaned up some indentation. Approved by: kib (mentor) Modified: head/sys/fs/nfs/nfsport.h head/sys/fs/nfsserver/nfs_nfsdsocket.c Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Tue May 26 01:09:33 2009 (r192780) +++ head/sys/fs/nfs/nfsport.h Tue May 26 01:16:09 2009 (r192781) @@ -235,6 +235,9 @@ */ #define NFSV4OP_NOPS 40 +/* Quirky case if the illegal op code */ +#define NFSV4OP_OPILLEGAL 10044 + /* * Fake NFSV4OP_xxx used for nfsstat. Start at NFSV4OP_NOPS. */ Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdsocket.c Tue May 26 01:09:33 2009 (r192780) +++ head/sys/fs/nfsserver/nfs_nfsdsocket.c Tue May 26 01:16:09 2009 (r192781) @@ -639,13 +639,16 @@ nfsrvd_compound(struct nfsrv_descript *n for (i = 0; i < numops; i++) { NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); NFSM_BUILD(repp, u_int32_t *, 2 * NFSX_UNSIGNED); - *repp++ = *tl; + *repp = *tl; op = fxdr_unsigned(int, *tl); if (op < NFSV4OP_ACCESS || op >= NFSV4OP_NOPS) { - nd->nd_repstat = NFSERR_OPILLEGAL; - *repp = nfsd_errmap(nd); - retops++; - break; + nd->nd_repstat = NFSERR_OPILLEGAL; + *repp++ = txdr_unsigned(NFSV4OP_OPILLEGAL); + *repp = nfsd_errmap(nd); + retops++; + break; + } else { + repp++; } /* @@ -682,12 +685,12 @@ nfsrvd_compound(struct nfsrv_descript *n nd->nd_repstat = NFSERR_RESOURCE; *repp = nfsd_errmap(nd); if (op == NFSV4OP_SETATTR) { - /* - * Setattr replies require a bitmap. - * even for errors like these. - */ - NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); - *tl = 0; + /* + * Setattr replies require a bitmap. + * even for errors like these. + */ + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = 0; } retops++; break;