From 8b0e9c66728f6a39bbe3ada1029e13ad1378013a Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Thu, 21 Jul 2016 10:21:25 -0400 Subject: 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 Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-cdp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'epan/dissectors/packet-cdp.c') diff --git a/epan/dissectors/packet-cdp.c b/epan/dissectors/packet-cdp.c index b61a7097cc..9cd59d06cb 100644 --- a/epan/dissectors/packet-cdp.c +++ b/epan/dissectors/packet-cdp.c @@ -145,6 +145,7 @@ static gint ett_cdp_checksum = -1; static expert_field ei_cdp_invalid_data = EI_INIT; static expert_field ei_cdp_nrgyz_tlvlength = EI_INIT; +static expert_field ei_cdp_checksum = EI_INIT; static int dissect_address_tlv(tvbuff_t *tvb, int offset, int length, proto_tree *tree); @@ -336,7 +337,7 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, data_length); } - proto_tree_add_checksum(cdp_tree, tvb, offset, hf_cdp_checksum, hf_cdp_checksum_status, NULL, pinfo, in_cksum(cksum_vec, 1), + proto_tree_add_checksum(cdp_tree, tvb, offset, hf_cdp_checksum, hf_cdp_checksum_status, &ei_cdp_checksum, pinfo, in_cksum(cksum_vec, 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); offset += 2; @@ -1424,7 +1425,9 @@ proto_register_cdp(void) static ei_register_info ei[] = { { &ei_cdp_invalid_data, { "cdp.invalid_data", PI_MALFORMED, PI_ERROR, "Invalid bytes at end", EXPFILL }}, { &ei_cdp_nrgyz_tlvlength, { "cdp.nrgyz_tlv.length.invalid", PI_MALFORMED, PI_ERROR, "TLV with invalid length", EXPFILL }}, + { &ei_cdp_checksum, { "cdp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; + expert_module_t* expert_cdp; proto_cdp = proto_register_protocol("Cisco Discovery Protocol", "CDP", "cdp"); -- cgit v1.2.1