Ethereal-dev: Re: [Ethereal-dev] Re: [Ethereal-cvs] rev 13118: /trunk/epan/dissectors/: packet
This time it works (tested with eth:ip:udp:nbdgm:smb:browser - we miss
smb mails slot because it's called directly by smb).
(please tell me if my patch is not well formatted)
--
Julien Leproust
Index: epan/packet.c
===================================================================
--- epan/packet.c (revision 13118)
+++ epan/packet.c (working copy)
@@ -1437,6 +1437,7 @@
GSList *entry;
heur_dtbl_entry_t *dtbl_entry;
guint16 saved_can_desegment;
+ GString *saved_layer_names = NULL;
/* can_desegment is set to 2 by anyone which offers this api/service.
then everytime a subdissector is called it is decremented by one.
@@ -1453,10 +1454,15 @@
status = FALSE;
saved_proto = pinfo->current_proto;
+
+ if(pinfo->layer_names)
+ saved_layer_names = g_string_new(pinfo->layer_names->str);
+
for (entry = sub_dissectors; entry != NULL; entry = g_slist_next(entry)) {
/* XXX - why set this now and above? */
pinfo->can_desegment = saved_can_desegment-(saved_can_desegment>0);
dtbl_entry = (heur_dtbl_entry_t *)entry->data;
+
if (dtbl_entry->protocol != NULL &&
!proto_is_protocol_enabled(dtbl_entry->protocol)) {
/*
@@ -1469,9 +1475,27 @@
pinfo->current_proto =
proto_get_protocol_short_name(dtbl_entry->protocol);
}
+
+ /*
+ * Add the protocol name to the layers
+ */
+ if (pinfo->layer_names) {
+ if (pinfo->layer_names->len > 0)
+ g_string_append(pinfo->layer_names, ":");
+ g_string_append(pinfo->layer_names,
+ proto_get_protocol_filter_name(proto_get_id(dtbl_entry->protocol)));
+ }
+
if ((*dtbl_entry->dissector)(tvb, pinfo, tree)) {
status = TRUE;
+ if(saved_layer_names)
+ g_string_free(saved_layer_names, TRUE);
+
break;
+ } else if(saved_layer_names) {
+ g_string_free(pinfo->layer_names, TRUE);
+ pinfo->layer_names = g_string_new(saved_layer_names->str);
+
}
}
pinfo->current_proto = saved_proto;