]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Fixes for:
authorguy <guy>
Mon, 26 Aug 2002 09:36:19 +0000 (09:36 +0000)
committerguy <guy>
Mon, 26 Aug 2002 09:36:19 +0000 (09:36 +0000)
parsefattr misuses nfsv2 version members for v3.
print_int64 prints at least 9 digits unnecessarily.
-u flag doesn't always suppress decoding handles.

from Takashi Yamamoto <[email protected]>.

CREDITS
print-nfs.c

diff --git a/CREDITS b/CREDITS
index 671ebed2c4b082e5f0158915fed8523a5b0ee977..fd1ee737240d8dffd4eb9d43d3cb712eb76cefa2 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -87,6 +87,7 @@ Additional people who have contributed patches:
        Sami Farin                      <[email protected]>
        Sebastian Krahmer               <[email protected]>
        Seth Webster                    <[email protected]>
+       Takashi Yamamoto                <[email protected]>
        Terry Kennedy                   <[email protected]>
        Timo Koskiahde
        Tony Li                         <[email protected]>
index b02438be15a127dfc3153ffa45db368024776c46..6719f3dba5445ab47172b0f0c59a76685a2378e0 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.95 2002-08-01 08:53:21 risso Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.96 2002-08-26 09:36:20 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -189,12 +189,18 @@ static int print_int64(const u_int32_t *dp, int how)
                return (0);
        }
 #else
+       u_int32_t high;
+
+       high = (u_int32_t)ntohl(dp[0]);
+
        switch (how) {
        case SIGNED:
        case UNSIGNED:
        case HEX:
-               printf("0x%x%08x", (u_int32_t)ntohl(dp[0]),
-                   (u_int32_t)ntohl(dp[1]));
+               if (high != 0)
+                       printf("0x%x%08x", high, (u_int32_t)ntohl(dp[1]));
+               else
+                       printf("0x%x", (u_int32_t)ntohl(dp[1]));
                break;
        default:
                return (0);
@@ -757,6 +763,19 @@ nfs_printfh(register const u_int32_t *dp, const u_int len)
        const char *sfsname = NULL;
        char *spacep;
 
+       if (uflag) {
+               int i;
+               char const *sep = "";
+
+               printf(" fh[");
+               for (i=0; i<len; i++) {
+                       (void)printf("%s%x", sep, dp[i]);
+                       sep = ":";
+               }
+               printf("]");
+               return;
+       }
+
        Parse_fh((const u_char *)dp, len, &fsid, &ino, NULL, &sfsname, 0);
 
        if (sfsname) {
@@ -777,7 +796,7 @@ nfs_printfh(register const u_int32_t *dp, const u_int len)
                             fsid.Fsid_dev.Major, fsid.Fsid_dev.Minor);
        }
 
-       if(fsid.Fsid_dev.Minor == 257 && uflag)
+       if(fsid.Fsid_dev.Minor == 257)
                /* Print the undecoded handle */
                (void)printf("%s", fsid.Opaque_Handle);
        else
@@ -1065,9 +1084,9 @@ parsefattr(const u_int32_t *dp, int verbose, int v3)
                               (u_int32_t) ntohl(fap->fa3_rdev.specdata1),
                               (u_int32_t) ntohl(fap->fa3_rdev.specdata2));
                        printf("fsid ");
-                       print_int64((u_int32_t *)&fap->fa2_fsid, HEX);
+                       print_int64((u_int32_t *)&fap->fa3_fsid, HEX);
                        printf(" nodeid ");
-                       print_int64((u_int32_t *)&fap->fa2_fileid, HEX);
+                       print_int64((u_int32_t *)&fap->fa3_fileid, HEX);
                        printf(" a/m/ctime %u.%06u ",
                               (u_int32_t) ntohl(fap->fa3_atime.nfsv3_sec),
                               (u_int32_t) ntohl(fap->fa3_atime.nfsv3_nsec));