forked from osmocom/wireshark
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. svn path=/trunk/; revision=1016
This commit is contained in:
parent
1d554ab6c9
commit
59bffe6e97
5
AUTHORS
5
AUTHORS
|
@ -152,10 +152,7 @@ Nathan Neulinger <nneul@umr.edu> {
|
|||
RX protocol support
|
||||
Andrew File System protocol support
|
||||
802.1q VLAN support
|
||||
RPC Portmap dissector
|
||||
RPC Bootparams dissector
|
||||
RPC YPServ dissector
|
||||
Stubs for ypbind/ypxfr rpc dissectors
|
||||
Misc. RPC program dissectors
|
||||
}
|
||||
|
||||
Tomislav Vujec <tvujec@carnet.hr> {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.am
|
||||
# Automake file for Ethereal
|
||||
#
|
||||
# $Id: Makefile.am,v 1.104 1999/11/11 08:35:11 guy Exp $
|
||||
# $Id: Makefile.am,v 1.105 1999/11/11 21:21:59 nneul Exp $
|
||||
#
|
||||
# Ethereal - Network traffic analyzer
|
||||
# By Gerald Combs <gerald@zing.org>
|
||||
|
@ -73,6 +73,8 @@ DISSECTOR_SOURCES = \
|
|||
packet-lapd.c \
|
||||
packet-llc.c \
|
||||
packet-lpd.c \
|
||||
packet-mount.c \
|
||||
packet-mount.h \
|
||||
packet-nbipx.c \
|
||||
packet-nbns.c \
|
||||
packet-ncp.c \
|
||||
|
@ -113,6 +115,8 @@ DISSECTOR_SOURCES = \
|
|||
packet-smb.c \
|
||||
packet-sna.c \
|
||||
packet-sna.h \
|
||||
packet-stat.c \
|
||||
packet-stat.h \
|
||||
packet-tcp.c \
|
||||
packet-telnet.c\
|
||||
packet-tftp.c \
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
/* packet-mount.c
|
||||
* Routines for mount dissection
|
||||
*
|
||||
* $Id: packet-mount.c,v 1.1 1999/11/11 21:21:59 nneul Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@unicom.net>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* Copied from packet-smb.c
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "packet-rpc.h"
|
||||
#include "packet-mount.h"
|
||||
|
||||
static int proto_mount = -1;
|
||||
static int hf_mount_path = -1;
|
||||
|
||||
/* Dissect a unmount call */
|
||||
int dissect_unmount_call(const u_char *pd, int offset, frame_data *fd,
|
||||
proto_tree *tree)
|
||||
{
|
||||
if ( tree )
|
||||
{
|
||||
offset = dissect_rpc_string_item(pd,offset,fd,tree,hf_mount_path);
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
/* proc number, "proc name", dissect_request, dissect_reply */
|
||||
/* NULL as function pointer means: take the generic one. */
|
||||
|
||||
const vsff mount_proc[] = {
|
||||
{ 0, "NULL", NULL, NULL },
|
||||
{ MOUNTPROC_MOUNT, "MOUNT",
|
||||
NULL, NULL },
|
||||
{ MOUNTPROC_UNMOUNT, "UNMOUNT",
|
||||
dissect_unmount_call, NULL },
|
||||
{ 0, NULL, NULL, NULL }
|
||||
};
|
||||
/* end of mount version 1 */
|
||||
|
||||
|
||||
void
|
||||
proto_register_mount(void)
|
||||
{
|
||||
static hf_register_info hf[] = {
|
||||
{ &hf_mount_path, {
|
||||
"Path", "mount.path", FT_STRING, BASE_DEC,
|
||||
NULL, 0, "Path" }},
|
||||
};
|
||||
|
||||
proto_mount = proto_register_protocol("Mount Service", "mount");
|
||||
proto_register_field_array(proto_mount, hf, array_length(hf));
|
||||
|
||||
/* Register the protocol as RPC */
|
||||
rpc_init_prog(proto_mount, MOUNT_PROGRAM, ETT_MOUNT);
|
||||
/* Register the procedure tables */
|
||||
rpc_init_proc_table(MOUNT_PROGRAM, 1, mount_proc);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
/* packet-mount.h */
|
||||
/* $Id: packet-mount.h,v 1.1 1999/11/11 21:21:59 nneul Exp $ */
|
||||
|
||||
#ifndef PACKET_MOUNT_H
|
||||
#define PACKET_MOUNT_H
|
||||
|
||||
#define MOUNT_PROGRAM 100005
|
||||
|
||||
#define MOUNTPROC_NULL 0
|
||||
#define MOUNTPROC_MOUNT 1
|
||||
#define MOUNTPROC_UNMOUNT 3
|
||||
|
||||
#endif
|
|
@ -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 <gerald@unicom.net>
|
||||
|
@ -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");
|
||||
|
|
32
packet-rpc.c
32
packet-rpc.c
|
@ -2,7 +2,7 @@
|
|||
* Routines for rpc dissection
|
||||
* Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
|
||||
*
|
||||
* $Id: packet-rpc.c,v 1.7 1999/11/11 16:20:24 nneul Exp $
|
||||
* $Id: packet-rpc.c,v 1.8 1999/11/11 21:22:00 nneul Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@unicom.net>
|
||||
|
@ -196,6 +196,26 @@ rpc_init_prog(int proto, guint32 prog, int ett)
|
|||
g_hash_table_insert(rpc_progs,key,value);
|
||||
}
|
||||
|
||||
/* return the name associated with a previously registered program. This
|
||||
should probably eventually be expanded to use the rpc YP/NIS map
|
||||
so that it can give names for programs not handled by ethereal */
|
||||
char *rpc_prog_name(guint32 prog)
|
||||
{
|
||||
char *progname = NULL;
|
||||
rpc_prog_info_key rpc_prog_key;
|
||||
rpc_prog_info_value *rpc_prog;
|
||||
|
||||
rpc_prog_key.prog = prog;
|
||||
if ((rpc_prog = g_hash_table_lookup(rpc_progs,&rpc_prog_key)) == NULL) {
|
||||
progname = "Unknown";
|
||||
}
|
||||
else {
|
||||
progname = rpc_prog->progname;
|
||||
}
|
||||
return progname;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------*/
|
||||
/* end of Hash array with program names */
|
||||
/*--------------------------------------*/
|
||||
|
@ -206,24 +226,14 @@ It should vanish, if they are finally present. Up to this point, this
|
|||
minimal variant serves as a detector for RPC services and can even find
|
||||
request/reply pairs. */
|
||||
|
||||
#define MNT_PROGRAM 100005
|
||||
#define NLM_PROGRAM 100021
|
||||
#define STAT_PROGRAM 100024
|
||||
|
||||
static int proto_mnt = -1;
|
||||
static int proto_nlm = -1;
|
||||
static int proto_stat = -1;
|
||||
|
||||
void init_incomplete_dissect(void)
|
||||
{
|
||||
proto_mnt = proto_register_protocol("Mount", "MNT");
|
||||
rpc_init_prog(proto_mnt, MNT_PROGRAM, ETT_MNT);
|
||||
|
||||
proto_nlm = proto_register_protocol("Network Lock Manager", "NLM");
|
||||
rpc_init_prog(proto_nlm, NLM_PROGRAM, ETT_NLM);
|
||||
|
||||
proto_stat = proto_register_protocol("Status", "STAT");
|
||||
rpc_init_prog(proto_stat, STAT_PROGRAM, ETT_STAT);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* packet-rpc.h (c) 1999 Uwe Girlich */
|
||||
/* $Id: packet-rpc.h,v 1.3 1999/11/11 16:20:25 nneul Exp $ */
|
||||
/* $Id: packet-rpc.h,v 1.4 1999/11/11 21:22:00 nneul Exp $ */
|
||||
|
||||
#ifndef __PACKET_RPC_H__
|
||||
#define __PACKET_RPC_H__
|
||||
|
@ -91,6 +91,7 @@ extern rpc_call_info* rpc_call_lookup(rpc_call_info *call);
|
|||
|
||||
extern void rpc_init_proc_table(guint prog, guint vers, const vsff *proc_table);
|
||||
extern void rpc_init_prog(int proto, guint32 prog, int ett);
|
||||
extern char *rpc_prog_name(guint32 prog);
|
||||
|
||||
extern void init_dissect_rpc();
|
||||
extern void cleanup_dissect_rpc();
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/* packet-stat.c
|
||||
* Routines for stat dissection
|
||||
*
|
||||
* $Id: packet-stat.c,v 1.1 1999/11/11 21:22:00 nneul Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@unicom.net>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* Copied from packet-smb.c
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include "packet-rpc.h"
|
||||
#include "packet-stat.h"
|
||||
|
||||
static int proto_stat = -1;
|
||||
|
||||
/* proc number, "proc name", dissect_request, dissect_reply */
|
||||
/* NULL as function pointer means: take the generic one. */
|
||||
|
||||
const vsff stat_proc[] = {
|
||||
{ 0, "NULL", NULL, NULL },
|
||||
{ STATPROC_STAT, "STAT",
|
||||
NULL, NULL },
|
||||
{ STATPROC_MON, "MON",
|
||||
NULL, NULL },
|
||||
{ STATPROC_UNMON, "UNMON",
|
||||
NULL, NULL },
|
||||
{ STATPROC_UNMON_ALL, "UNMON_ALL",
|
||||
NULL, NULL },
|
||||
{ STATPROC_SIMU_CRASH, "SIMU_CRASH",
|
||||
NULL, NULL },
|
||||
{ STATPROC_NOTIFY, "NOTIFY",
|
||||
NULL, NULL },
|
||||
{ 0, NULL, NULL, NULL }
|
||||
};
|
||||
/* end of stat version 1 */
|
||||
|
||||
|
||||
void
|
||||
proto_register_stat(void)
|
||||
{
|
||||
static hf_register_info hf[] = {
|
||||
#if 0
|
||||
{ &hf_stat_path, {
|
||||
"Path", "stat.path", FT_STRING, BASE_DEC,
|
||||
NULL, 0, "Path" }},
|
||||
#endif
|
||||
};
|
||||
|
||||
proto_stat = proto_register_protocol("Status Service", "stat");
|
||||
proto_register_field_array(proto_stat, hf, array_length(hf));
|
||||
|
||||
/* Register the protocol as RPC */
|
||||
rpc_init_prog(proto_stat, STAT_PROGRAM, ETT_STAT);
|
||||
/* Register the procedure tables */
|
||||
rpc_init_proc_table(STAT_PROGRAM, 1, stat_proc);
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
/* packet-stat.h */
|
||||
/* $Id: packet-stat.h,v 1.1 1999/11/11 21:22:00 nneul Exp $ */
|
||||
|
||||
#ifndef PACKET_STAT_H
|
||||
#define PACKET_STAT_H
|
||||
|
||||
#define STAT_PROGRAM 100024
|
||||
|
||||
#define STATPROC_NULL 0
|
||||
#define STATPROC_STAT 1
|
||||
#define STATPROC_MON 2
|
||||
#define STATPROC_UNMON 3
|
||||
#define STATPROC_UNMON_ALL 4
|
||||
#define STATPROC_SIMU_CRASH 5
|
||||
#define STATPROC_NOTIFY 6
|
||||
|
||||
#endif
|
4
packet.h
4
packet.h
|
@ -1,7 +1,7 @@
|
|||
/* packet.h
|
||||
* Definitions for packet disassembly structures and routines
|
||||
*
|
||||
* $Id: packet.h,v 1.135 1999/11/11 21:08:52 itojun Exp $
|
||||
* $Id: packet.h,v 1.136 1999/11/11 21:22:00 nneul Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -445,6 +445,7 @@ enum {
|
|||
ETT_RPC_CRED,
|
||||
ETT_RPC_VERF,
|
||||
ETT_RPC_GIDS,
|
||||
ETT_MOUNT,
|
||||
ETT_NFS,
|
||||
ETT_NFS_FHANDLE,
|
||||
ETT_NFS_TIMEVAL,
|
||||
|
@ -455,7 +456,6 @@ enum {
|
|||
ETT_NFS_FH3,
|
||||
ETT_NFS_NFSTIME3,
|
||||
ETT_NFS_FATTR3,
|
||||
ETT_MNT,
|
||||
ETT_NLM,
|
||||
ETT_PORTMAP,
|
||||
ETT_STAT,
|
||||
|
|
Loading…
Reference in New Issue