aboutsummaryrefslogtreecommitdiffstats
path: root/packet-udp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-10-29 01:04:44 +0000
committerGuy Harris <guy@alum.mit.edu>1999-10-29 01:04:44 +0000
commit21c466ed25733e4f13d786458d70bd3e46280b8a (patch)
tree0c9ce9b6ad5b1aaaaa50c1f849bead66d39cda9c /packet-udp.c
parent6a95d6d5eab66494c180fe3143ef7da36297525b (diff)
Uwe Girlich's ONC RPC and NFS dissectors.
svn path=/trunk/; revision=945
Diffstat (limited to 'packet-udp.c')
-rw-r--r--packet-udp.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/packet-udp.c b/packet-udp.c
index d4a2a6e540..6a196aa5fd 100644
--- a/packet-udp.c
+++ b/packet-udp.c
@@ -1,7 +1,7 @@
/* packet-udp.c
* Routines for UDP packet disassembly
*
- * $Id: packet-udp.c,v 1.32 1999/10/24 00:55:48 guy Exp $
+ * $Id: packet-udp.c,v 1.33 1999/10/29 01:04:18 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -43,6 +43,7 @@
#include <glib.h>
#include "packet.h"
#include "resolv.h"
+#include "packet-rpc.h"
int proto_udp = -1;
int hf_udp_srcport = -1;
@@ -222,6 +223,54 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
pi.srcport = uh_sport;
pi.destport = uh_dport;
+ /* RPC */
+ if (BYTES_ARE_IN_FRAME(offset,8)) {
+ guint32 rpc_msgtype;
+
+ /* both directions need at least this */
+ rpc_msgtype = EXTRACT_UINT(pd,offset+4);
+
+ /* check for RPC reply */
+ if (rpc_msgtype == RPC_REPLY) {
+ rpc_call_info rpc_key;
+ rpc_call_info *rpc_value;
+ conversation_t *conversation;
+
+ conversation = find_conversation(&pi.src, &pi.dst, pi.ptype,
+ pi.srcport, pi.destport);
+ if (conversation) {
+ /* It makes only sense to look for the corresponding RPC request,
+ if there was a conversation. */
+ rpc_key.xid = EXTRACT_UINT(pd,offset+0);
+ rpc_key.conversation = conversation;
+ if ((rpc_value=rpc_call_lookup(&rpc_key)) != NULL) {
+ dissect_rpc(pd,offset,fd,tree,rpc_msgtype,(void*)rpc_value);
+ return;
+ }
+ }
+ }
+
+ /* check for RPC call */
+ if (BYTES_ARE_IN_FRAME(offset,16)) {
+ guint32 rpc_vers;
+ rpc_prog_info_key rpc_prog_key;
+ rpc_prog_info_value *rpc_prog_info;
+
+ /* xid can be anything, we dont check it */
+ /* msgtype is already defined */
+ rpc_vers = EXTRACT_UINT(pd,offset+8);
+ rpc_prog_key.prog = EXTRACT_UINT(pd,offset+12);
+ if (rpc_msgtype == RPC_CALL &&
+ rpc_vers == 2 &&
+ ((rpc_prog_info = g_hash_table_lookup(rpc_progs, &rpc_prog_key)) != NULL))
+ {
+ dissect_rpc(pd,offset,fd,tree,rpc_msgtype,(void*)rpc_prog_info);
+ return;
+ }
+ }
+ }
+ /* end of RPC */
+
/* XXX - we should do all of this through the table of ports. */
#define PORT_IS(port) (uh_sport == port || uh_dport == port)
if (PORT_IS(UDP_PORT_BOOTPS))