Module Name:    src
Committed By:   christos
Date:           Fri Dec 25 04:50:21 UTC 2015

Modified Files:
        src/external/bsd/tcpdump/dist: parsenfsfh.c

Log Message:
We stuck the generation number eons ago before the inode, so we broke
inode printing in nfs file handles.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/tcpdump/dist/parsenfsfh.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/tcpdump/dist/parsenfsfh.c
diff -u src/external/bsd/tcpdump/dist/parsenfsfh.c:1.5 src/external/bsd/tcpdump/dist/parsenfsfh.c:1.6
--- src/external/bsd/tcpdump/dist/parsenfsfh.c:1.5	Wed Nov 19 22:05:03 2014
+++ src/external/bsd/tcpdump/dist/parsenfsfh.c	Thu Dec 24 23:50:21 2015
@@ -42,7 +42,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: parsenfsfh.c,v 1.5 2014/11/20 03:05:03 christos Exp $");
+__RCSID("$NetBSD: parsenfsfh.c,v 1.6 2015/12/25 04:50:21 christos Exp $");
 #endif
 
 #define NETDISSECT_REWORKED
@@ -81,6 +81,7 @@ __RCSID("$NetBSD: parsenfsfh.c,v 1.5 201
 #define	FHT_AIX32	10
 #define	FHT_HPUX9	11
 #define	FHT_BSD44	12
+#define	FHT_NETBSD	13
 
 #ifdef	ultrix
 /* Nasty hack to keep the Ultrix C compiler from emitting bogus warnings */
@@ -145,10 +146,12 @@ Parse_fh(register const unsigned char *f
 #if	defined(__osf__)
 	    fhtype = FHT_DECOSF;
 #endif
-#if	defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) \
-     || defined(__OpenBSD__)
+#if	defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
 	    fhtype = FHT_BSD44;
 #endif
+#if	defined(__NetBSD__)
+	    fhtype = FHT_NETBSD;
+#endif
 	}
 	/*
 	 * This is basically a big decision tree
@@ -200,7 +203,12 @@ Parse_fh(register const unsigned char *f
 		 * might be HP-UX (depends on their values for minor devs)
 		 */
 		if ((fhp[6] == 0) && (fhp[7] == 0)) {
-		    fhtype = FHT_BSD44;
+		    /* for ffs sizeof(ufid) == 16 bytes */
+		    if ((fhp[8] == 0x10 && fhp[9] == 0x0) ||
+			(fhp[9] == 0x0 && fhp[9] == 0x10))
+			    fhtype = FHT_NETBSD;
+		    else
+			    fhtype = FHT_BSD44;
 		}
 		/*XXX we probably only need to test of these two bytes */
 		else if ((fhp[21] == 0) && (fhp[23] == 0)) {
@@ -269,11 +277,19 @@ Parse_fh(register const unsigned char *f
 	    break;
 
 	case FHT_BSD44:
+	case FHT_NETBSD:
 	    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]);
+	    /*
+	     * NetBSD puts the generation number before the inode; inode
+	     * is 64 bits, but only 32 are typically used; XXX endian issues?
+	     */
+	    if (fhtype == FHT_NETBSD)
+		    *inop = make_uint32(fhp[19], fhp[18], fhp[17], fhp[16]);
+	    else
+		    *inop = make_uint32(fhp[15], fhp[14], fhp[13], fhp[12]);
 
 	    if (osnamep)
 		*osnamep = "BSD 4.4";

Reply via email to