From: guy Date: Tue, 13 Jun 2006 22:21:38 +0000 (+0000) Subject: From NetBSD: X-Git-Tag: tcpdump-4.0.0~216 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/038431c6b4224b18beabf4df28e5d3a9958cf5c8?hp=6354506df4ce2cee8ff41d715e00c8c545d6a89d From NetBSD: revision 1.7 date: 2006/03/25 11:43:53; author: rpaulo; state: Exp; lines: +23 -3 PR 13604: detect and print correct information for 4.4BSD/NetBSD NFS filehandles. The heuristic may or may not be wrong, but no one replied in the tcpdump-workers mailing list. Extraction of the fsid information contributed by Chuck Silvers. Discussed with Chuck Silvers. ---------------------------- revision 1.6 date: 2006/03/22 04:30:28; author: christos; state: Exp; lines: +4 -2 Coverity CID 563: Kill SUNOS3 case; it is dead code. ---------------------------- --- diff --git a/parsenfsfh.c b/parsenfsfh.c index 8894ad13..d5f877d8 100644 --- a/parsenfsfh.c +++ b/parsenfsfh.c @@ -42,7 +42,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.28 2004-03-25 03:30:55 mcr Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.29 2006-06-13 22:21:38 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -79,6 +79,7 @@ static const char rcsid[] _U_ = #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 */ @@ -145,6 +146,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 +201,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 { @@ -263,6 +271,18 @@ int ourself; /* true if file handle was generated on this host */ *osnamep = "Auspex"; break; + case FHT_BSD44: + fsidp->Fsid_dev.Minor = fhp[0]; + fsidp->Fsid_dev.Major = fhp[1]; + fsidp->fsid_code = 0; + + temp = make_uint32(fhp[15], fhp[14], fhp[13], fhp[12]); + *inop = temp; + + 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 */ @@ -301,10 +321,16 @@ int ourself; /* true if file handle was generated on this host */ *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];