diff options
author | Michael Mann <mmann78@netscape.net> | 2016-07-21 10:21:25 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-07-27 03:40:02 +0000 |
commit | 8b0e9c66728f6a39bbe3ada1029e13ad1378013a (patch) | |
tree | c0c1b4da1845069520d4e131db96e6143e4ca772 /epan/dissectors/packet-carp.c | |
parent | b7f1e99f7f4c75fa4bac1ccba77087fb0e50b8ac (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-carp.c')
-rw-r--r-- | epan/dissectors/packet-carp.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/epan/dissectors/packet-carp.c b/epan/dissectors/packet-carp.c index a5a276d529..2243728cee 100644 --- a/epan/dissectors/packet-carp.c +++ b/epan/dissectors/packet-carp.c @@ -26,6 +26,7 @@ #include <epan/packet.h> #include <epan/ipproto.h> +#include <epan/expert.h> #include <epan/in_cksum.h> void proto_register_carp(void); @@ -46,6 +47,9 @@ static gint hf_carp_advbase = -1; static gint hf_carp_counter = -1; static gint hf_carp_hmac = -1; static gint hf_carp_checksum = -1; +static gint hf_carp_checksum_status = -1; + +static expert_field ei_carp_checksum = EI_INIT; #define CARP_VERSION_MASK 0xf0 #define CARP_TYPE_MASK 0x0f @@ -137,10 +141,10 @@ dissect_carp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) /* The packet isn't part of a fragmented datagram and isn't truncated, so we can checksum it. */ SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, carp_len); - proto_tree_add_checksum(carp_tree, tvb, offset, hf_carp_checksum, -1, NULL, pinfo, in_cksum(&cksum_vec[0], 1), + proto_tree_add_checksum(carp_tree, tvb, offset, hf_carp_checksum, hf_carp_checksum_status, &ei_carp_checksum, pinfo, in_cksum(&cksum_vec[0], 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); } else { - proto_tree_add_checksum(carp_tree, tvb, offset, hf_carp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(carp_tree, tvb, offset, hf_carp_checksum, hf_carp_checksum_status, &ei_carp_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } offset+=2; @@ -222,6 +226,11 @@ void proto_register_carp(void) {"Checksum", "carp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + + { &hf_carp_checksum_status, + {"Checksum Status", "carp.checksum.status", + FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, + NULL, HFILL }}, }; static gint *ett[] = { @@ -229,10 +238,17 @@ void proto_register_carp(void) &ett_carp_ver_type }; - proto_carp = proto_register_protocol("Common Address Redundancy Protocol", - "CARP", "carp"); + static ei_register_info ei[] = { + { &ei_carp_checksum, { "carp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_carp; + + proto_carp = proto_register_protocol("Common Address Redundancy Protocol", "CARP", "carp"); proto_register_field_array(proto_carp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_carp = expert_register_protocol(proto_carp); + expert_register_field_array(expert_carp, ei, array_length(ei)); } void |