IPv6 support for sunrpc. from tcpdump.org.
This commit is contained in:
parent
68706c1c57
commit
b2ffcc0e07
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-sunrpc.c,v 1.5 1997/10/03 19:55:45 christos Exp $ */
|
||||
/* $NetBSD: print-sunrpc.c,v 1.6 2000/06/10 05:39:16 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994, 1995, 1996
|
||||
|
@ -27,7 +27,7 @@
|
|||
static const char rcsid[] =
|
||||
"@(#) Header: print-sunrpc.c,v 1.26 96/12/31 21:27:43 leres Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-sunrpc.c,v 1.5 1997/10/03 19:55:45 christos Exp $");
|
||||
__RCSID("$NetBSD: print-sunrpc.c,v 1.6 2000/06/10 05:39:16 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -50,6 +50,9 @@ struct rtentry;
|
|||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#ifdef INET6
|
||||
#include <netinet/ip6.h>
|
||||
#endif
|
||||
|
||||
#include <rpc/rpc.h>
|
||||
#ifdef HAVE_RPC_RPCENT_H
|
||||
|
@ -84,24 +87,44 @@ sunrpcrequest_print(register const u_char *bp, register u_int length,
|
|||
{
|
||||
register const struct rpc_msg *rp;
|
||||
register const struct ip *ip;
|
||||
#ifdef INET6
|
||||
register const struct ip6_hdr *ip6;
|
||||
#endif
|
||||
u_int32_t x;
|
||||
char srcid[20], dstid[20]; /*fits 32bit*/
|
||||
|
||||
rp = (struct rpc_msg *)bp;
|
||||
ip = (struct ip *)bp2;
|
||||
|
||||
if (!nflag)
|
||||
(void)printf("%s.%x > %s.sunrpc: %d",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
(u_int32_t)ntohl(rp->rm_xid),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
length);
|
||||
else
|
||||
(void)printf("%s.%x > %s.%x: %d",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
(u_int32_t)ntohl(rp->rm_xid),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
PMAPPORT,
|
||||
length);
|
||||
if (!nflag) {
|
||||
snprintf(srcid, sizeof(srcid), "0x%x",
|
||||
(u_int32_t)ntohl(rp->rm_xid));
|
||||
strlcpy(dstid, "sunrpc", sizeof(dstid));
|
||||
} else {
|
||||
snprintf(srcid, sizeof(srcid), "0x%x",
|
||||
(u_int32_t)ntohl(rp->rm_xid));
|
||||
snprintf(dstid, sizeof(dstid), "0x%x", PMAPPORT);
|
||||
}
|
||||
|
||||
switch (((struct ip *)bp2)->ip_v) {
|
||||
case 4:
|
||||
ip = (struct ip *)bp2;
|
||||
printf("%s.%s > %s.%s: %d",
|
||||
ipaddr_string(&ip->ip_src), srcid,
|
||||
ipaddr_string(&ip->ip_dst), dstid, length);
|
||||
break;
|
||||
#ifdef INET6
|
||||
case 6:
|
||||
ip6 = (struct ip6_hdr *)bp2;
|
||||
printf("%s.%s > %s.%s: %d",
|
||||
ip6addr_string(&ip6->ip6_src), srcid,
|
||||
ip6addr_string(&ip6->ip6_dst), dstid, length);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
printf("%s.%s > %s.%s: %d", "?", srcid, "?", dstid, length);
|
||||
break;
|
||||
}
|
||||
|
||||
printf(" %s", tok2str(proc2str, " proc #%u",
|
||||
(u_int32_t)ntohl(rp->rm_call.cb_proc)));
|
||||
x = ntohl(rp->rm_call.cb_rpcvers);
|
||||
|
@ -136,8 +159,8 @@ progstr(prog)
|
|||
return (buf);
|
||||
rp = getrpcbynumber(prog);
|
||||
if (rp == NULL)
|
||||
(void) sprintf(buf, "#%u", prog);
|
||||
(void) snprintf(buf, sizeof(buf), "#%u", prog);
|
||||
else
|
||||
strcpy(buf, rp->r_name);
|
||||
strlcpy(buf, rp->r_name, sizeof(buf));
|
||||
return (buf);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue