aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-cattp.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/dissectors/packet-cattp.c
parentb7f1e99f7f4c75fa4bac1ccba77087fb0e50b8ac (diff)
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/dissectors/packet-cattp.c')
-rw-r--r--epan/dissectors/packet-cattp.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/epan/dissectors/packet-cattp.c b/epan/dissectors/packet-cattp.c
index 10e489c536..9237e5a4f5 100644
--- a/epan/dissectors/packet-cattp.c
+++ b/epan/dissectors/packet-cattp.c
@@ -28,6 +28,7 @@
#include <epan/packet.h>
#include <epan/prefs.h>
+#include <epan/expert.h>
#include <epan/in_cksum.h>
#define CATTP_SHORTNAME "CAT-TP"
@@ -97,6 +98,8 @@ static int hf_cattp_rc = -1;
static int hf_cattp_eaklen = -1;
static int hf_cattp_eaks = -1;
+static expert_field ei_cattp_checksum = EI_INIT;
+
/* Preference to control whether to check the CATTP checksum */
static gboolean cattp_check_checksum = TRUE;
@@ -296,14 +299,15 @@ dissect_cattp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
cksum_data_len = hlen + plen;
if (!cattp_check_checksum) {
/* We have turned checksum checking off; we do NOT checksum it. */
- proto_tree_add_checksum(cattp_tree, tvb, offset, hf_cattp_checksum, hf_cattp_checksum_status, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
+ proto_tree_add_checksum(cattp_tree, tvb, offset, hf_cattp_checksum, hf_cattp_checksum_status, &ei_cattp_checksum,
+ pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
} else {
/* We haven't turned checksum checking off; checksum it. */
/* Unlike TCP, CATTP does not make use of a pseudo-header for checksum */
SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, header_offset, cksum_data_len);
- proto_tree_add_checksum(cattp_tree, tvb, offset, hf_cattp_checksum, hf_cattp_checksum_status, NULL, pinfo, in_cksum(cksum_vec, 1),
- ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM);
+ proto_tree_add_checksum(cattp_tree, tvb, offset, hf_cattp_checksum, hf_cattp_checksum_status, &ei_cattp_checksum,
+ pinfo, in_cksum(cksum_vec, 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM);
} /* End of checksum code */
offset += 2;
@@ -538,7 +542,12 @@ proto_register_cattp(void)
&ett_cattp_eaks
};
+ static ei_register_info ei[] = {
+ { &ei_cattp_checksum, { "cattp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
+ };
+
module_t *cattp_module;
+ expert_module_t* expert_cattp;
proto_cattp = proto_register_protocol (
"ETSI Card Application Toolkit Transport Protocol", /* name */
@@ -548,6 +557,8 @@ proto_register_cattp(void)
proto_register_field_array(proto_cattp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ expert_cattp = expert_register_protocol(proto_cattp);
+ expert_register_field_array(expert_cattp, ei, array_length(ei));
cattp_module = prefs_register_protocol(proto_cattp, proto_reg_handoff_cattp);
prefs_register_bool_preference(cattp_module, "checksum",