add tcp reassembly to isns
also make isns not dump core just because someone has encoded an integer in 0 bytes. still need to add reassembly of fragmented pdus (first fragment/last fragment) but have example captures of that so thats for tomorrow. svn path=/trunk/; revision=10805
This commit is contained in:
parent
2085e656e8
commit
99467f6e89
1
AUTHORS
1
AUTHORS
|
@ -1611,6 +1611,7 @@ Jean-Baptiste Marchand <Jean-Baptiste.Marchand [AT] hsc.fr> {
|
||||||
Changed or added procedure names for a number of DCE RPC
|
Changed or added procedure names for a number of DCE RPC
|
||||||
interfaces
|
interfaces
|
||||||
EncryptedFileSystem (EFS) support.
|
EncryptedFileSystem (EFS) support.
|
||||||
|
MS Eventlog support.
|
||||||
}
|
}
|
||||||
|
|
||||||
Andreas Trauer <andreas.trauer [AT] siemens.com> {
|
Andreas Trauer <andreas.trauer [AT] siemens.com> {
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
|
/* XXX fixme can not reassemple multiple isns PDU fragments into one
|
||||||
|
isns PDU
|
||||||
|
*/
|
||||||
|
|
||||||
/* packet-isns.c
|
/* packet-isns.c
|
||||||
* Routines for iSNS dissection
|
* Routines for iSNS dissection
|
||||||
* Copyright 2003, Elipsan, Gareth Bushell <gbushell@elipsan.com>
|
* Copyright 2003, Elipsan, Gareth Bushell <gbushell@elipsan.com>
|
||||||
* (c) 2004 Ronnie Sahlberg updates
|
* (c) 2004 Ronnie Sahlberg updates
|
||||||
*
|
*
|
||||||
* $Id: packet-isns.c,v 1.3 2004/04/29 08:13:08 sahlberg Exp $
|
* $Id: packet-isns.c,v 1.4 2004/05/06 10:24:32 sahlberg Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -47,6 +51,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <epan/packet.h>
|
#include <epan/packet.h>
|
||||||
|
#include "packet-tcp.h"
|
||||||
|
#include "prefs.h"
|
||||||
|
|
||||||
|
|
||||||
#define ISNS_PROTO_VER 0x1
|
#define ISNS_PROTO_VER 0x1
|
||||||
#define ISNS_HEADER_SIZE 12
|
#define ISNS_HEADER_SIZE 12
|
||||||
|
@ -173,6 +180,11 @@ static int hf_isns_portal_group_tag = -1;
|
||||||
static int hf_isns_pg_portal_ip_addr = -1;
|
static int hf_isns_pg_portal_ip_addr = -1;
|
||||||
static int hf_isns_pg_portal_port = -1;
|
static int hf_isns_pg_portal_port = -1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Desegment iSNS over TCP messages */
|
||||||
|
static gboolean isns_desegment = TRUE;
|
||||||
|
|
||||||
/* Function Id's */
|
/* Function Id's */
|
||||||
#define ISNS_FUNC_DEVATTRREG 0x0001
|
#define ISNS_FUNC_DEVATTRREG 0x0001
|
||||||
#define ISNS_FUNC_DEVATTRQRY 0x0002
|
#define ISNS_FUNC_DEVATTRQRY 0x0002
|
||||||
|
@ -554,8 +566,8 @@ static gint ett_isns = -1;
|
||||||
|
|
||||||
|
|
||||||
/* Code to actually dissect the packets */
|
/* Code to actually dissect the packets */
|
||||||
static int
|
static void
|
||||||
dissect_isns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
{
|
{
|
||||||
guint offset = 0;
|
guint offset = 0;
|
||||||
guint16 function_id;
|
guint16 function_id;
|
||||||
|
@ -567,7 +579,7 @@ dissect_isns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
proto_tree *isns_tree = NULL;
|
proto_tree *isns_tree = NULL;
|
||||||
|
|
||||||
if( packet_len < 12 )
|
if( packet_len < 12 )
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
/* Make entries in Protocol column and Info column on summary display */
|
/* Make entries in Protocol column and Info column on summary display */
|
||||||
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
||||||
|
@ -582,7 +594,7 @@ dissect_isns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
/* Get the protocol version - only version one at the moment*/
|
/* Get the protocol version - only version one at the moment*/
|
||||||
isns_protocol_version = tvb_get_ntohs(tvb, offset + 0);
|
isns_protocol_version = tvb_get_ntohs(tvb, offset + 0);
|
||||||
if( (function_id_str == NULL) || (isns_protocol_version != ISNS_PROTO_VER) )
|
if( (function_id_str == NULL) || (isns_protocol_version != ISNS_PROTO_VER) )
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
/* Add the function name in the info col */
|
/* Add the function name in the info col */
|
||||||
if (check_col(pinfo->cinfo, COL_INFO))
|
if (check_col(pinfo->cinfo, COL_INFO))
|
||||||
|
@ -713,7 +725,44 @@ dissect_isns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tvb_length(tvb);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static guint
|
||||||
|
get_isns_pdu_len(tvbuff_t *tvb, int offset)
|
||||||
|
{
|
||||||
|
guint16 isns_len;
|
||||||
|
|
||||||
|
isns_len = tvb_get_ntohs(tvb, offset+4);
|
||||||
|
return (isns_len+12);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
dissect_isns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
|
{
|
||||||
|
/* Make entries in Protocol column and Info column on summary display*/
|
||||||
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
||||||
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "isns");
|
||||||
|
if (check_col(pinfo->cinfo, COL_INFO))
|
||||||
|
col_clear(pinfo->cinfo, COL_INFO);
|
||||||
|
|
||||||
|
tcp_dissect_pdus(tvb, pinfo, tree, isns_desegment, 12, get_isns_pdu_len,
|
||||||
|
dissect_isns_pdu);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
dissect_isns_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
|
{
|
||||||
|
/* Make entries in Protocol column and Info column on summary display*/
|
||||||
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
||||||
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "isns");
|
||||||
|
if (check_col(pinfo->cinfo, COL_INFO))
|
||||||
|
col_clear(pinfo->cinfo, COL_INFO);
|
||||||
|
|
||||||
|
dissect_isns_pdu(tvb, pinfo, tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -757,10 +806,15 @@ dissect_isns_attr_integer(tvbuff_t *tvb, guint offset, proto_tree *parent_tree,
|
||||||
proto_item *item=NULL;
|
proto_item *item=NULL;
|
||||||
proto_tree *tree=NULL;
|
proto_tree *tree=NULL;
|
||||||
|
|
||||||
|
if(len){
|
||||||
if(parent_tree){
|
if(parent_tree){
|
||||||
item=proto_tree_add_item(parent_tree, hf_index, tvb, offset + 8, len, FALSE);
|
item=proto_tree_add_item(parent_tree, hf_index, tvb, offset + 8, len, FALSE);
|
||||||
tree = proto_item_add_subtree(item, ett_isns_attribute);
|
tree = proto_item_add_subtree(item, ett_isns_attribute);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
item=proto_tree_add_text(parent_tree, tvb, offset, 8, "Oops, you surprised me here. a 0 byte integer.");
|
||||||
|
tree = proto_item_add_subtree(item, ett_isns_attribute);
|
||||||
|
}
|
||||||
|
|
||||||
proto_tree_add_uint(tree, hf_isns_attr_tag, tvb, offset, 4, tag);
|
proto_tree_add_uint(tree, hf_isns_attr_tag, tvb, offset, 4, tag);
|
||||||
proto_tree_add_uint(tree, hf_isns_attr_len, tvb, offset+4, 4, len);
|
proto_tree_add_uint(tree, hf_isns_attr_len, tvb, offset+4, 4, len);
|
||||||
|
@ -1749,15 +1803,21 @@ void proto_register_isns(void)
|
||||||
&ett_isns_port,
|
&ett_isns_port,
|
||||||
&ett_isns_isnt
|
&ett_isns_isnt
|
||||||
};
|
};
|
||||||
|
module_t *isns_module;
|
||||||
|
|
||||||
/* Register the protocol name and description */
|
/* Register the protocol name and description */
|
||||||
proto_isns = proto_register_protocol("iSNS",
|
proto_isns = proto_register_protocol("iSNS",
|
||||||
"iSNS", "isns");
|
"iSNS", "isns");
|
||||||
|
|
||||||
proto_register_field_array(proto_isns, hf, array_length(hf));
|
proto_register_field_array(proto_isns, hf, array_length(hf));
|
||||||
|
|
||||||
proto_register_subtree_array(ett, array_length(ett));
|
proto_register_subtree_array(ett, array_length(ett));
|
||||||
|
|
||||||
|
/* Register preferences */
|
||||||
|
isns_module = prefs_register_protocol(proto_isns, NULL);
|
||||||
|
prefs_register_bool_preference(isns_module, "desegment",
|
||||||
|
"Desegment iSNS over TCP messages",
|
||||||
|
"Whether the dissector should desegment "
|
||||||
|
"multi-segment iSNS messages", &isns_desegment);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this dissector uses sub-dissector registration add a registration routine.
|
/* If this dissector uses sub-dissector registration add a registration routine.
|
||||||
|
@ -1768,8 +1828,10 @@ void proto_register_isns(void)
|
||||||
void
|
void
|
||||||
proto_reg_handoff_isns(void)
|
proto_reg_handoff_isns(void)
|
||||||
{
|
{
|
||||||
dissector_handle_t isns_handle;
|
dissector_handle_t isns_tcp_handle;
|
||||||
isns_handle = new_create_dissector_handle(dissect_isns,proto_isns);
|
dissector_handle_t isns_udp_handle;
|
||||||
dissector_add("udp.port",ISNS_UDP_PORT,isns_handle);
|
isns_tcp_handle = create_dissector_handle(dissect_isns_tcp,proto_isns);
|
||||||
dissector_add("tcp.port",ISNS_TCP_PORT,isns_handle);
|
isns_udp_handle = create_dissector_handle(dissect_isns_udp,proto_isns);
|
||||||
|
dissector_add("tcp.port",ISNS_TCP_PORT,isns_tcp_handle);
|
||||||
|
dissector_add("udp.port",ISNS_UDP_PORT,isns_udp_handle);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue