diff options
author | bms <bms@FreeBSD.org> | 2004-03-31 14:57:24 +0000 |
---|---|---|
committer | bms <bms@FreeBSD.org> | 2004-03-31 14:57:24 +0000 |
commit | 55b12ee1997869e5aed19e4145ad34c6d874a423 (patch) | |
tree | 5b810dd82a76f16819dd3cc55ffa53ff444b2d5a /contrib/tcpdump/print-sunrpc.c | |
parent | 34f833a812abe250ad28d7dadb1fdc086b1d4ecd (diff) | |
download | FreeBSD-src-55b12ee1997869e5aed19e4145ad34c6d874a423.zip FreeBSD-src-55b12ee1997869e5aed19e4145ad34c6d874a423.tar.gz |
Merge of tcpdump 3.8.3 from tcpdump.org, with the following caveats:
print-atm.c no longer performs special handling for FORE headers; these
can no doubt be re-added at a later date.
print-fr.c is effectively a no-op.
print-llc.c has had the default_print_unaligned() call removed as
tcpdump no longer defines this function, however the prototype is still
present. Suggest we roll in a diff to use print_unknown_data().
Diffstat (limited to 'contrib/tcpdump/print-sunrpc.c')
-rw-r--r-- | contrib/tcpdump/print-sunrpc.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/contrib/tcpdump/print-sunrpc.c b/contrib/tcpdump/print-sunrpc.c index 41d3bfb..83e16f0 100644 --- a/contrib/tcpdump/print-sunrpc.c +++ b/contrib/tcpdump/print-sunrpc.c @@ -22,33 +22,30 @@ */ #ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.39.6.1 2002/06/01 23:51:16 guy Exp $ (LBL)"; +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.43.2.2 2003/11/16 08:51:47 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include <sys/param.h> -#include <sys/time.h> -#include <sys/socket.h> - -#include <netinet/in.h> +#include <tcpdump-stdinc.h> #include <rpc/rpc.h> #ifdef HAVE_RPC_RPCENT_H #include <rpc/rpcent.h> #endif +#ifndef WIN32 #include <rpc/pmap_prot.h> +#endif /* WIN32 */ -#include <ctype.h> -#include <netdb.h> #include <stdio.h> #include <string.h> #include "interface.h" #include "addrtoname.h" +#include "extract.h" #include "ip.h" #ifdef INET6 @@ -84,11 +81,11 @@ sunrpcrequest_print(register const u_char *bp, register u_int length, if (!nflag) { snprintf(srcid, sizeof(srcid), "0x%x", - (u_int32_t)ntohl(rp->rm_xid)); + EXTRACT_32BITS(&rp->rm_xid)); strlcpy(dstid, "sunrpc", sizeof(dstid)); } else { snprintf(srcid, sizeof(srcid), "0x%x", - (u_int32_t)ntohl(rp->rm_xid)); + EXTRACT_32BITS(&rp->rm_xid)); snprintf(dstid, sizeof(dstid), "0x%x", PMAPPORT); } @@ -113,23 +110,23 @@ sunrpcrequest_print(register const u_char *bp, register u_int length, } printf(" %s", tok2str(proc2str, " proc #%u", - (u_int32_t)ntohl(rp->rm_call.cb_proc))); - x = ntohl(rp->rm_call.cb_rpcvers); + EXTRACT_32BITS(&rp->rm_call.cb_proc))); + x = EXTRACT_32BITS(&rp->rm_call.cb_rpcvers); if (x != 2) printf(" [rpcver %u]", x); - switch (ntohl(rp->rm_call.cb_proc)) { + switch (EXTRACT_32BITS(&rp->rm_call.cb_proc)) { case PMAPPROC_SET: case PMAPPROC_UNSET: case PMAPPROC_GETPORT: case PMAPPROC_CALLIT: - x = ntohl(rp->rm_call.cb_prog); + x = EXTRACT_32BITS(&rp->rm_call.cb_prog); if (!nflag) printf(" %s", progstr(x)); else printf(" %u", x); - printf(".%u", (u_int32_t)ntohl(rp->rm_call.cb_vers)); + printf(".%u", EXTRACT_32BITS(&rp->rm_call.cb_vers)); break; } } @@ -138,16 +135,22 @@ static char * progstr(prog) u_int32_t prog; { +#ifndef WIN32 register struct rpcent *rp; +#endif static char buf[32]; - static int lastprog = 0; + static u_int32_t lastprog = 0; if (lastprog != 0 && prog == lastprog) return (buf); +#ifndef WIN32 rp = getrpcbynumber(prog); if (rp == NULL) +#endif /* WIN32 */ (void) snprintf(buf, sizeof(buf), "#%u", prog); +#ifndef WIN32 else strlcpy(buf, rp->r_name, sizeof(buf)); +#endif return (buf); } |