aboutsummaryrefslogtreecommitdiffstats
path: root/epan/proto.c
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2022-04-09 16:32:21 +0100
committerA Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2022-04-26 16:50:59 +0000
commitd517feee74c39b37486aabce80c4aaa61e5afcb4 (patch)
treee328985dea1aaed3d342c9186c458b07e094e1d8 /epan/proto.c
parentb53d349583d688c696a3f482fe6a6d9a607a2171 (diff)
epan: Add more bookkeeping for layers
Packet info already contains the notion of layer depth for the current protocol, among all the protocols in the frame. This adds an extra layer number for the protocols that are the same as the current one. Obviously this will only go above one if the protocol is repeated in the stack, such as with IP tunneling. Adds extra logic to track numbers for each protocol in the frame and update them when calling a dissector. The total layer number and protocol layer number are store in the field info structure so they can be used after dissection, namely by display filters.
Diffstat (limited to 'epan/proto.c')
-rw-r--r--epan/proto.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/epan/proto.c b/epan/proto.c
index b9522a9ec8..5f6dfab82d 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -6309,6 +6309,9 @@ new_field_info(proto_tree *tree, header_field_info *hfinfo, tvbuff_t *tvb,
fi->appendix_start = 0;
fi->appendix_length = 0;
+ fi->total_layer_num = tree->tree_data->pinfo->curr_layer_num;
+ fi->proto_layer_num = tree->tree_data->pinfo->curr_proto_layer_num;
+
return fi;
}