diff --git a/AUTHORS b/AUTHORS index e941d5ec36..6662cbac83 100644 --- a/AUTHORS +++ b/AUTHORS @@ -154,7 +154,8 @@ Nathan Neulinger { 802.1q VLAN support RPC Portmap dissector RPC Bootparams dissector - Stubs for ypbind/ypserv/ypxfr rpc dissectors + RPC YPServ dissector + Stubs for ypbind/ypxfr rpc dissectors } Tomislav Vujec { diff --git a/packet-bootparams.c b/packet-bootparams.c index 2d90e99f05..9205f840f7 100644 --- a/packet-bootparams.c +++ b/packet-bootparams.c @@ -1,7 +1,7 @@ /* packet-bootparams.c * Routines for bootparams dissection * - * $Id: packet-bootparams.c,v 1.3 1999/11/11 16:20:24 nneul Exp $ + * $Id: packet-bootparams.c,v 1.4 1999/11/11 20:18:46 nneul Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -44,10 +44,43 @@ static int proto_bootparams = -1; static int hf_bootparams_host = -1; +static int hf_bootparams_domain = -1; static int hf_bootparams_fileid = -1; static int hf_bootparams_filepath = -1; -static int hf_bootparams_addresstype = -1; -static int hf_bootparams_address = -1; +static int hf_bootparams_hostaddr = -1; +static int hf_bootparams_routeraddr = -1; + +int dissect_bp_address(const u_char *pd, int offset, frame_data *fd, + proto_tree *tree, int hfindex) +{ + guint32 type; + guint32 ipaddr; + + /* get the address type */ + if ( !BYTES_ARE_IN_FRAME(offset, 1)) return offset; + type = pntohl(&pd[offset]); /* type of address */ +#if 0 + proto_tree_add_item(tree, hf_bootparams_addresstype, + offset, 4, type); +#endif + offset += 4; + + if ( type != 1 ) /* only know how to handle this type of address */ + { + return offset; + } + + /* get the address itself - weird ass format */ + if ( ! BYTES_ARE_IN_FRAME(offset, 16)) return offset; + ipaddr = (pd[offset+3]<<24) + (pd[offset+7]<<16) + + (pd[offset+11]<<8) + (pd[offset+15]); + proto_tree_add_item(tree, hfindex, + offset, 16, ntohl(ipaddr)); + offset += 16; + + return offset; +} + /* Dissect a getfile call */ int dissect_getfile_call(const u_char *pd, int offset, frame_data *fd, @@ -66,46 +99,49 @@ int dissect_getfile_call(const u_char *pd, int offset, frame_data *fd, int dissect_getfile_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { - guint32 type; - guint32 ipaddr; - if ( tree ) { offset = dissect_rpc_string_item(pd,offset,fd,tree,hf_bootparams_host); - - /* get the address type */ - if ( !BYTES_ARE_IN_FRAME(offset, 1)) return offset; - type = pntohl(&pd[offset]); /* type of address */ - proto_tree_add_item(tree, hf_bootparams_addresstype, - offset, 4, type); - offset += 4; - - if ( type != 1 ) /* only know how to handle this type of address */ - { - return offset; - } - - /* get the address itself - weird ass format */ - if ( ! BYTES_ARE_IN_FRAME(offset, 16)) return offset; - ipaddr = (pd[offset+3]<<24) + (pd[offset+7]<<16) + - (pd[offset+11]<<8) + (pd[offset+15]); - proto_tree_add_item(tree, hf_bootparams_address, - offset, 16, ntohl(ipaddr)); - offset += 16; - + offset = dissect_bp_address(pd,offset,fd,tree,hf_bootparams_hostaddr); offset = dissect_rpc_string_item(pd,offset,fd,tree,hf_bootparams_filepath); } return offset; } +/* Dissect a whoami call */ +int dissect_whoami_call(const u_char *pd, int offset, frame_data *fd, + proto_tree *tree) +{ + if ( tree ) + { + offset = dissect_bp_address(pd,offset,fd,tree,hf_bootparams_hostaddr); + } + + return offset; +} + +/* Dissect a whoami reply */ +int dissect_whoami_reply(const u_char *pd, int offset, frame_data *fd, + proto_tree *tree) +{ + if ( tree ) + { + offset = dissect_rpc_string_item(pd,offset,fd,tree,hf_bootparams_host); + offset = dissect_rpc_string_item(pd,offset,fd,tree,hf_bootparams_domain); + offset = dissect_bp_address(pd,offset,fd,tree,hf_bootparams_routeraddr); + } + + return offset; +} + /* proc number, "proc name", dissect_request, dissect_reply */ /* NULL as function pointer means: take the generic one. */ const vsff bootparams1_proc[] = { { BOOTPARAMSPROC_NULL, "NULL", NULL, NULL }, { BOOTPARAMSPROC_WHOAMI, "WHOAMI", - NULL, NULL }, + dissect_whoami_call, dissect_whoami_reply }, { BOOTPARAMSPROC_GETFILE, "GETFILE", dissect_getfile_call, dissect_getfile_reply }, { 0, NULL, NULL, NULL } @@ -118,20 +154,23 @@ proto_register_bootparams(void) { static hf_register_info hf[] = { { &hf_bootparams_host, { - "Host", "bootparams.host", FT_STRING, BASE_DEC, - NULL, 0, "Host" }}, + "Client Host", "bootparams.host", FT_STRING, BASE_DEC, + NULL, 0, "Client Host" }}, + { &hf_bootparams_domain, { + "Client Domain", "bootparams.domain", FT_STRING, BASE_DEC, + NULL, 0, "Client Domain" }}, { &hf_bootparams_fileid, { "File ID", "bootparams.fileid", FT_STRING, BASE_DEC, NULL, 0, "File ID" }}, { &hf_bootparams_filepath, { "File Path", "bootparams.filepath", FT_STRING, BASE_DEC, NULL, 0, "File Path" }}, - { &hf_bootparams_addresstype, { - "Address Type", "bootparams.addresstype", FT_UINT32, BASE_DEC, - NULL, 0, "Address Type" }}, - { &hf_bootparams_address, { - "Address", "bootparams.address", FT_IPv4, BASE_DEC, + { &hf_bootparams_hostaddr, { + "Client Address", "bootparams.hostaddr", FT_IPv4, BASE_DEC, NULL, 0, "Address" }}, + { &hf_bootparams_routeraddr, { + "Router Address", "bootparams.routeraddr", FT_IPv4, BASE_DEC, + NULL, 0, "Router Address" }}, }; proto_bootparams = proto_register_protocol("Boot Parameters", "bootparams"); diff --git a/packet-portmap.c b/packet-portmap.c index fb00ef1fde..e6ffb4321d 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.3 1999/11/10 22:43:53 nneul Exp $ + * $Id: packet-portmap.c,v 1.4 1999/11/11 20:18:46 nneul Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -69,6 +69,13 @@ int dissect_getport_call(const u_char *pd, int offset, frame_data *fd, int dissect_getport_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_port, + offset, 4, pntohl(&pd[offset+0])); + } return offset; } diff --git a/packet-ypserv.c b/packet-ypserv.c index c67def9b12..3d9ffd66d1 100644 --- a/packet-ypserv.c +++ b/packet-ypserv.c @@ -1,7 +1,7 @@ /* packet-ypserv.c * Routines for ypserv dissection * - * $Id: packet-ypserv.c,v 1.2 1999/11/10 21:05:11 nneul Exp $ + * $Id: packet-ypserv.c,v 1.3 1999/11/11 20:18:46 nneul Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -38,40 +38,134 @@ #include "packet-ypserv.h" static int proto_ypserv = -1; +static int hf_ypserv_domain = -1; +static int hf_ypserv_servesdomain = -1; +static int hf_ypserv_map = -1; +static int hf_ypserv_key = -1; +static int hf_ypserv_value = -1; + +/* Dissect a domain call */ +int dissect_domain_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_ypserv_domain); + } + + return offset; +} + +int dissect_domain_reply(const u_char *pd, int offset, frame_data *fd, + proto_tree *tree) +{ + if ( tree ) + { + if ( !BYTES_ARE_IN_FRAME(offset, 1)) return offset; + proto_tree_add_item(tree, hf_ypserv_servesdomain, + offset, 4, pntohl(&pd[offset])); + offset += 4; + } + + return offset; +} + +/* Dissect a next call */ +int dissect_next_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_ypserv_domain); + offset = dissect_rpc_string_item(pd,offset,fd,tree,hf_ypserv_map); + offset = dissect_rpc_string_item(pd,offset,fd,tree,hf_ypserv_key); + } + + return offset; +} + +int dissect_first_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_ypserv_domain); + offset = dissect_rpc_string_item(pd,offset,fd,tree,hf_ypserv_map); + } + + return offset; +} + +int dissect_match_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_ypserv_domain); + offset = dissect_rpc_string_item(pd,offset,fd,tree,hf_ypserv_map); + offset = dissect_rpc_string_item(pd,offset,fd,tree,hf_ypserv_key); + } + + return offset; +} /* proc number, "proc name", dissect_request, dissect_reply */ /* NULL as function pointer means: take the generic one. */ + +/* someone please get me a version 1 trace */ const vsff ypserv1_proc[] = { - { 0, "NULL", NULL, NULL }, - { YPPROC_ALL, "ALL", NULL, NULL }, - { YPPROC_CLEAR, "CLEAR", NULL, NULL }, - { YPPROC_DOMAIN, "DOMAIN", NULL, NULL }, - { YPPROC_DOMAIN_NONACK, "DOMAIN_NONACK", NULL, NULL }, - { YPPROC_FIRST, "FIRST", NULL, NULL }, - { YPPROC_MAPLIST, "MAPLIST", NULL, NULL }, - { YPPROC_MASTER, "MASTER", NULL, NULL }, - { YPPROC_MATCH, "MATCH", NULL, NULL }, - { YPPROC_NEXT, "NEXT", NULL, NULL }, - { YPPROC_ORDER, "ORDER", NULL, NULL }, - { YPPROC_XFR, "XFR", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 0, "NULL", NULL, NULL }, + { YPPROC_ALL, "ALL", + NULL, NULL }, + { YPPROC_CLEAR, "CLEAR", + NULL, NULL }, + { YPPROC_DOMAIN, "DOMAIN", + NULL, NULL }, + { YPPROC_DOMAIN_NONACK, "DOMAIN_NONACK", + NULL, NULL }, + { YPPROC_FIRST, "FIRST", + NULL, NULL }, + { YPPROC_MAPLIST, "MAPLIST", + NULL, NULL }, + { YPPROC_MASTER, "MASTER", + NULL, NULL }, + { YPPROC_MATCH, "MATCH", + NULL, NULL }, + { YPPROC_NEXT, "NEXT", + NULL, NULL }, + { YPPROC_ORDER, "ORDER", + NULL, NULL }, + { YPPROC_XFR, "XFR", + NULL, NULL }, + { 0, NULL, NULL, NULL } }; -/* end of YPServ version 1 */ +/* end of YPServ version 2 */ const vsff ypserv2_proc[] = { - { 0, "NULL", NULL, NULL }, - { YPPROC_ALL, "ALL", NULL, NULL }, - { YPPROC_CLEAR, "CLEAR", NULL, NULL }, - { YPPROC_DOMAIN, "DOMAIN", NULL, NULL }, - { YPPROC_DOMAIN_NONACK, "DOMAIN_NONACK", NULL, NULL }, - { YPPROC_FIRST, "FIRST", NULL, NULL }, - { YPPROC_MAPLIST, "MAPLIST", NULL, NULL }, - { YPPROC_MASTER, "MASTER", NULL, NULL }, - { YPPROC_MATCH, "MATCH", NULL, NULL }, - { YPPROC_NEXT, "NEXT", NULL, NULL }, - { YPPROC_ORDER, "ORDER", NULL, NULL }, - { YPPROC_XFR, "XFR", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 0, "NULL", NULL, NULL }, + { YPPROC_ALL, "ALL", + NULL, NULL }, + { YPPROC_CLEAR, "CLEAR", + NULL, NULL }, + { YPPROC_DOMAIN, "DOMAIN", + dissect_domain_call, dissect_domain_reply }, + { YPPROC_DOMAIN_NONACK, "DOMAIN_NONACK", + dissect_domain_call, dissect_domain_reply }, + { YPPROC_FIRST, "FIRST", + dissect_first_call, NULL }, + { YPPROC_MAPLIST, "MAPLIST", + NULL, NULL }, + { YPPROC_MASTER, "MASTER", + NULL, NULL }, + { YPPROC_MATCH, "MATCH", + dissect_match_call, NULL }, + { YPPROC_NEXT, "NEXT", + dissect_next_call, NULL }, + { YPPROC_ORDER, "ORDER", + NULL, NULL }, + { YPPROC_XFR, "XFR", + NULL, NULL }, + { 0, NULL, NULL, NULL } }; /* end of YPServ version 2 */ @@ -79,7 +173,26 @@ const vsff ypserv2_proc[] = { void proto_register_ypserv(void) { + static hf_register_info hf[] = { + { &hf_ypserv_domain, { + "Domain", "ypserv.domain", FT_STRING, BASE_DEC, + NULL, 0, "Domain" }}, + { &hf_ypserv_servesdomain, { + "Serves Domain", "ypserv.servesdomain", FT_BOOLEAN, BASE_DEC, + NULL, 0, "Serves Domain" }}, + { &hf_ypserv_map, { + "Map Name", "ypserv.map", FT_STRING, BASE_DEC, + NULL, 0, "Map Name" }}, + { &hf_ypserv_key, { + "Key", "ypserv.key", FT_STRING, BASE_DEC, + NULL, 0, "Key" }}, + { &hf_ypserv_value, { + "Value", "ypserv.value", FT_STRING, BASE_DEC, + NULL, 0, "Value" }}, + }; + proto_ypserv = proto_register_protocol("Yellow Pages Service", "ypserv"); + proto_register_field_array(proto_ypserv, hf, array_length(hf)); /* Register the protocol as RPC */ rpc_init_prog(proto_ypserv, YPSERV_PROGRAM, ETT_YPSERV);