aboutsummaryrefslogtreecommitdiffstats
path: root/ui/proto_hier_stats.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2016-01-14 11:47:04 -0800
committerGerald Combs <gerald@wireshark.org>2016-01-15 17:56:46 +0000
commitbebb63bea9cf58665a31c78abcbbe82658b1e49d (patch)
tree98b70dfe903c6a615945899749e941fe956c986b /ui/proto_hier_stats.c
parent3b2e7b67db8e9a0f1a7d36a6a5ad5690f1537ac8 (diff)
Keep comments from stealing hierarchy statistics.
If a packet has a comment, the Protocol Hierarchy Statistics dialog will add its stats to a top-level "Packet comments" node instead of the "Frame" node. Add a check for the pkt_comment protocol ID and skip over it if we find it. Affects Wireshark 2.0, 1.12, 1.10, and probably earlier versions. As an alternative we could always force "Frame" to be the first item in the tree. Change-Id: If7cd817071caf6219515f5d8121b3a1a2c0d79a6 Reviewed-on: https://code.wireshark.org/review/13297 Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/proto_hier_stats.c')
-rw-r--r--ui/proto_hier_stats.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/ui/proto_hier_stats.c b/ui/proto_hier_stats.c
index 4857052496..dea3c3e92c 100644
--- a/ui/proto_hier_stats.c
+++ b/ui/proto_hier_stats.c
@@ -26,7 +26,8 @@
#include "frame_tvbuff.h"
#include "ui/proto_hier_stats.h"
#include "ui/progress_dlg.h"
-#include <epan/epan_dissect.h>
+#include "epan/epan_dissect.h"
+#include "epan/proto.h"
#include <string.h>
@@ -36,6 +37,7 @@
#define STAT_NODE_STATS(n) ((ph_stats_node_t*)(n)->data)
#define STAT_NODE_HFINFO(n) (STAT_NODE_STATS(n)->hfinfo)
+static int pc_proto_id = -1;
static GNode*
find_stat_node(GNode *parent_stat_node, header_field_info *needle_hfinfo)
@@ -122,7 +124,16 @@ process_tree(proto_tree *protocol_tree, ph_stats_t* ps, guint pkt_len)
{
proto_node *ptree_node;
+ /*
+ * If our first item is a comment, skip over it. This keeps
+ * us from having a top-level "Packet comments" item that
+ * steals items from "Frame".
+ */
ptree_node = ((proto_node *)protocol_tree)->first_child;
+ if (ptree_node && ptree_node->finfo->hfinfo->id == pc_proto_id) {
+ ptree_node = ptree_node->next;
+ }
+
if (!ptree_node) {
return;
}
@@ -189,6 +200,8 @@ ph_stats_new(capture_file *cf)
if (!cf) return NULL;
+ pc_proto_id = proto_get_id_by_filter_name("pkt_comment");
+
/* Initialize the data */
ps = g_new(ph_stats_t, 1);
ps->tot_packets = 0;