nfscl: Revert part of commit 196787f79e

Commit 196787f79e erroneously assumed that the client code for
Open/Claim_deleg_cur_FH was broken, but it was not.
It was actually wireshark that was broken and indicated
that the correct XDR was bogus.

This reverts the part of 196787f79e that changed the arguments for
Open/Claim_deleg_cur_FH.

Found during the IETF bakeathon testing event this week.

MFC after:	3 days
This commit is contained in:
Rick Macklem 2024-04-25 12:32:02 -07:00
parent 9f231af307
commit 8efba70d79
3 changed files with 11 additions and 46 deletions

View file

@ -561,34 +561,21 @@ nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int8_t *nfhp, int fhlen,
*tl = txdr_unsigned(delegtype);
} else {
if (dp != NULL) {
if (NFSHASNFSV4N(nmp)) {
if (NFSHASNFSV4N(nmp))
*tl = txdr_unsigned(
NFSV4OPEN_CLAIMDELEGATECURFH);
NFSLOCKMNT(nmp);
if ((nmp->nm_privflag & NFSMNTP_BUGGYFBSDSRV) !=
0) {
NFSUNLOCKMNT(nmp);
/*
* Add a stateID argument to make old
* broken FreeBSD NFSv4.1/4.2 servers
* happy.
*/
NFSM_BUILD(tl, uint32_t *,NFSX_STATEID);
*tl++ = 0;
*tl++ = dp->nfsdl_stateid.other[0];
*tl++ = dp->nfsdl_stateid.other[1];
*tl = dp->nfsdl_stateid.other[2];
} else
NFSUNLOCKMNT(nmp);
} else {
else
*tl = txdr_unsigned(NFSV4OPEN_CLAIMDELEGATECUR);
NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID);
NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID);
if (NFSHASNFSV4N(nmp))
*tl++ = 0;
else
*tl++ = dp->nfsdl_stateid.seqid;
*tl++ = dp->nfsdl_stateid.other[0];
*tl++ = dp->nfsdl_stateid.other[1];
*tl = dp->nfsdl_stateid.other[2];
*tl++ = dp->nfsdl_stateid.other[0];
*tl++ = dp->nfsdl_stateid.other[1];
*tl = dp->nfsdl_stateid.other[2];
if (!NFSHASNFSV4N(nmp))
(void)nfsm_strtom(nd, name, namelen);
}
} else if (NFSHASNFSV4N(nmp)) {
*tl = txdr_unsigned(NFSV4OPEN_CLAIMFH);
} else {

View file

@ -4512,7 +4512,6 @@ nfscl_tryopen(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen,
{
int error;
struct nfscldeleg *dp;
bool try_busted_xdr;
dp = *ndpp;
do {
@ -4520,29 +4519,9 @@ nfscl_tryopen(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen,
error = nfsrpc_openrpc(nmp, vp, fhp, fhlen, newfhp, newfhlen,
mode, op, name, namelen, ndpp, reclaim, delegtype, cred, p,
0, 0);
try_busted_xdr = false;
if (error == NFSERR_DELAY)
(void) nfs_catnap(PZERO, error, "nfstryop");
else if (error == NFSERR_EXPIRED && NFSHASNFSV4N(nmp) &&
reclaim == 0 && dp != NULL) {
/* This case is a Claim_Deleg_Cur_FH Open. */
NFSLOCKMNT(nmp);
if ((nmp->nm_privflag & NFSMNTP_BUGGYFBSDSRV) == 0) {
/*
* Old FreeBSD NFSv4.1/4.2 servers erroneously
* expect a stateID argument for Open
* Claim_Deleg_Cur_FH and interpret the
* Getattr reply as a stateID. This results
* in an NFSERR_EXPIRED failure.
* Setting NFSMNTP_BUGGYFBSDSRV makes the Open
* send a stateID, in violation of RFC8881.
*/
try_busted_xdr = true;
nmp->nm_privflag |= NFSMNTP_BUGGYFBSDSRV;
}
NFSUNLOCKMNT(nmp);
}
} while (error == NFSERR_DELAY || try_busted_xdr);
} while (error == NFSERR_DELAY);
if (error == EAUTH || error == EACCES) {
/* Try again using system credentials */
newnfs_setroot(cred);

View file

@ -124,7 +124,6 @@ struct nfsmount {
#define NFSMNTP_DELEGISSUED 0x00000400
#define NFSMNTP_NODEALLOCATE 0x00000800
#define NFSMNTP_FAKEROOTFH 0x00001000
#define NFSMNTP_BUGGYFBSDSRV 0x00002000
/* New mount flags only used by the kernel via nmount(2). */
#define NFSMNT_TLS 0x00000001