Hey all,
here a small patch for the RDM plugin that checks the checksum.
- Erwin
--
Erwin Rol Software Engineering - http://www.erwinrol.com/
? core.11249
? packet-rdm.lo
? rdm.diff
? rdm.la
Index: packet-rdm.c
===================================================================
RCS file: /cvsroot/ethereal/plugins/rdm/packet-rdm.c,v
retrieving revision 1.1
diff -u -r1.1 packet-rdm.c
--- packet-rdm.c 17 Nov 2003 20:57:14 -0000 1.1
+++ packet-rdm.c 17 Nov 2003 22:11:30 -0000
@@ -80,10 +80,12 @@
static void
dissect_rdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
- gint offset = 0;
+ gint offset = 0, start_offset,i;
+ guint16 checksum,calc_checksum;
gint mdb_size;
proto_tree *ti=NULL,*rdm_tree=NULL;
-
+ proto_item* item;
+
/* Set the protocol column */
if(check_col(pinfo->cinfo,COL_PROTOCOL)){
col_set_str(pinfo->cinfo,COL_PROTOCOL,"RDM");
@@ -106,6 +108,8 @@
if (tree)
{
+ start_offset = offset;
+
proto_tree_add_item(rdm_tree, hf_rdm_sub_start_code, tvb,
offset, 1, FALSE);
offset += 1;
@@ -143,8 +147,21 @@
offset, mdb_size, FALSE);
offset += mdb_size;
- proto_tree_add_item(rdm_tree, hf_rdm_checksum, tvb,
+ calc_checksum = 0x00f0;
+ for( i = start_offset; i < offset; i++)
+ {
+ calc_checksum += tvb_get_guint8( tvb, i );
+ }
+
+ checksum = tvb_get_ntohs( tvb, offset );
+ item = proto_tree_add_item(rdm_tree, hf_rdm_checksum, tvb,
offset, 2, FALSE);
+
+ if( calc_checksum != checksum )
+ proto_item_append_text( item, " ( INCORRECT should be 0x%04x )", calc_checksum );
+ else
+ proto_item_append_text( item, " ( CORRECT )" );
+
offset += 2;
}
}