From d80dbe533cb927ca16912c6ca9dead2d165362e9 Mon Sep 17 00:00:00 2001 From: Dylan Ulis Date: Mon, 12 Feb 2018 09:06:16 -0500 Subject: Display configured checksum Expert summary string Previously, checksum code would override the expert_field summary string configured by dissectors, and display the generic "Bad checksum" string in the Expert Information dialog. This change uses the configured expert_field summary string instead. eg: "CRC-S1 incorrect [should be 0xff]" instead of "Bad checksum [should be 0xff]" This fixes problem #2 in the linked bug. Bug: 14425 Change-Id: I168b2be92ec2d8d6f956beeaf6292574bc1d9dab Reviewed-on: https://code.wireshark.org/review/25758 Reviewed-by: Peter Wu Petri-Dish: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-cipsafety.c | 6 +++--- epan/proto.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/epan/dissectors/packet-cipsafety.c b/epan/dissectors/packet-cipsafety.c index f73b8f63b8..29e7c5f5af 100644 --- a/epan/dissectors/packet-cipsafety.c +++ b/epan/dissectors/packet-cipsafety.c @@ -1584,7 +1584,7 @@ dissect_cip_safety_data( proto_tree *tree, proto_item *item, tvbuff_t *tvb, int { proto_item_append_text(crc_s5_item, " incorrect, should be 0x%08x", test_crc_c5); crc_s5_status_item = proto_tree_add_uint(tree, hf_cipsafety_crc_s5_status, tvb, 5, 0, PROTO_CHECKSUM_E_BAD); - expert_add_info_format(pinfo, crc_s5_item, &ei_cipsafety_crc_s5, "Bad checksum [should be 0x%08x]", test_crc_c5); + expert_add_info_format(pinfo, crc_s5_item, &ei_cipsafety_crc_s5, "%s [should be 0x%08x]", expert_get_summary(&ei_cipsafety_crc_s5), test_crc_c5); } } else @@ -1831,7 +1831,7 @@ dissect_cip_safety_data( proto_tree *tree, proto_item *item, tvbuff_t *tvb, int { proto_item_append_text(crc_s5_item, " incorrect, should be 0x%08x", test_crc_c5); crc_s5_status_item = proto_tree_add_uint(tree, hf_cipsafety_crc_s5_status, tvb, io_data_size+5, 0, PROTO_CHECKSUM_E_BAD); - expert_add_info_format(pinfo, crc_s5_item, &ei_cipsafety_crc_s5, "Bad checksum [should be 0x%08x]", test_crc_c5); + expert_add_info_format(pinfo, crc_s5_item, &ei_cipsafety_crc_s5, "%s [should be 0x%08x]", expert_get_summary(&ei_cipsafety_crc_s5), test_crc_c5); } } else @@ -1933,7 +1933,7 @@ dissect_cip_safety_data( proto_tree *tree, proto_item *item, tvbuff_t *tvb, int { proto_item_append_text(crc_s5_item, " incorrect, should be 0x%08x", test_crc_c5); crc_s5_status_item = proto_tree_add_uint(tree, hf_cipsafety_crc_s5_status, tvb, (io_data_size*2)+7, 0, PROTO_CHECKSUM_E_BAD); - expert_add_info_format(pinfo, crc_s5_item, &ei_cipsafety_crc_s5, "Bad checksum [should be 0x%08x]", test_crc_c5); + expert_add_info_format(pinfo, crc_s5_item, &ei_cipsafety_crc_s5, "%s [should be 0x%08x]", expert_get_summary(&ei_cipsafety_crc_s5), test_crc_c5); } } else diff --git a/epan/proto.c b/epan/proto.c index 20d075098d..2e4f11e252 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -12037,11 +12037,11 @@ proto_tree_add_checksum(proto_tree *tree, tvbuff_t *tvb, const guint offset, if (flags & PROTO_CHECKSUM_ZERO) { proto_item_append_text(ti, " [incorrect]"); if (bad_checksum_expert != NULL) - expert_add_info_format(pinfo, ti, bad_checksum_expert, "Bad checksum"); + expert_add_info_format(pinfo, ti, bad_checksum_expert, "%s", expert_get_summary(bad_checksum_expert)); } else { 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); + expert_add_info_format(pinfo, ti, bad_checksum_expert, "%s [should be 0x%0*x]", expert_get_summary(bad_checksum_expert), len * 2, computed_checksum); } } } else { -- cgit v1.2.3