Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Aug 1999 10:54:17 -0700 (PDT)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Peter Wemm <peter@netplex.com.au>
Cc:        Alfred Perlstein <bright@rush.net>, hackers@FreeBSD.ORG
Subject:   Re: confusion about nfsm_srvmtofh bad behavior? 
Message-ID:  <199908021754.KAA14651@apollo.backplane.com>
References:   <19990802173102.CCA101C9F@overcee.netplex.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
:Right now it seems we're generating 8 bytes of fsid and 12 (padded to 16)
:bytes of handle data in the common case for a total of 24 bytes of filehandle.
:Then we pad that to 32 bytes for V2 or 64 bytes for V3, with random crud.
:Then we copy this around, store it all in memory, transmit it over the wire,
:etc.  It's a nightmare.
:
:NFSv2 filehandles are fixed at 32 bytes long.  For V3 we could probably just
:transmit 24 byte filehandles rather than 64.  (I'll reread the spec to make
:sure there isn't a v3 minimum size).
:
:That explicit zero on the end is probably redundant since we've been using
:random data in it's place since day 1.  (We do need (I think) the fhlen ==
:0 bzero though).
:
:Cheers,
:-Peter
    
    Well, judging from the code I think that NFSv3 handles are locked in
    at 64 bytes.    Otherwise the nfsm_srvmtofh() macro will dump out
    when fhlen != NFSX_V3FH.  The macro could be wrong, but I would have
    thought that we'd get more intereoperability complaints then.

    We definitely have to zero the handle if fhlen == 0 -- I haven't audited
    the code but my guess is that users of the macro may assume that the fh
    has been zerod in certain degenerate cases.  I'll bet the handle is
    optional in parts of the protocol.

#define nfsm_srvmtofh(f) \
        do { \
                int fhlen; \
                if (nfsd->nd_flag & ND_NFSV3) { \
                        nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \
                        fhlen = fxdr_unsigned(int, *tl); \
                        if (fhlen != 0 && fhlen != NFSX_V3FH) { \
                                error = EBADRPC; \
                                nfsm_reply(0); \
                        } \
			...

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908021754.KAA14651>