Date: Tue, 26 May 2009 01:16:09 +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: r192781 - in head/sys/fs: nfs nfsserver Message-ID: <200905260116.n4Q1G9Z1042053@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905260116.n4Q1G9Z1042053>