#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.86 2000-10-03 02:54:59 itojun 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>
-#ifdef INET6
-#include <netinet/ip6.h>
-#endif
+#include <tcpdump-stdinc.h>
#include <rpc/rpc.h>
-#include <ctype.h>
#include <pcap.h>
#include <stdio.h>
#include <string.h>
#include "nfsfh.h"
#include "ip.h"
+#ifdef INET6
+#include "ip6.h"
+#endif
static void nfs_printfh(const u_int32_t *, const u_int);
static void xid_map_enter(const struct rpc_msg *, const u_char *);
*
* 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
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:
{
my_fsid fsid;
ino_t ino;
- char *sfsname = NULL;
+ const char *sfsname = NULL;
+ char *spacep;
- Parse_fh((caddr_t*)dp, len, &fsid, &ino, NULL, &sfsname, 0);
+ Parse_fh((const u_char *)dp, len, &fsid, &ino, NULL, &sfsname, 0);
if (sfsname) {
/* file system ID is ASCII, not numeric, for this server OS */
strncpy(temp, sfsname, NFSX_V3FHMAX);
temp[sizeof(temp) - 1] = '\0';
/* Remove trailing spaces */
- sfsname = strchr(temp, ' ');
- if (sfsname)
- *sfsname = 0;
+ spacep = strchr(temp, ' ');
+ if (spacep)
+ *spacep = '\0';
(void)printf(" fh %s/", temp);
} else {
}
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);
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;
printf(" ERROR: %s",
tok2str(status2str, "unk %d", errnum));
nfserr = 1;
- return (NULL);
}
return (dp + 1);
trunc:
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);
}
{
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)
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(' ');
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);
return (0);
}
- TCHECK2(dp, (v3 ? NFSX_V3STATFS : NFSX_V2STATFS));
+ TCHECK2(*dp, (v3 ? NFSX_V3STATFS : NFSX_V2STATFS));
sfsp = (const struct nfs_statfs *)dp;
int er;
dp = parsestatus(dp, &er);
- if (dp == 0 || er)
+ if (dp == NULL)
return (0);
+ if (er)
+ return (1);
if (qflag)
return (1);
if (!ntohl(dp[0]))
return (dp + 1);
dp++;
- TCHECK2(dp, 24);
+ TCHECK2(*dp, 24);
if (verbose > 1) {
return parse_wcc_attr(dp);
} else {
(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
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
case NFSPROC_ACCESS:
printf(" access");
- dp = parserep(rp, length);
+ if (!(dp = parserep(rp, length)))
+ break;
if (!(dp = parsestatus(dp, &er)))
break;
if (vflag)