diff options
-rw-r--r-- | epan/dissectors/packet-frame.c | 28 | ||||
-rw-r--r-- | epan/packet.c | 20 | ||||
-rw-r--r-- | epan/packet_info.h | 1 |
3 files changed, 26 insertions, 23 deletions
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c index 2974168925..edb17f8814 100644 --- a/epan/dissectors/packet-frame.c +++ b/epan/dissectors/packet-frame.c @@ -264,19 +264,23 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) ti = proto_tree_add_boolean(fh_tree, hf_frame_marked, tvb, 0, 0,pinfo->fd->flags.marked); PROTO_ITEM_SET_GENERATED(ti); - /* we are going to be using proto_item_append_string() on - * hf_frame_protocols, and we must therefore disable the - * TRY_TO_FAKE_THIS_ITEM() optimisation for the tree by - * setting it as visible. - * - * See proto.h for details. - */ - old_visible = proto_tree_set_visible(fh_tree, TRUE); - ti = proto_tree_add_string(fh_tree, hf_frame_protocols, tvb, 0, 0, ""); - PROTO_ITEM_SET_GENERATED(ti); - proto_tree_set_visible(fh_tree, old_visible); + if(proto_field_is_referenced(tree, hf_frame_protocols)) { + /* we are going to be using proto_item_append_string() on + * hf_frame_protocols, and we must therefore disable the + * TRY_TO_FAKE_THIS_ITEM() optimisation for the tree by + * setting it as visible. + * + * See proto.h for details. + */ + old_visible = proto_tree_set_visible(fh_tree, TRUE); + ti = proto_tree_add_string(fh_tree, hf_frame_protocols, tvb, 0, 0, ""); + PROTO_ITEM_SET_GENERATED(ti); + proto_tree_set_visible(fh_tree, old_visible); - pinfo->layer_names = g_string_new(""); + pinfo->layer_names = g_string_new(""); + } + else + pinfo->layer_names = NULL; /* Check for existences of P2P pseudo header */ if (pinfo->p2p_dir != P2P_DIR_UNKNOWN) { diff --git a/epan/packet.c b/epan/packet.c index b056d391a1..249310da89 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -293,7 +293,7 @@ dissect_packet(epan_dissect_t *edt, union wtap_pseudo_header *pseudo_header, edt->pi.link_dir = LINK_DIR_UNKNOWN; EP_CHECK_CANARY(("before dissecting frame %d",fd->num)); - + TRY { edt->tvb = tvb_new_real_data(pd, fd->cap_len, fd->pkt_len); /* Add this tvbuffer into the data_src list */ @@ -322,7 +322,7 @@ dissect_packet(epan_dissect_t *edt, union wtap_pseudo_header *pseudo_header, RETHROW; } ENDTRY; - + EP_CHECK_CANARY(("after dissecting frame %d",fd->num)); fd->flags.visited = 1; @@ -453,8 +453,8 @@ call_dissector_work(dissector_handle_t handle, tvbuff_t *tvb, if ((pinfo->layer_names)&&(add_proto_name)) { 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(handle->protocol))); + g_string_append(pinfo->layer_names, + proto_get_protocol_filter_name(proto_get_id(handle->protocol))); } } @@ -473,8 +473,7 @@ call_dissector_work(dissector_handle_t handle, tvbuff_t *tvb, * of protocols. */ if ((pinfo->layer_names != NULL)&&(add_proto_name)) { - g_string_truncate(pinfo->layer_names, - saved_layer_names_len); + g_string_truncate(pinfo->layer_names, saved_layer_names_len); } } pinfo->current_proto = saved_proto; @@ -699,13 +698,13 @@ dissector_add(const char *name, guint32 pattern, dissector_handle_t handle) #if 0 if (pattern == 0) { g_warning("%s: %s registering using a pattern of 0", - name, proto_get_protocol_filter_name(proto_get_id(handle->protocol))); + name, proto_get_protocol_filter_name(proto_get_id(handle->protocol))); } dtbl_entry = g_hash_table_lookup(sub_dissectors->hash_table, GUINT_TO_POINTER(pattern)); if (dtbl_entry != NULL) { g_warning("%s: %s registering using pattern %d already registered by %s", - name, proto_get_protocol_filter_name(proto_get_id(handle->protocol)), + name, proto_get_protocol_filter_name(proto_get_id(handle->protocol)), pattern, proto_get_protocol_filter_name(proto_get_id(dtbl_entry->initial->protocol))); } #endif @@ -1590,7 +1589,7 @@ dissector_try_heuristic(heur_dissector_list_t sub_dissectors, if (pinfo->layer_names) { if (pinfo->layer_names->len > 0) g_string_append(pinfo->layer_names, ":"); - g_string_append(pinfo->layer_names, + g_string_append(pinfo->layer_names, proto_get_protocol_filter_name(proto_get_id(dtbl_entry->protocol))); } } @@ -1611,8 +1610,7 @@ dissector_try_heuristic(heur_dissector_list_t sub_dissectors, * of protocols. */ if (pinfo->layer_names != NULL) { - g_string_truncate(pinfo->layer_names, - saved_layer_names_len); + g_string_truncate(pinfo->layer_names, saved_layer_names_len); } } } diff --git a/epan/packet_info.h b/epan/packet_info.h index f5da1e1c54..393b7a7f7d 100644 --- a/epan/packet_info.h +++ b/epan/packet_info.h @@ -174,6 +174,7 @@ typedef struct _packet_info { * in the SCTP packet */ void *private_data; /* pointer to data passed from one dissector to another */ + /* TODO: Use emem_strbuf_t instead */ GString *layer_names; /* layers of each protocol */ guint16 link_number; guint8 annex_a_used; |