X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/3d932490b826facb568937a1290910a1265267f5..47fc89d711eec0a073d9b3b293a1af901b5bd791:/parsenfsfh.c diff --git a/parsenfsfh.c b/parsenfsfh.c index 5ca11eff..923b063a 100644 --- a/parsenfsfh.c +++ b/parsenfsfh.c @@ -40,11 +40,6 @@ * Western Research Laboratory */ -#ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.25 2002-08-01 08:52:58 risso Exp $ (LBL)"; -#endif - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -79,6 +74,7 @@ static const char rcsid[] = #define FHT_SUNOS5 9 #define FHT_AIX32 10 #define FHT_HPUX9 11 +#define FHT_BSD44 12 #ifdef ultrix /* Nasty hack to keep the Ultrix C compiler from emitting bogus warnings */ @@ -111,9 +107,9 @@ static int is_UCX(const unsigned char *); void Parse_fh(fh, len, fsidp, inop, osnamep, fsnamep, ourself) register const unsigned char *fh; -int len; +int len _U_; my_fsid *fsidp; -ino_t *inop; +u_int32_t *inop; const char **osnamep; /* if non-NULL, return OS name here */ const char **fsnamep; /* if non-NULL, return server fs name here (for VMS) */ int ourself; /* true if file handle was generated on this host */ @@ -145,6 +141,10 @@ int ourself; /* true if file handle was generated on this host */ #endif #if defined(__osf__) fhtype = FHT_DECOSF; +#endif +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) \ + || defined(__OpenBSD__) + fhtype = FHT_BSD44; #endif } /* @@ -196,8 +196,11 @@ int ourself; /* true if file handle was generated on this host */ * could be Ultrix, IRIX5, AIX, or SUNOS5 * might be HP-UX (depends on their values for minor devs) */ + if ((fhp[6] == 0) && (fhp[7] == 0)) { + fhtype = FHT_BSD44; + } /*XXX we probably only need to test of these two bytes */ - if ((fhp[21] == 0) && (fhp[23] == 0)) { + else if ((fhp[21] == 0) && (fhp[23] == 0)) { fhtype = FHT_ULTRIX; } else { @@ -256,13 +259,23 @@ int ourself; /* true if file handle was generated on this host */ fsidp->Fsid_dev.Major = fhp[6]; fsidp->fsid_code = 0; - temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); - *inop = temp; + *inop = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); if (osnamep) *osnamep = "Auspex"; break; + case FHT_BSD44: + fsidp->Fsid_dev.Minor = fhp[0]; + fsidp->Fsid_dev.Major = fhp[1]; + fsidp->fsid_code = 0; + + *inop = make_uint32(fhp[15], fhp[14], fhp[13], fhp[12]); + + if (osnamep) + *osnamep = "BSD 4.4"; + break; + case FHT_DECOSF: fsidp->fsid_code = make_uint32(fhp[7], fhp[6], fhp[5], fhp[4]); /* XXX could ignore 3 high-order bytes */ @@ -271,8 +284,7 @@ int ourself; /* true if file handle was generated on this host */ fsidp->Fsid_dev.Minor = temp & 0xFFFFF; fsidp->Fsid_dev.Major = (temp>>20) & 0xFFF; - temp = make_uint32(fhp[15], fhp[14], fhp[13], fhp[12]); - *inop = temp; + *inop = make_uint32(fhp[15], fhp[14], fhp[13], fhp[12]); if (osnamep) *osnamep = "OSF"; break; @@ -282,8 +294,7 @@ int ourself; /* true if file handle was generated on this host */ fsidp->Fsid_dev.Major = fhp[2]; fsidp->fsid_code = 0; - temp = make_uint32(fhp[8], fhp[9], fhp[10], fhp[11]); - *inop = temp; + *inop = make_uint32(fhp[8], fhp[9], fhp[10], fhp[11]); if (osnamep) *osnamep = "IRIX4"; @@ -294,25 +305,29 @@ int ourself; /* true if file handle was generated on this host */ fsidp->Fsid_dev.Major = make_uint16(fhp[0], fhp[1]); fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]); - temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); - *inop = temp; + *inop = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); if (osnamep) *osnamep = "IRIX5"; break; +#ifdef notdef case FHT_SUNOS3: + /* + * XXX - none of the heuristics above return this. + * Are there any SunOS 3.x systems around to care about? + */ if (osnamep) *osnamep = "SUNOS3"; break; +#endif case FHT_SUNOS4: fsidp->Fsid_dev.Minor = fhp[3]; fsidp->Fsid_dev.Major = fhp[2]; fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]); - temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); - *inop = temp; + *inop = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); if (osnamep) *osnamep = "SUNOS4"; @@ -325,8 +340,7 @@ int ourself; /* true if file handle was generated on this host */ fsidp->Fsid_dev.Minor = temp & 0x3FFFF; fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]); - temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); - *inop = temp; + *inop = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); if (osnamep) *osnamep = "SUNOS5"; @@ -377,8 +391,7 @@ int ourself; /* true if file handle was generated on this host */ fsidp->Fsid_dev.Major = make_uint16(fhp[0], fhp[1]); fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]); - temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); - *inop = temp; + *inop = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); if (osnamep) *osnamep = "AIX32"; @@ -390,8 +403,7 @@ int ourself; /* true if file handle was generated on this host */ fsidp->Fsid_dev.Minor = temp; fsidp->fsid_code = make_uint32(fhp[4], fhp[5], fhp[6], fhp[7]); - temp = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); - *inop = temp; + *inop = make_uint32(fhp[12], fhp[13], fhp[14], fhp[15]); if (osnamep) *osnamep = "HPUX9";