Ethereal-dev: [Ethereal-dev] a patch for packet-dec-bpdu.c

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Paul Ionescu <paul@xxxxxxxx>
Date: Sat, 06 Jan 2001 15:13:24 +0200
Hello,

I just found out how to report the actual size of a packet with
"tvb_set_reported_length()".
and I updated the packet-dec-bpdu.c dissector to report the actual size
of an dec-bpdu packet.
Attached to this email is a patch to packet-dec-bpdu.c. (I am sorry I
didn't find out this yesterday when I send the full dissector, but there
is no information about "tvb_set_reported_length()" in README.developer
and I had to find it by myself by looking in to the sources).
One can use the sample capture I've sent yesterday to see the
difference.

Please commit if it is ok.
--- packet-dec-bpdu.c.prev	Sat Jan  6 14:50:48 2001
+++ packet-dec-bpdu.c	Sat Jan  6 14:48:13 2001
@@ -61,6 +61,9 @@
 #define BPDU_MAX_AGE            25
 #define BPDU_FORWARD_DELAY      26
 
+#define DEC_BPDU_SIZE		27
+
+
 static int proto_dec_bpdu = -1;
 
 static gint ett_dec_bpdu = -1;
@@ -91,13 +94,15 @@
 	    else if (bpdu_type == 0x02)
 		  col_add_fstr(pinfo->fd, COL_INFO, "Topology Change Notification");
       }
+      
+      tvb_set_reported_length(tvb, DEC_BPDU_SIZE);
 
       if (tree) {
 	    protocol_identifier = tvb_get_guint8(tvb, BPDU_DEC_CODE);
 
 	    protocol_version = tvb_get_guint8(tvb, BPDU_VERSION);
 
-	    ti = proto_tree_add_protocol_format(tree, proto_dec_bpdu, tvb, 0, 27,
+	    ti = proto_tree_add_protocol_format(tree, proto_dec_bpdu, tvb, 0, DEC_BPDU_SIZE,
 			    	"DEC Spanning Tree Protocol");
 	    bpdu_tree = proto_item_add_subtree(ti, ett_dec_bpdu);