print-nfs: add versions of nfsreq_print and nfsreply_print that do not print dst/src addresses

This commit is contained in:
Longinus00 2013-10-28 15:52:51 -07:00 committed by Denis Ovsienko
parent 7781ecd3a2
commit 68fe98a0fb
2 changed files with 48 additions and 11 deletions

View File

@ -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);

View File

@ -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;