summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguy <guy>2004-12-27 00:41:29 +0000
committerguy <guy>2004-12-27 00:41:29 +0000
commitaf0a0390800cfa503d499b77a1545639284ebbc6 (patch)
treebaf46552e1af0202f779610380b739ec74c4b3bc
parent5561f2117cbcadfa9f82ea5f7e44cf789203df26 (diff)
downloadtcpdump-af0a0390800cfa503d499b77a1545639284ebbc6.tar.gz
Have our own headers to declare the format of ONC (Sun) RPC messages on
the wire; the definitions in many systems use u_long, which is 64 bits long on many platforms - that's OK for in-memory structures, but it doesn't match what's on the wire. Use headers based on the Sun ones, but use u_int32_t for fields, and otherwise make the structures match what's on the wire, and change some names to avoid collision with <rpc/rpc.h>, which print-sunrpc.c includes to declare "getrpcbynumber()" and the structure it returns. Record whether "getrpcbynumber()" is found, and use it only if it's found, rather than basing the decisison on whether we're building for Win32 or not.
-rw-r--r--FILES4
-rw-r--r--INSTALL5
-rw-r--r--acconfig.h3
-rw-r--r--configure.in8
-rw-r--r--pmap_prot.h94
-rw-r--r--print-nfs.c50
-rw-r--r--print-sunrpc.c25
-rw-r--r--print-tcp.c10
-rw-r--r--print-udp.c30
-rw-r--r--rpc_auth.h84
-rw-r--r--rpc_msg.h133
-rw-r--r--win32/Include/Rpc/rpc.h157
12 files changed, 384 insertions, 219 deletions
diff --git a/FILES b/FILES
index ea319bdd..2479f270 100644
--- a/FILES
+++ b/FILES
@@ -105,6 +105,7 @@ packetdat.awk
parsenfsfh.c
pcap-missing.h
pf.h
+pmap_prot.h
ppp.h
print-802_11.c
print-ah.c
@@ -203,6 +204,8 @@ print-vrrp.c
print-wb.c
print-zephyr.c
route6d.h
+rpc_auth.h
+rpc_msg.h
rx.h
sctpConstants.h
sctpHeader.h
@@ -234,7 +237,6 @@ win32/Include/telnet.h
win32/Include/w32_fzs.h
win32/Include/Netinet/in_systm.h
win32/Include/Netinet/ip.h
-win32/Include/Rpc/rpc.h
win32/Src/getopt.c
win32/prj/GNUmakefile
win32/prj/WinDump.dsp
diff --git a/INSTALL b/INSTALL
index 8ac4f190..fb3a43f8 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,4 +1,4 @@
-@(#) $Header: /tcpdump/master/tcpdump/Attic/INSTALL,v 1.62 2004-10-11 21:27:43 guy Exp $ (LBL)
+@(#) $Header: /tcpdump/master/tcpdump/Attic/INSTALL,v 1.63 2004-12-27 00:41:29 guy Exp $ (LBL)
If you have not built libpcap, do so first. See the README
file in this directory for the ftp location.
@@ -126,6 +126,7 @@ packetdat.awk - TCP chunk summary awk script
parsenfsfh.c - Network File System file parser routines
pcap-missing.h - declarations of functions possibly missing from libpcap
pf.h - OpenBSD PF definitions
+pmap_prot.h - definitions for ONC RPC portmapper protocol
ppp.h - Point to Point Protocol definitions
print-802_11.c - IEEE 802.11 printer routines
print-ap1394.c - Apple IP-over-IEEE 1394 printer routines
@@ -217,6 +218,8 @@ print-vrrp.c - Virtual Router Redundancy Protocol
print-wb.c - White Board printer routines
print-zephyr.c - Zephyr printer routines
route6d.h - packet definition for IPv6 Routing Information Protocol
+rpc_auth.h - definitions for ONC RPC authentication
+rpc_msg.h - definitions for ONC RPC messages
rx.h - AFS RX definitions
sctpConstants.h - Stream Control Transmission Protocol constant definitions
sctpHeader.h - Stream Control Transmission Protocol packet definitions
diff --git a/acconfig.h b/acconfig.h
index 3027457e..4a743b8b 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -88,6 +88,9 @@
/* define if libpcap has pcap_datalink_val_to_description() */
#undef HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION
+/* define if you have getrpcbynumber() */
+#undef HAVE_GETRPCBYNUMBER
+
/* define if unaligned memory accesses fail */
#undef LBL_ALIGN
diff --git a/configure.in b/configure.in
index b9d942fa..df4a0a15 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.182 2004-08-27 07:17:04 guy Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.183 2004-12-27 00:41:30 guy Exp $ (LBL)
dnl
dnl Copyright (c) 1994, 1995, 1996, 1997
dnl The Regents of the University of California. All rights reserved.
@@ -6,7 +6,7 @@ dnl
dnl Process this file with autoconf to produce a configure script.
dnl
-AC_REVISION($Revision: 1.182 $)
+AC_REVISION($Revision: 1.183 $)
AC_PREREQ(2.50)
AC_INIT(tcpdump.c)
@@ -533,8 +533,8 @@ AC_SEARCH_LIBS(dnet_htoa, dnet, AC_DEFINE(HAVE_DNET_HTOA))
AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc
-dnl HP/UX may need -lnsl for getrpcbynumber.
-AC_SEARCH_LIBS(getrpcbynumber, nsl)
+dnl Some platforms may need -lnsl for getrpcbynumber.
+AC_SEARCH_LIBS(getrpcbynumber, nsl, AC_DEFINE(HAVE_GETRPCBYNUMBER))
dnl AC_CHECK_LIB(z, uncompress)
dnl AC_CHECK_HEADERS(zlib.h)
diff --git a/pmap_prot.h b/pmap_prot.h
new file mode 100644
index 00000000..76a47f4d
--- /dev/null
+++ b/pmap_prot.h
@@ -0,0 +1,94 @@
+/* @(#) $Header: /tcpdump/master/tcpdump/pmap_prot.h,v 1.1 2004-12-27 00:41:30 guy Exp $ (LBL) */
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ *
+ * from: @(#)pmap_prot.h 1.14 88/02/08 SMI
+ * from: @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC
+ * $FreeBSD: src/include/rpc/pmap_prot.h,v 1.9.2.1 1999/08/29 14:39:05 peter Exp $
+ */
+
+/*
+ * pmap_prot.h
+ * Protocol for the local binder service, or pmap.
+ *
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ *
+ * The following procedures are supported by the protocol:
+ *
+ * PMAPPROC_NULL() returns ()
+ * takes nothing, returns nothing
+ *
+ * PMAPPROC_SET(struct pmap) returns (bool_t)
+ * TRUE is success, FALSE is failure. Registers the tuple
+ * [prog, vers, prot, port].
+ *
+ * PMAPPROC_UNSET(struct pmap) returns (bool_t)
+ * TRUE is success, FALSE is failure. Un-registers pair
+ * [prog, vers]. prot and port are ignored.
+ *
+ * PMAPPROC_GETPORT(struct pmap) returns (long unsigned).
+ * 0 is failure. Otherwise returns the port number where the pair
+ * [prog, vers] is registered. It may lie!
+ *
+ * PMAPPROC_DUMP() RETURNS (struct pmaplist *)
+ *
+ * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>)
+ * RETURNS (port, string<>);
+ * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs);
+ * Calls the procedure on the local machine. If it is not registered,
+ * this procedure is quite; ie it does not return error information!!!
+ * This procedure only is supported on rpc/udp and calls via
+ * rpc/udp. This routine only passes null authentication parameters.
+ * This file has no interface to xdr routines for PMAPPROC_CALLIT.
+ *
+ * The service supports remote procedure calls on udp/ip or tcp/ip socket 111.
+ */
+
+#ifndef _RPC_PMAPPROT_H
+#define _RPC_PMAPPROT_H
+
+#define PMAPPORT ((u_int16_t)111)
+#define PMAPPROG ((u_int32_t)100000)
+#define PMAPVERS ((u_int32_t)2)
+#define PMAPVERS_PROTO ((u_int32_t)2)
+#define PMAPVERS_ORIG ((u_int32_t)1)
+#define PMAPPROC_NULL ((u_int32_t)0)
+#define PMAPPROC_SET ((u_int32_t)1)
+#define PMAPPROC_UNSET ((u_int32_t)2)
+#define PMAPPROC_GETPORT ((u_int32_t)3)
+#define PMAPPROC_DUMP ((u_int32_t)4)
+#define PMAPPROC_CALLIT ((u_int32_t)5)
+
+struct pmap {
+ u_int32_t pm_prog;
+ u_int32_t pm_vers;
+ u_int32_t pm_prot;
+ u_int32_t pm_port;
+};
+
+#endif /* !_RPC_PMAPPROT_H */
diff --git a/print-nfs.c b/print-nfs.c
index 4a2d1f3e..6c528b7c 100644
--- a/print-nfs.c
+++ b/print-nfs.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.103 2004-09-24 18:21:25 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.104 2004-12-27 00:41:31 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -30,8 +30,6 @@ static const char rcsid[] _U_ =
#include <tcpdump-stdinc.h>
-#include <rpc/rpc.h>
-
#include <pcap.h>
#include <stdio.h>
#include <string.h>
@@ -47,12 +45,14 @@ static const char rcsid[] _U_ =
#ifdef INET6
#include "ip6.h"
#endif
+#include "rpc_auth.h"
+#include "rpc_msg.h"
static void nfs_printfh(const u_int32_t *, const u_int);
-static void xid_map_enter(const struct rpc_msg *, const u_char *);
-static int32_t xid_map_find(const struct rpc_msg *, const u_char *,
+static void xid_map_enter(const struct sunrpc_msg *, const u_char *);
+static int32_t xid_map_find(const struct sunrpc_msg *, const u_char *,
u_int32_t *, u_int32_t *);
-static void interp_reply(const struct rpc_msg *, u_int32_t, u_int32_t, int);
+static void interp_reply(const struct sunrpc_msg *, u_int32_t, u_int32_t, int);
static const u_int32_t *parse_post_op_attr(const u_int32_t *, int);
static void print_sattr3(const struct nfsv3_sattr *sa3, int verbose);
static int print_int64(const u_int32_t *dp, int how);
@@ -321,12 +321,12 @@ void
nfsreply_print(register const u_char *bp, u_int length,
register const u_char *bp2)
{
- register const struct rpc_msg *rp;
+ register const struct sunrpc_msg *rp;
u_int32_t proc, vers;
char srcid[20], dstid[20]; /*fits 32bit*/
nfserr = 0; /* assume no error */
- rp = (const struct rpc_msg *)bp;
+ rp = (const struct sunrpc_msg *)bp;
if (!nflag) {
strlcpy(srcid, "nfs", sizeof(srcid));
@@ -339,9 +339,9 @@ nfsreply_print(register const u_char *bp, u_int length,
}
print_nfsaddr(bp2, srcid, dstid);
(void)printf("reply %s %d",
- EXTRACT_32BITS(&rp->rm_reply.rp_stat) == MSG_ACCEPTED?
- "ok":"ERR",
- length);
+ EXTRACT_32BITS(&rp->rm_reply.rp_stat) == SUNRPC_MSG_ACCEPTED?
+ "ok":"ERR",
+ length);
if (xid_map_find(rp, bp2, &proc, &vers) >= 0)
interp_reply(rp, proc, vers, length);
@@ -352,7 +352,7 @@ nfsreply_print(register const u_char *bp, u_int length,
* If the packet was truncated, return 0.
*/
static const u_int32_t *
-parsereq(register const struct rpc_msg *rp, register u_int length)
+parsereq(register const struct sunrpc_msg *rp, register u_int length)
{
register const u_int32_t *dp;
register u_int len;
@@ -452,7 +452,7 @@ void
nfsreq_print(register const u_char *bp, u_int length,
register const u_char *bp2)
{
- register const struct rpc_msg *rp;
+ register const struct sunrpc_msg *rp;
register const u_int32_t *dp;
nfs_type type;
int v3;
@@ -461,7 +461,7 @@ nfsreq_print(register const u_char *bp, u_int length,
char srcid[20], dstid[20]; /*fits 32bit*/
nfserr = 0; /* assume no error */
- rp = (const struct rpc_msg *)bp;
+ rp = (const struct sunrpc_msg *)bp;
if (!nflag) {
snprintf(srcid, sizeof(srcid), "%u",
EXTRACT_32BITS(&rp->rm_xid));
@@ -840,7 +840,7 @@ int xid_map_next = 0;
int xid_map_hint = 0;
static void
-xid_map_enter(const struct rpc_msg *rp, const u_char *bp)
+xid_map_enter(const struct sunrpc_msg *rp, const u_char *bp)
{
struct ip *ip = NULL;
#ifdef INET6
@@ -888,7 +888,7 @@ xid_map_enter(const struct rpc_msg *rp, const u_char *bp)
* version in vers return, or returns -1 on failure
*/
static int
-xid_map_find(const struct rpc_msg *rp, const u_char *bp, u_int32_t *proc,
+xid_map_find(const struct sunrpc_msg *rp, const u_char *bp, u_int32_t *proc,
u_int32_t *vers)
{
int i;
@@ -955,11 +955,11 @@ xid_map_find(const struct rpc_msg *rp, const u_char *bp, u_int32_t *proc,
* If the packet was truncated, return 0.
*/
static const u_int32_t *
-parserep(register const struct rpc_msg *rp, register u_int length)
+parserep(register const struct sunrpc_msg *rp, register u_int length)
{
register const u_int32_t *dp;
u_int len;
- enum accept_stat astat;
+ enum sunrpc_accept_stat astat;
/*
* Portability note:
@@ -993,30 +993,30 @@ parserep(register const struct rpc_msg *rp, register u_int length)
astat = EXTRACT_32BITS(dp);
switch (astat) {
- case SUCCESS:
+ case SUNRPC_SUCCESS:
break;
- case PROG_UNAVAIL:
+ case SUNRPC_PROG_UNAVAIL:
printf(" PROG_UNAVAIL");
nfserr = 1; /* suppress trunc string */
return (NULL);
- case PROG_MISMATCH:
+ case SUNRPC_PROG_MISMATCH:
printf(" PROG_MISMATCH");
nfserr = 1; /* suppress trunc string */
return (NULL);
- case PROC_UNAVAIL:
+ case SUNRPC_PROC_UNAVAIL:
printf(" PROC_UNAVAIL");
nfserr = 1; /* suppress trunc string */
return (NULL);
- case GARBAGE_ARGS:
+ case SUNRPC_GARBAGE_ARGS:
printf(" GARBAGE_ARGS");
nfserr = 1; /* suppress trunc string */
return (NULL);
- case SYSTEM_ERR:
+ case SUNRPC_SYSTEM_ERR:
printf(" SYSTEM_ERR");
nfserr = 1; /* suppress trunc string */
return (NULL);
@@ -1444,7 +1444,7 @@ trunc:
}
static void
-interp_reply(const struct rpc_msg *rp, u_int32_t proc, u_int32_t vers, int length)
+interp_reply(const struct sunrpc_msg *rp, u_int32_t proc, u_int32_t vers, int length)
{
register const u_int32_t *dp;
register int v3;
diff --git a/print-sunrpc.c b/print-sunrpc.c
index b0a3a2d0..58e6112a 100644
--- a/print-sunrpc.c
+++ b/print-sunrpc.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.45 2003-11-16 09:36:39 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.46 2004-12-27 00:41:31 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -30,13 +30,12 @@ static const char rcsid[] _U_ =
#include <tcpdump-stdinc.h>
+#ifdef HAVE_GETRPCBYNUMBER
#include <rpc/rpc.h>
#ifdef HAVE_RPC_RPCENT_H
#include <rpc/rpcent.h>
-#endif
-#ifndef WIN32
-#include <rpc/pmap_prot.h>
-#endif /* WIN32 */
+#endif /* HAVE_RPC_RPCENT_H */
+#endif /* HAVE_GETRPCBYNUMBER */
#include <stdio.h>
#include <string.h>
@@ -50,6 +49,10 @@ static const char rcsid[] _U_ =
#include "ip6.h"
#endif
+#include "rpc_auth.h"
+#include "rpc_msg.h"
+#include "pmap_prot.h"
+
static struct tok proc2str[] = {
{ PMAPPROC_NULL, "null" },
{ PMAPPROC_SET, "set" },
@@ -67,7 +70,7 @@ void
sunrpcrequest_print(register const u_char *bp, register u_int length,
register const u_char *bp2)
{
- register const struct rpc_msg *rp;
+ register const struct sunrpc_msg *rp;
register const struct ip *ip;
#ifdef INET6
register const struct ip6_hdr *ip6;
@@ -75,7 +78,7 @@ sunrpcrequest_print(register const u_char *bp, register u_int length,
u_int32_t x;
char srcid[20], dstid[20]; /*fits 32bit*/
- rp = (struct rpc_msg *)bp;
+ rp = (struct sunrpc_msg *)bp;
if (!nflag) {
snprintf(srcid, sizeof(srcid), "0x%x",
@@ -133,7 +136,7 @@ static char *
progstr(prog)
u_int32_t prog;
{
-#ifndef WIN32
+#ifdef HAVE_GETRPCBYNUMBER
register struct rpcent *rp;
#endif
static char buf[32];
@@ -141,12 +144,12 @@ progstr(prog)
if (lastprog != 0 && prog == lastprog)
return (buf);
-#ifndef WIN32
+#ifdef HAVE_GETRPCBYNUMBER
rp = getrpcbynumber(prog);
if (rp == NULL)
-#endif /* WIN32 */
+#endif
(void) snprintf(buf, sizeof(buf), "#%u", prog);
-#ifndef WIN32
+#ifdef HAVE_GETRPCBYNUMBER
else
strlcpy(buf, rp->r_name, sizeof(buf));
#endif
diff --git a/print-tcp.c b/print-tcp.c
index fce2cc4e..025e50d2 100644
--- a/print-tcp.c
+++ b/print-tcp.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.118 2004-09-15 01:21:17 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.119 2004-12-27 00:41:31 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -30,8 +30,6 @@ static const char rcsid[] _U_ =
#include <tcpdump-stdinc.h>
-#include <rpc/rpc.h>
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -47,6 +45,8 @@ static const char rcsid[] _U_ =
#include "ip6.h"
#endif
#include "ipproto.h"
+#include "rpc_auth.h"
+#include "rpc_msg.h"
#include "nameser.h"
@@ -229,12 +229,12 @@ tcp_print(register const u_char *bp, register u_int length,
* to NFS print routines.
*/
if (!qflag && hlen >= sizeof(*tp) && hlen <= length) {
- if ((u_char *)tp + 4 + sizeof(struct rpc_msg) <= snapend &&
+ if ((u_char *)tp + 4 + sizeof(struct sunrpc_msg) <= snapend &&
dport == NFS_PORT) {
nfsreq_print((u_char *)tp + hlen + 4, length - hlen,
(u_char *)ip);
return;
- } else if ((u_char *)tp + 4 + sizeof(struct rpc_msg)
+ } else if ((u_char *)tp + 4 + sizeof(struct sunrpc_msg)
<= snapend &&
sport == NFS_PORT) {
nfsreply_print((u_char *)tp + hlen + 4, length - hlen,
diff --git a/print-udp.c b/print-udp.c
index 1875dc8c..3a8d1000 100644
--- a/print-udp.c
+++ b/print-udp.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.134 2004-10-29 11:42:54 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.135 2004-12-27 00:41:32 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -35,8 +35,6 @@ static const char rcsid[] _U_ =
#endif
#include <arpa/tftp.h>
-#include <rpc/rpc.h>
-
#include <stdio.h>
#include <string.h>
@@ -52,6 +50,8 @@ static const char rcsid[] _U_ =
#include "ip6.h"
#endif
#include "ipproto.h"
+#include "rpc_auth.h"
+#include "rpc_msg.h"
#include "nameser.h"
#include "nfs.h"
@@ -468,8 +468,8 @@ udp_print(register const u_char *bp, u_int length,
return;
}
if (packettype) {
- register struct rpc_msg *rp;
- enum msg_type direction;
+ register struct sunrpc_msg *rp;
+ enum sunrpc_msg_type direction;
switch (packettype) {
@@ -484,9 +484,9 @@ udp_print(register const u_char *bp, u_int length,
break;
case PT_RPC:
- rp = (struct rpc_msg *)(up + 1);
- direction = (enum msg_type)EXTRACT_32BITS(&rp->rm_direction);
- if (direction == CALL)
+ rp = (struct sunrpc_msg *)(up + 1);
+ direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
+ if (direction == SUNRPC_CALL)
sunrpcrequest_print((u_char *)rp, length,
(u_char *)ip);
else
@@ -534,24 +534,24 @@ udp_print(register const u_char *bp, u_int length,
}
if (!qflag) {
- register struct rpc_msg *rp;
- enum msg_type direction;
+ register struct sunrpc_msg *rp;
+ enum sunrpc_msg_type direction;
- rp = (struct rpc_msg *)(up + 1);
+ rp = (struct sunrpc_msg *)(up + 1);
if (TTEST(rp->rm_direction)) {
- direction = (enum msg_type)EXTRACT_32BITS(&rp->rm_direction);
- if (dport == NFS_PORT && direction == CALL) {
+ direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
+ if (dport == NFS_PORT && direction == SUNRPC_CALL) {
nfsreq_print((u_char *)rp, length,
(u_char *)ip);
return;
}
- if (sport == NFS_PORT && direction == REPLY) {
+ if (sport == NFS_PORT && direction == SUNRPC_REPLY) {
nfsreply_print((u_char *)rp, length,
(u_char *)ip);
return;
}
#ifdef notdef
- if (dport == SUNRPC_PORT && direction == CALL) {
+ if (dport == SUNRPC_PORT && direction == SUNRPC_CALL) {
sunrpcrequest_print((u_char *)rp, length, (u_char *)ip);
return;
}
diff --git a/rpc_auth.h b/rpc_auth.h
new file mode 100644
index 00000000..902998ee
--- /dev/null
+++ b/rpc_auth.h
@@ -0,0 +1,84 @@
+/* @(#) $Header: /tcpdump/master/tcpdump/rpc_auth.h,v 1.1 2004-12-27 00:41:32 guy Exp $ (LBL) */
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ *
+ * from: @(#)auth.h 1.17 88/02/08 SMI
+ * from: @(#)auth.h 2.3 88/08/07 4.0 RPCSRC
+ * $FreeBSD: src/include/rpc/auth.h,v 1.14.2.1 1999/08/29 14:39:02 peter Exp $
+ */
+
+/*
+ * auth.h, Authentication interface.
+ *
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ *
+ * The data structures are completely opaque to the client. The client
+ * is required to pass a AUTH * to routines that create rpc
+ * "sessions".
+ */
+
+#ifndef __RPC_AUTH_H_
+#define __RPC_AUTH_H_
+
+/*
+ * Status returned from authentication check
+ */
+enum sunrpc_auth_stat {
+ SUNRPC_AUTH_OK=0,
+ /*
+ * failed at remote end
+ */
+ SUNRPC_AUTH_BADCRED=1, /* bogus credentials (seal broken) */
+ SUNRPC_AUTH_REJECTEDCRED=2, /* client should begin new session */
+ SUNRPC_AUTH_BADVERF=3, /* bogus verifier (seal broken) */
+ SUNRPC_AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */
+ SUNRPC_AUTH_TOOWEAK=5, /* rejected due to security reasons */
+ /*
+ * failed locally
+ */
+ SUNRPC_AUTH_INVALIDRESP=6, /* bogus response verifier */
+ SUNRPC_AUTH_FAILED=7 /* some unknown reason */
+};
+
+/*
+ * Authentication info. Opaque to client.
+ */
+struct sunrpc_opaque_auth {
+ u_int32_t oa_flavor; /* flavor of auth */
+ u_int32_t oa_len; /* length of opaque body */
+ /* zero or more bytes of body */
+};
+
+#define SUNRPC_AUTH_NONE 0 /* no authentication */
+#define SUNRPC_AUTH_NULL 0 /* backward compatibility */
+#define SUNRPC_AUTH_UNIX 1 /* unix style (uid, gids) */
+#define SUNRPC_AUTH_SYS 1 /* forward compatibility */
+#define SUNRPC_AUTH_SHORT 2 /* short hand unix style */
+#define SUNRPC_AUTH_DES 3 /* des style (encrypted timestamps) */
+
+#endif /* !__RPC_AUTH_H_ */
diff --git a/rpc_msg.h b/rpc_msg.h
new file mode 100644
index 00000000..fda52fe8
--- /dev/null
+++ b/rpc_msg.h
@@ -0,0 +1,133 @@
+/* @(#) $Header: /tcpdump/master/tcpdump/rpc_msg.h,v 1.1 2004-12-27 00:41:32 guy Exp $ (LBL) */
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ *
+ * from: @(#)rpc_msg.h 1.7 86/07/16 SMI
+ * from: @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC
+ * $FreeBSD: src/include/rpc/rpc_msg.h,v 1.11.2.1 1999/08/29 14:39:07 peter Exp $
+ */
+
+/*
+ * rpc_msg.h
+ * rpc message definition
+ *
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ */
+
+#ifndef __RPC_MSG_H_
+#define __RPC_MSG_H_
+
+#define SUNRPC_MSG_VERSION ((u_int32_t) 2)
+
+/*
+ * Bottom up definition of an rpc message.
+ * NOTE: call and reply use the same overall stuct but
+ * different parts of unions within it.
+ */
+
+enum sunrpc_msg_type {
+ SUNRPC_CALL=0,
+ SUNRPC_REPLY=1
+};
+
+enum sunrpc_reply_stat {
+ SUNRPC_MSG_ACCEPTED=0,
+ SUNRPC_MSG_DENIED=1
+};
+
+enum sunrpc_accept_stat {
+ SUNRPC_SUCCESS=0,
+ SUNRPC_PROG_UNAVAIL=1,
+ SUNRPC_PROG_MISMATCH=2,
+ SUNRPC_PROC_UNAVAIL=3,
+ SUNRPC_GARBAGE_ARGS=4,
+ SUNRPC_SYSTEM_ERR=5
+};
+
+enum sunrpc_reject_stat {
+ SUNRPC_RPC_MISMATCH=0,
+ SUNRPC_AUTH_ERROR=1
+};
+
+/*
+ * Reply part of an rpc exchange
+ */
+
+/*
+ * Reply to an rpc request that was rejected by the server.
+ */
+struct sunrpc_rejected_reply {
+ u_int32_t rj_stat; /* enum reject_stat */
+ union {
+ struct {
+ u_int32_t low;
+ u_int32_t high;
+ } RJ_versions;
+ u_int32_t RJ_why; /* enum auth_stat - why authentication did not work */
+ } ru;
+#define rj_vers ru.RJ_versions
+#define rj_why ru.RJ_why
+};
+
+/*
+ * Body of a reply to an rpc request.
+ */
+struct sunrpc_reply_body {
+ u_int32_t rp_stat; /* enum reply_stat */
+ struct sunrpc_rejected_reply rp_reject; /* if rejected */
+};
+
+/*
+ * Body of an rpc request call.
+ */
+struct sunrpc_call_body {
+ u_int32_t cb_rpcvers; /* must be equal to two */
+ u_int32_t cb_prog;
+ u_int32_t cb_vers;
+ u_int32_t cb_proc;
+ struct sunrpc_opaque_auth cb_cred;
+ /* followed by opaque verifier */
+};
+
+/*
+ * The rpc message
+ */
+struct sunrpc_msg {
+ u_int32_t rm_xid;
+ u_int32_t rm_direction; /* enum msg_type */
+ union {
+ struct sunrpc_call_body RM_cmb;
+ struct sunrpc_reply_body RM_rmb;
+ } ru;
+#define rm_call ru.RM_cmb
+#define rm_reply ru.RM_rmb
+};
+#define acpted_rply ru.RM_rmb.ru.RP_ar
+#define rjcted_rply ru.RM_rmb.ru.RP_dr
+
+#endif /* !__RPC_MSG_H_ */
diff --git a/win32/Include/Rpc/rpc.h b/win32/Include/Rpc/rpc.h
deleted file mode 100644
index b60d0a4d..00000000
--- a/win32/Include/Rpc/rpc.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 1999 - 2000
- * NetGroup, Politecnico di Torino (Italy)
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Politecnico di Torino nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-enum auth_stat {
- AUTH_OK=0,
- /*
- * failed at remote end
- */
- AUTH_BADCRED=1, /* bogus credentials (seal broken) */
- AUTH_REJECTEDCRED=2, /* client should begin new session */
- AUTH_BADVERF=3, /* bogus verifier (seal broken) */
- AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */
- AUTH_TOOWEAK=5, /* rejected due to security reasons */
- /*
- * failed locally
- */
- AUTH_INVALIDRESP=6, /* bogus response verifier */
- AUTH_FAILED=7 /* some unknown reason */
-};
-
-enum msg_type {
- CALL=0,
- REPLY=1
-};
-
-enum reply_stat {
- MSG_ACCEPTED=0,
- MSG_DENIED=1
-};
-
-enum accept_stat {
- SUCCESS=0,
- PROG_UNAVAIL=1,
- PROG_MISMATCH=2,
- PROC_UNAVAIL=3,
- GARBAGE_ARGS=4,
- SYSTEM_ERR=5
-};
-
-enum reject_stat {
- RPC_MISMATCH=0,
- AUTH_ERROR=1
-};
-
-#define u_long unsigned long
-#define u_int unsigned int
-#define u_short unsigned short
-#define enum_t int
-#define caddr_t char*
-
-struct opaque_auth {
- enum_t oa_flavor; /* flavor of auth */
- caddr_t oa_base; /* address of more auth stuff */
- u_int oa_length; /* not to exceed MAX_AUTH_BYTES */
-};
-
-struct accepted_reply {
- struct opaque_auth ar_verf;
- enum accept_stat ar_stat;
- union {
- struct {
- u_long low;
- u_long high;
- } AR_versions;
- /*struct {
- caddr_t where;
- xdrproc_t proc;
- } AR_results;
- /* and many other null cases */
- } ru;
-#define ar_results ru.AR_results
-#define ar_vers ru.AR_versions
-};
-
-struct rejected_reply {
- enum reject_stat rj_stat;
- union {
- struct {
- u_long low;
- u_long high;
- } RJ_versions;
- enum auth_stat RJ_why; /* why authentication did not work */
- } ru;
-#define rj_vers ru.RJ_versions
-#define rj_why ru.RJ_why
-};
-
-struct reply_body {
- enum reply_stat rp_stat;
- union {
- struct accepted_reply RP_ar;
- struct rejected_reply RP_dr;
- } ru;
-#define rp_acpt ru.RP_ar
-#define rp_rjct ru.RP_dr
-};
-
-struct call_body {
- u_long cb_rpcvers; /* must be equal to two */
- u_long cb_prog;
- u_long cb_vers;
- u_long cb_proc;
- struct opaque_auth cb_cred;
- struct opaque_auth cb_verf; /* protocol specific - provided by client */
-};
-
-struct rpc_msg {
- u_long rm_xid;
- enum msg_type rm_direction;
- union {
- struct call_body RM_cmb;
- struct reply_body RM_rmb;
- } ru;
-#define rm_call ru.RM_cmb
-#define rm_reply ru.RM_rmb
-};
-
-#define PMAPPORT ((u_short)111)
-#define PMAPPROG ((u_long)100000)
-#define PMAPVERS ((u_long)2)
-#define PMAPVERS_PROTO ((u_long)2)
-#define PMAPVERS_ORIG ((u_long)1)
-#define PMAPPROC_NULL ((u_long)0)
-#define PMAPPROC_SET ((u_long)1)
-#define PMAPPROC_UNSET ((u_long)2)
-#define PMAPPROC_GETPORT ((u_long)3)
-#define PMAPPROC_DUMP ((u_long)4)
-#define PMAPPROC_CALLIT ((u_long)5)