summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2009-05-26 01:16:09 +0000
committerrmacklem <rmacklem@FreeBSD.org>2009-05-26 01:16:09 +0000
commit7373601dad427f535fd013e34d928a374f90b701 (patch)
tree7e5af806e02eb632eccb21dc5019687139d51be8 /sys/fs
parent70a64093bf8943573b38e0fc59d5d6b22fc23044 (diff)
downloadFreeBSD-src-7373601dad427f535fd013e34d928a374f90b701.zip
FreeBSD-src-7373601dad427f535fd013e34d928a374f90b701.tar.gz
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)
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/nfs/nfsport.h3
-rw-r--r--sys/fs/nfsserver/nfs_nfsdsocket.c25
2 files changed, 17 insertions, 11 deletions
diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h
index c1aa061..71b6cb4 100644
--- a/sys/fs/nfs/nfsport.h
+++ b/sys/fs/nfs/nfsport.h
@@ -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.
*/
diff --git a/sys/fs/nfsserver/nfs_nfsdsocket.c b/sys/fs/nfsserver/nfs_nfsdsocket.c
index 54307bc..fc6e39e 100644
--- a/sys/fs/nfsserver/nfs_nfsdsocket.c
+++ b/sys/fs/nfsserver/nfs_nfsdsocket.c
@@ -639,13 +639,16 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram,
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 *nd, int isdgram,
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;
OpenPOWER on IntegriCloud