aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLonginus00 <Longinus00@gmail.com>2013-10-28 15:52:51 -0700
committerDenis Ovsienko <infrastation@yandex.ru>2013-11-07 11:05:20 +0400
commit68fe98a0fbe192222cfbf7f57f0e1bf34a17baaa (patch)
treed48da8b982114dbd19a20bc643ee28f9cb776c08
parent7781ecd3a2fd0ba1c28f8f5caa5bbbcdbf99bb3f (diff)
downloadpublic-68fe98a0fbe192222cfbf7f57f0e1bf34a17baaa.tar.gz
print-nfs: add versions of nfsreq_print and nfsreply_print that do not print dst/src addresses
-rw-r--r--interface.h2
-rw-r--r--print-nfs.c57
2 files changed, 48 insertions, 11 deletions
diff --git a/interface.h b/interface.h
index b263b97..9732d39 100644
--- a/interface.h
+++ b/interface.h
@@ -233,7 +233,9 @@ extern u_int llap_print(const u_char *, u_int);
extern u_int ltalk_if_print(const struct pcap_pkthdr *, const u_char *);
extern void msdp_print(const unsigned char *, u_int);
extern void nfsreply_print(const u_char *, u_int, const u_char *);
+extern void nfsreply_print_noaddr(const u_char *, u_int, const u_char *);
extern void nfsreq_print(const u_char *, u_int, const u_char *);
+extern void nfsreq_print_noaddr(const u_char *, u_int, const u_char *);
extern void ns_print(const u_char *, u_int, int);
extern const u_char * ns_nprint (register const u_char *, register const u_char *);
extern void ntp_print(const u_char *, u_int);
diff --git a/print-nfs.c b/print-nfs.c
index 9f04e0b..5cd1adf 100644
--- a/print-nfs.c
+++ b/print-nfs.c
@@ -287,12 +287,7 @@ nfsreply_print(register const u_char *bp, u_int length,
register const u_char *bp2)
{
register const struct sunrpc_msg *rp;
- u_int32_t proc, vers, reply_stat;
char srcid[20], dstid[20]; /*fits 32bit*/
- enum sunrpc_reject_stat rstat;
- u_int32_t rlow;
- u_int32_t rhigh;
- enum sunrpc_auth_stat rwhy;
nfserr = 0; /* assume no error */
rp = (const struct sunrpc_msg *)bp;
@@ -308,6 +303,29 @@ nfsreply_print(register const u_char *bp, u_int length,
EXTRACT_32BITS(&rp->rm_xid));
}
print_nfsaddr(bp2, srcid, dstid);
+
+ nfsreply_print_noaddr(bp, length, bp2);
+ return;
+
+trunc:
+ if (!nfserr)
+ fputs(" [|nfs]", stdout);
+}
+
+void
+nfsreply_print_noaddr(register const u_char *bp, u_int length,
+ register const u_char *bp2)
+{
+ register const struct sunrpc_msg *rp;
+ u_int32_t proc, vers, reply_stat;
+ enum sunrpc_reject_stat rstat;
+ u_int32_t rlow;
+ u_int32_t rhigh;
+ enum sunrpc_auth_stat rwhy;
+
+ nfserr = 0; /* assume no error */
+ rp = (const struct sunrpc_msg *)bp;
+
TCHECK(rp->rm_reply.rp_stat);
reply_stat = EXTRACT_32BITS(&rp->rm_reply.rp_stat);
switch (reply_stat) {
@@ -504,12 +522,6 @@ nfsreq_print(register const u_char *bp, u_int length,
register const u_char *bp2)
{
register const struct sunrpc_msg *rp;
- register const u_int32_t *dp;
- nfs_type type;
- int v3;
- u_int32_t proc;
- u_int32_t access_flags;
- struct nfsv3_sattr sa3;
char srcid[20], dstid[20]; /*fits 32bit*/
nfserr = 0; /* assume no error */
@@ -528,6 +540,29 @@ nfsreq_print(register const u_char *bp, u_int length,
print_nfsaddr(bp2, srcid, dstid);
(void)printf("%d", length);
+ nfsreq_print_noaddr(bp, length, bp2);
+ return;
+
+trunc:
+ if (!nfserr)
+ fputs(" [|nfs]", stdout);
+}
+
+void
+nfsreq_print_noaddr(register const u_char *bp, u_int length,
+ register const u_char *bp2)
+{
+ register const struct sunrpc_msg *rp;
+ register const u_int32_t *dp;
+ nfs_type type;
+ int v3;
+ u_int32_t proc;
+ u_int32_t access_flags;
+ struct nfsv3_sattr sa3;
+
+ nfserr = 0; /* assume no error */
+ rp = (const struct sunrpc_msg *)bp;
+
if (!xid_map_enter(rp, bp2)) /* record proc number for later on */
goto trunc;