Ethereal-dev: [Ethereal-dev] Patch to packet-mdshdr.c adding preference to decode as
I've attached to a patch to packet-mdshdr.c that adds a preference to
enable/disable decoding of frames with ethertype of 0 as mdshdr frames.
Dinesh
--
Index: packet-mdshdr.c
===================================================================
RCS file: /cvsroot/ethereal/packet-mdshdr.c,v
retrieving revision 1.5
diff -u -r1.5 packet-mdshdr.c
--- packet-mdshdr.c 5 Jun 2003 18:46:41 -0000 1.5
+++ packet-mdshdr.c 6 Jun 2003 21:42:37 -0000
@@ -122,6 +122,8 @@
static dissector_handle_t data_handle, fc_dissector_handle;
+static gboolean decode_if_zero_etype = TRUE;
+
static const value_string sof_vals[] = {
{MDSHDR_SOFc1, "SOFc1"},
{MDSHDR_SOFi1, "SOFi1"},
@@ -166,6 +168,10 @@
guint8 span_id;
int trailer_start = 0;
+ if ((pinfo->ethertype == 0) && !decode_if_zero_etype) {
+ return;
+ }
+
/* 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, "MDS Header");
@@ -289,13 +295,23 @@
&ett_mdshdr_hdr,
&ett_mdshdr_trlr
};
+ module_t *mdshdr_module;
/* Register the protocol name and description */
- proto_mdshdr = proto_register_protocol("MDS Header", "mdshdr", "mdshdr");
+ proto_mdshdr = proto_register_protocol("MDS Header", "MDS Header", "mdshdr");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_mdshdr, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+
+ mdshdr_module = prefs_register_protocol (proto_mdshdr, NULL);
+ prefs_register_bool_preference (mdshdr_module, "decode_if_etype_zero",
+ "Decode as MDS Header If Ethertype == 0",
+ "A frame is considered for decoding as MDSHDR if either "
+ "ethertype is 0xFCFC or zero. Turn this flag off if you "
+ "you don't want ethertype zero to be decoded as MDSHDR. "
+ "This maybe useful to avoid problems with test frames.",
+ &decode_if_zero_etype);
}
--
I am not young enough to know everything. - Oscar Wilde