summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-frame.c
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2015-02-04 10:25:16 +0100
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2015-02-12 11:14:24 +0000
commit60cc8b4fd8a8584bace71cb9cd2b59f9d450a0ce (patch)
treed93a661c6d0cf87cfc78f4adf7adda99195fb523 /epan/dissectors/packet-frame.c
parent207b52a9888e5b10abc5a0400ef534eee6766ad1 (diff)
downloadwireshark-60cc8b4fd8a8584bace71cb9cd2b59f9d450a0ce.tar.gz
Support for looking for incomplete dissectors.
Change-Id: I03e592dd3d54fc0e1c4af09d5d5336dda93f950e Reviewed-on: https://code.wireshark.org/review/6978 Reviewed-by: Evan Huus <eapache@gmail.com> Petri-Dish: Evan Huus <eapache@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-frame.c')
-rw-r--r--epan/dissectors/packet-frame.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c
index 0ac617a089..52a1384b08 100644
--- a/epan/dissectors/packet-frame.c
+++ b/epan/dissectors/packet-frame.c
@@ -40,6 +40,7 @@
#include <wsutil/md5.h>
#include "packet-frame.h"
+#include "log.h"
#include "color.h"
#include "color_filters.h"
@@ -91,6 +92,7 @@ static gint ett_comments = -1;
static expert_field ei_comments_text = EI_INIT;
static expert_field ei_arrive_time_out_of_range = EI_INIT;
+static expert_field ei_incomplete = EI_INIT;
static int frame_tap = -1;
@@ -626,6 +628,32 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
pinfo->frame_end_routines = NULL;
}
+ if (prefs.enable_incomplete_dissectors_check && tree && tree->tree_data->visible) {
+ gchar* decoded;
+ guint length;
+ guint i;
+ guint byte;
+ guint bit;
+
+ length = tvb_captured_length(tvb);
+ decoded = proto_find_undecoded_data(tree, length);
+
+ for (i = 0; i < length; i++) {
+ byte = i / 8;
+ bit = i % 8;
+ if (!(decoded[byte] & (1 << bit))) {
+ field_info* fi = proto_find_field_from_offset(tree, i, tvb);
+ g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_WARNING,
+ "Dissector %s incomplete in frame %u: undecoded byte number %u "
+ "(0x%.4X+%u)\n",
+ (fi ? fi->hfinfo->abbrev : "[unknown]"),
+ pinfo->fd->num, i, i - i % 16, i % 16);
+ expert_add_info_format(pinfo, tree, &ei_incomplete,
+ "Undecoded byte number: %u (0x%.4X+%u)", i, i - i % 16, i % 16);
+ }
+ }
+ }
+
return tvb_captured_length(tvb);
}
@@ -819,6 +847,7 @@ proto_register_frame(void)
static ei_register_info ei[] = {
{ &ei_comments_text, { "frame.comment.expert", PI_COMMENTS_GROUP, PI_COMMENT, "Formatted comment", EXPFILL }},
{ &ei_arrive_time_out_of_range, { "frame.time_invalid", PI_SEQUENCE, PI_NOTE, "Arrival Time: Fractional second out of range (0-1000000000)", EXPFILL }},
+ { &ei_incomplete, { "frame.incomplete", PI_UNDECODED, PI_WARN, "Incomplete dissector", EXPFILL }}
};
module_t *frame_module;