summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThordur I. Bjornsson <thib@cvs.openbsd.org>2007-06-29 11:39:26 +0000
committerThordur I. Bjornsson <thib@cvs.openbsd.org>2007-06-29 11:39:26 +0000
commit163634d5cf8f7e686b9403fce43fcb5c07f9aa97 (patch)
treec0d5fb6d3be792550113acfe57ed08e1fc437894
parent0d67c4a0bf8660310bdcc4c7674d7d306ab7c982 (diff)
make it easy to spot wich nfs version the traffic is.
input & OK canacar@
-rw-r--r--usr.sbin/tcpdump/nfs.h3
-rw-r--r--usr.sbin/tcpdump/print-nfs.c23
2 files changed, 20 insertions, 6 deletions
diff --git a/usr.sbin/tcpdump/nfs.h b/usr.sbin/tcpdump/nfs.h
index 23323d091dd..90d053a16a5 100644
--- a/usr.sbin/tcpdump/nfs.h
+++ b/usr.sbin/tcpdump/nfs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs.h,v 1.4 2003/06/02 23:36:54 millert Exp $ */
+/* $OpenBSD: nfs.h,v 1.5 2007/06/29 11:39:25 thib Exp $ */
/* $NetBSD: nfs.h,v 1.1 1996/05/23 22:49:53 fvdl Exp $ */
/*
@@ -50,6 +50,7 @@
#define NFS_PROG 100003
#define NFS_VER2 2
#define NFS_VER3 3
+#define NFS_VER4 4
#define NFS_V2MAXDATA 8192
#define NFS_MAXDGRAMDATA 16384
#define NFS_MAXDATA 32768
diff --git a/usr.sbin/tcpdump/print-nfs.c b/usr.sbin/tcpdump/print-nfs.c
index 4811258a7e2..006e8e209bf 100644
--- a/usr.sbin/tcpdump/print-nfs.c
+++ b/usr.sbin/tcpdump/print-nfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-nfs.c,v 1.14 2005/05/24 02:38:25 moritz Exp $ */
+/* $OpenBSD: print-nfs.c,v 1.15 2007/06/29 11:39:25 thib Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -94,6 +94,14 @@ u_int32_t nfsv3_procid[NFS_NPROCS] = {
NFSPROC_NOOP
};
+
+static struct tok nfsvers2str[] = {
+ { NFS_VER2, "NFSv2" },
+ { NFS_VER3, "NFSv3" },
+ { NFS_VER4, "NFSv4" },
+ { 0, NULL }
+};
+
/*
* NFS V2 and V3 status values.
*
@@ -408,17 +416,22 @@ nfsreq_print(register const u_char *bp, u_int length,
register const struct rpc_msg *rp;
register const u_int32_t *dp;
nfstype type;
- int v3;
+ int vers;
+ int v3 = 0;
u_int32_t proc;
struct nfsv3_sattr sa3;
nfserr = 0; /* assume no error */
rp = (const struct rpc_msg *)bp;
- printf("xid 0x%x %d", (u_int32_t)ntohl(rp->rm_xid), length);
- xid_map_enter(rp, bp2); /* record proc number for later on */
+ vers = ntohl(rp->rm_call.cb_vers);
+ if (vers == NFS_VER3)
+ v3 = 1;
+
+ printf("xid 0x%x (%s) %d", (u_int32_t)ntohl(rp->rm_xid),
+ tok2str(nfsvers2str, "Unk %i", vers), length);
- v3 = (ntohl(rp->rm_call.cb_vers) == NFS_VER3);
+ xid_map_enter(rp, bp2); /* record proc number for later on */
proc = ntohl(rp->rm_call.cb_proc);
if (!v3 && proc < NFS_NPROCS)