]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-nfs.c
Clean up comments.
[tcpdump] / print-nfs.c
index c295fd7a8f7a79653747012a61cf49c19d700c4e..b02438be15a127dfc3153ffa45db368024776c46 100644 (file)
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.91 2002-04-24 06:27:06 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.95 2002-08-01 08:53:21 risso Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-
-struct mbuf;
-struct rtentry;
-
-#include <netinet/in.h>
+#include <tcpdump-stdinc.h>
 
 #include <rpc/rpc.h>
 
-#include <ctype.h>
 #include <pcap.h>
 #include <stdio.h>
 #include <string.h>
@@ -171,7 +163,7 @@ static struct tok type2str[] = {
  *
  * Assume that a system that has INT64_FORMAT defined, has a 64-bit
  * integer datatype and can print it.
- */ 
+ */
 
 #define UNSIGNED 0
 #define SIGNED   1
@@ -716,10 +708,16 @@ nfsreq_print(register const u_char *bp, u_int length,
 
        case NFSPROC_FSINFO:
                printf(" fsinfo");
+               if ((dp = parsereq(rp, length)) != NULL &&
+                   parsefh(dp, v3) != NULL)
+                       return;
                break;
 
        case NFSPROC_PATHCONF:
                printf(" pathconf");
+               if ((dp = parsereq(rp, length)) != NULL &&
+                   parsefh(dp, v3) != NULL)
+                       return;
                break;
 
        case NFSPROC_COMMIT:
@@ -780,7 +778,7 @@ nfs_printfh(register const u_int32_t *dp, const u_int len)
        }
 
        if(fsid.Fsid_dev.Minor == 257 && uflag)
-               /* Print the undecoded handle */ 
+               /* Print the undecoded handle */
                (void)printf("%s", fsid.Opaque_Handle);
        else
                (void)printf("%ld", (long) ino);
@@ -881,7 +879,7 @@ xid_map_find(const struct rpc_msg *rp, const u_char *bp, u_int32_t *proc,
        int cmp;
 
        /* Start searching from where we last left off */
-       i = xid_map_hint; 
+       i = xid_map_hint;
        do {
                xmep = &xid_map[i];
                cmp = 1;
@@ -1028,7 +1026,6 @@ parsestatus(const u_int32_t *dp, int *er)
                        printf(" ERROR: %s",
                            tok2str(status2str, "unk %d", errnum));
                nfserr = 1;
-               return (NULL);
        }
        return (dp + 1);
 trunc:
@@ -1110,8 +1107,10 @@ parseattrstat(const u_int32_t *dp, int verbose, int v3)
        int er;
 
        dp = parsestatus(dp, &er);
-       if (dp == NULL || er)
+       if (dp == NULL)
                return (0);
+       if (er)
+               return (1);
 
        return (parsefattr(dp, verbose, v3) != NULL);
 }
@@ -1121,8 +1120,10 @@ parsediropres(const u_int32_t *dp)
 {
        int er;
 
-       if (!(dp = parsestatus(dp, &er)) || er)
+       if (!(dp = parsestatus(dp, &er)))
                return (0);
+       if (er)
+               return (1);
 
        dp = parsefh(dp, 0);
        if (dp == NULL)
@@ -1137,8 +1138,10 @@ parselinkres(const u_int32_t *dp, int v3)
        int er;
 
        dp = parsestatus(dp, &er);
-       if (dp == NULL || er)
+       if (dp == NULL)
                return(0);
+       if (er)
+               return(1);
        if (v3 && !(dp = parse_post_op_attr(dp, vflag)))
                return (0);
        putchar(' ');
@@ -1152,8 +1155,10 @@ parsestatfs(const u_int32_t *dp, int v3)
        int er;
 
        dp = parsestatus(dp, &er);
-       if (dp == NULL || (!v3 && er))
+       if (dp == NULL)
                return (0);
+       if (!v3 && er)
+               return (1);
 
        if (qflag)
                return(1);
@@ -1165,7 +1170,7 @@ parsestatfs(const u_int32_t *dp, int v3)
                        return (0);
        }
 
-       TCHECK2(dp, (v3 ? NFSX_V3STATFS : NFSX_V2STATFS));
+       TCHECK2(*dp, (v3 ? NFSX_V3STATFS : NFSX_V2STATFS));
 
        sfsp = (const struct nfs_statfs *)dp;
 
@@ -1206,8 +1211,10 @@ parserddires(const u_int32_t *dp)
        int er;
 
        dp = parsestatus(dp, &er);
-       if (dp == NULL || er)
+       if (dp == NULL)
                return (0);
+       if (er)
+               return (1);
        if (qflag)
                return (1);
 
@@ -1243,7 +1250,7 @@ parse_pre_op_attr(const u_int32_t *dp, int verbose)
        if (!ntohl(dp[0]))
                return (dp + 1);
        dp++;
-       TCHECK2(dp, 24);
+       TCHECK2(*dp, 24);
        if (verbose > 1) {
                return parse_wcc_attr(dp);
        } else {
@@ -1380,9 +1387,9 @@ parsefsinfo(const u_int32_t *dp)
                       (u_int32_t) ntohl(sfp->fs_timedelta.nfsv3_sec),
                       (u_int32_t) ntohl(sfp->fs_timedelta.nfsv3_nsec));
        }
-       return (0);
-trunc:
        return (1);
+trunc:
+       return (0);
 }
 
 static int
@@ -1410,9 +1417,9 @@ parsepathconf(const u_int32_t *dp)
               ntohl(spp->pc_chownrestricted) ? "chownres" : "",
               ntohl(spp->pc_caseinsensitive) ? "igncase" : "",
               ntohl(spp->pc_casepreserving) ? "keepcase" : "");
-       return (0);
-trunc:
        return (1);
+trunc:
+       return (0);
 }
 
 static void