summaryrefslogtreecommitdiff
path: root/epan/proto.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-07-21 10:21:25 -0400
committerAnders Broman <a.broman58@gmail.com>2016-07-27 03:40:02 +0000
commit8b0e9c66728f6a39bbe3ada1029e13ad1378013a (patch)
treec0c1b4da1845069520d4e131db96e6143e4ca772 /epan/proto.c
parentb7f1e99f7f4c75fa4bac1ccba77087fb0e50b8ac (diff)
downloadwireshark-8b0e9c66728f6a39bbe3ada1029e13ad1378013a.tar.gz
Follow up for proto_tree_add_checksum.
Fill in the "gaps" so that all dissectors that verify checksums have both a status and expert info field. Also address comments from original proto_tree_add_checksum patch that didn't make it. Ping-Bug: 8859 Change-Id: I2e6640108fd6bb218cb959fe9e4ba98a13e43a2f Reviewed-on: https://code.wireshark.org/review/16590 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/proto.c')
-rw-r--r--epan/proto.c28
1 files changed, 3 insertions, 25 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 86c15bcd39..fbf0b70bc4 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -10118,31 +10118,9 @@ proto_tree_add_checksum(proto_tree *tree, tvbuff_t *tvb, const guint offset,
if (bad_checksum_expert != NULL)
expert_add_info_format(pinfo, ti, bad_checksum_expert, "Bad checksum");
} else {
- switch(hfinfo->type)
- {
- case FT_UINT8:
- proto_item_append_text(ti, " [incorrect, should be 0x%02x]", computed_checksum);
- if (bad_checksum_expert != NULL)
- expert_add_info_format(pinfo, ti, bad_checksum_expert, "Bad checksum [should be 0x%02x]", computed_checksum);
- break;
- case FT_UINT16:
- proto_item_append_text(ti, " [incorrect, should be 0x%04x]", computed_checksum);
- if (bad_checksum_expert != NULL)
- expert_add_info_format(pinfo, ti, bad_checksum_expert, "Bad checksum [should be 0x%04x]", computed_checksum);
- break;
- case FT_UINT24:
- proto_item_append_text(ti, " [incorrect, should be 0x%06x]", computed_checksum);
- if (bad_checksum_expert != NULL)
- expert_add_info_format(pinfo, ti, bad_checksum_expert, "Bad checksum [should be 0x%06x]", computed_checksum);
- break;
- case FT_UINT32:
- proto_item_append_text(ti, " [incorrect, should be 0x%08x]", computed_checksum);
- if (bad_checksum_expert != NULL)
- expert_add_info_format(pinfo, ti, bad_checksum_expert, "Bad checksum [should be 0x%08x]", computed_checksum);
- break;
- default:
- DISSECTOR_ASSERT_NOT_REACHED();
- }
+ proto_item_append_text(ti, " incorrect, should be 0x%0*x", len*2, computed_checksum);
+ if (bad_checksum_expert != NULL)
+ expert_add_info_format(pinfo, ti, bad_checksum_expert, "Bad checksum [should be 0x%0*x]", len*2, computed_checksum);
}
}
} else {