From bd5ffe8eaee610512fe81a73ef8f264cdd94523d Mon Sep 17 00:00:00 2001 From: nneul Date: Thu, 11 Nov 1999 21:22:00 +0000 Subject: Added mount dissector. Added stat dissector. Enhancements to portmap dissector. Added rpc_prog_name function to packet-rpc to retrieve the name of an rpc program. This should likely eventually be modified to use the /etc/rpc or rpc.bynumber NIS maps in addition to the programs that are registered within ethereal. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1016 f5534014-38df-0310-8fa8-9805f1628bb7 --- packet-portmap.c | 56 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 14 deletions(-) (limited to 'packet-portmap.c') diff --git a/packet-portmap.c b/packet-portmap.c index e6ffb4321d..3f69f5d510 100644 --- a/packet-portmap.c +++ b/packet-portmap.c @@ -1,7 +1,7 @@ /* packet-portmap.c * Routines for portmap dissection * - * $Id: packet-portmap.c,v 1.4 1999/11/11 20:18:46 nneul Exp $ + * $Id: packet-portmap.c,v 1.5 1999/11/11 21:21:59 nneul Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -43,40 +43,46 @@ static int hf_portmap_prog = -1; static int hf_portmap_proc = -1; static int hf_portmap_version = -1; static int hf_portmap_port = -1; +static int hf_portmap_answer = -1; /* Dissect a getport call */ int dissect_getport_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { guint32 proto; - if ( !BYTES_ARE_IN_FRAME(offset, 12)) return offset; + guint32 prog; + if ( !BYTES_ARE_IN_FRAME(offset, 16)) return offset; if ( tree ) { - proto_tree_add_item(tree, hf_portmap_prog, - offset, 4, pntohl(&pd[offset+0])); + prog = pntohl(&pd[offset+0]); + proto_tree_add_item_format(tree, hf_portmap_prog, + offset, 4, prog, "Program: %s (%d)", + rpc_prog_name(prog), prog); proto_tree_add_item(tree, hf_portmap_version, offset+4, 4, pntohl(&pd[offset+4])); proto = pntohl(&pd[offset+8]); proto_tree_add_item_format(tree, hf_portmap_proto, offset+8, 4, proto, "Proto: %s (%d)", ipprotostr(proto), proto); + + proto_tree_add_item(tree, hf_portmap_port, + offset+12, 4, pntohl(&pd[offset+12])); } - return offset+12; + return offset+16; } int dissect_getport_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { + if ( !BYTES_ARE_IN_FRAME(offset, 4)) return offset; if ( tree ) { - if ( !BYTES_ARE_IN_FRAME(offset, 4)) return offset; - proto_tree_add_item(tree, hf_portmap_port, offset, 4, pntohl(&pd[offset+0])); } - return offset; + return offset+=4; } /* Dissect a 'set' call */ @@ -84,12 +90,15 @@ int dissect_set_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { guint32 proto; + guint32 prog; if ( !BYTES_ARE_IN_FRAME(offset, 16)) return offset; if ( tree ) { - proto_tree_add_item(tree, hf_portmap_prog, - offset, 4, pntohl(&pd[offset+0])); + prog = pntohl(&pd[offset+0]); + proto_tree_add_item_format(tree, hf_portmap_prog, + offset, 4, prog, "Program: %s (%d)", + rpc_prog_name(prog), prog); proto_tree_add_item(tree, hf_portmap_version, offset+4, 4, pntohl(&pd[offset+4])); @@ -109,12 +118,15 @@ int dissect_unset_call(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { guint32 proto; + guint32 prog; if ( !BYTES_ARE_IN_FRAME(offset, 16)) return offset; if ( tree ) { - proto_tree_add_item(tree, hf_portmap_prog, - offset, 4, pntohl(&pd[offset+0])); + prog = pntohl(&pd[offset+0]); + proto_tree_add_item_format(tree, hf_portmap_prog, + offset, 4, prog, "Program: %s (%d)", + rpc_prog_name(prog), prog); proto_tree_add_item(tree, hf_portmap_version, offset+4, 4, pntohl(&pd[offset+4])); @@ -129,6 +141,19 @@ int dissect_unset_call(const u_char *pd, int offset, frame_data *fd, return offset+16; } +int dissect_set_reply(const u_char *pd, int offset, frame_data *fd, + proto_tree *tree) +{ + if ( tree ) + { + if ( !BYTES_ARE_IN_FRAME(offset, 4)) return offset; + + proto_tree_add_item(tree, hf_portmap_answer, + offset, 4, pntohl(&pd[offset+0])); + offset += 4; + } + return offset; +} /* proc number, "proc name", dissect_request, dissect_reply */ /* NULL as function pointer means: take the generic one. */ @@ -147,9 +172,9 @@ const vsff portmap2_proc[] = { { PORTMAPPROC_NULL, "NULL", NULL, NULL }, { PORTMAPPROC_SET, "SET", - dissect_set_call, NULL }, + dissect_set_call, dissect_set_reply }, { PORTMAPPROC_UNSET, "UNSET", - dissect_unset_call, NULL }, + dissect_unset_call, dissect_set_reply }, { PORTMAPPROC_GETPORT, "GETPORT", dissect_getport_call, dissect_getport_reply }, { PORTMAPPROC_DUMP, "DUMP", @@ -180,6 +205,9 @@ proto_register_portmap(void) { &hf_portmap_version, { "Version", "portmap.version", FT_UINT32, BASE_DEC, NULL, 0, "Version" }}, + { &hf_portmap_answer, { + "Answer", "portmap.answer", FT_BOOLEAN, BASE_DEC, + NULL, 0, "Answer" }}, }; proto_portmap = proto_register_protocol("Portmap", "portmap"); -- cgit v1.2.3