aboutsummaryrefslogtreecommitdiffstats
path: root/proto_hier_stats.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2007-11-29 07:40:08 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2007-11-29 07:40:08 +0000
commitbc953c0b96d582b7f2d4cbdd7c6c3a4bcdd1357c (patch)
treee5e9c55232cf5503b926ff6ea91857bd8eaf3393 /proto_hier_stats.c
parentb1370e46d0513b7e9ba17d63f00fc73254d35196 (diff)
Count stats for parent if encountering a field not related to a protocol.
This fixes a bug where packets having toplevel tree items for desegmentation (like [Reassembled TCP Segments]) are not added to the Protocol Hierarchy Statistics "End Packets" and "End Bytes" columns. svn path=/trunk/; revision=23667
Diffstat (limited to 'proto_hier_stats.c')
-rw-r--r--proto_hier_stats.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/proto_hier_stats.c b/proto_hier_stats.c
index 3710f4f565..d402492098 100644
--- a/proto_hier_stats.c
+++ b/proto_hier_stats.c
@@ -88,17 +88,6 @@ process_node(proto_node *ptree_node, GNode *parent_stat_node, ph_stats_t *ps, gu
finfo = PITEM_FINFO(ptree_node);
g_assert(finfo);
- /* if the field info isn't related to a protocol but to a field, don't count them,
- * as they don't belong to any protocol.
- * (happens e.g. for toplevel tree item of desegmentation "[Reassembled TCP Segments]") */
- if(finfo->hfinfo->parent != -1) {
- /* there are some cases where helpful generated items are added
- * to the decode tree so do not test for it any more
- *g_assert(PROTO_ITEM_IS_GENERATED(ptree_node));
- */
- return;
- }
-
stat_node = find_stat_node(parent_stat_node, finfo->hfinfo);
stats = STAT_NODE_STATS(stat_node);
@@ -107,18 +96,19 @@ process_node(proto_node *ptree_node, GNode *parent_stat_node, ph_stats_t *ps, gu
proto_sibling_node = ptree_node->next;
- if (proto_sibling_node) {
+ /* If the field info isn't related to a protocol but to a field (parent != -1),
+ * don't count them, as they don't belong to any protocol.
+ * (happens e.g. for toplevel tree item of desegmentation "[Reassembled TCP Segments]") */
+ if (proto_sibling_node && proto_sibling_node->finfo->hfinfo->parent == -1) {
/* If the name does not exist for this proto_sibling_node, then it is
* not a normal protocol in the top-level tree. It was instead
* added as a normal tree such as IPv6's Hop-by-hop Option Header and
* should be skipped when creating the protocol hierarchy display. */
- if(strlen(proto_sibling_node->finfo->hfinfo->name) == 0 &&
- ptree_node->next)
+ if(strlen(proto_sibling_node->finfo->hfinfo->name) == 0 && ptree_node->next)
proto_sibling_node = proto_sibling_node->next;
process_node(proto_sibling_node, stat_node, ps, pkt_len);
- }
- else {
+ } else {
stats->num_pkts_last++;
stats->num_bytes_last += pkt_len;
}