We track all protocols that appear in each packet in the frame dissector. This is an expensive operation because we:
* Disable the TRY_TO_FAKE_THIS_ITEM optimization * Use GString to store the protocols We should only do this if the 'hf_frame_protocols' is referenced (unlikely) svn path=/trunk/; revision=29733
This commit is contained in:
parent
820ce62af5
commit
b3b9be09c7
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue