]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Propagate from the main branch
authorguy <guy>
Fri, 15 Jun 2007 19:15:04 +0000 (19:15 +0000)
committerguy <guy>
Fri, 15 Jun 2007 19:15:04 +0000 (19:15 +0000)
  revision 1.29
  date: 2006-06-13 22:21:38 +0000;  author: guy;  state: Exp;  lines: +28 -2
  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.
----------------------------

parsenfsfh.c

index 8894ad131025b9b389468515f529fa13b316c137..d41da883610b081be3332be9abf0e9dc3511a6d5 100644 (file)
@@ -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.28.2.1 2007-06-15 19:15:04 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];