diff options
Diffstat (limited to 'epan/dissectors/packet-carp.c')
-rw-r--r-- | epan/dissectors/packet-carp.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/epan/dissectors/packet-carp.c b/epan/dissectors/packet-carp.c index b9d5e347bd..36a05ee243 100644 --- a/epan/dissectors/packet-carp.c +++ b/epan/dissectors/packet-carp.c @@ -46,6 +46,7 @@ static gint hf_carp_demotion = -1; static gint hf_carp_advbase = -1; static gint hf_carp_counter = -1; static gint hf_carp_hmac = -1; +static gint hf_carp_checksum = -1; #define CARP_VERSION_MASK 0xf0 #define CARP_TYPE_MASK 0x0f @@ -134,6 +135,7 @@ dissect_carp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) offset++; cksum = tvb_get_ntohs(tvb, offset); + ti = proto_tree_add_item(carp_tree, hf_carp_checksum, tvb, offset, 2, ENC_BIG_ENDIAN); carp_len = (gint)tvb_reported_length(tvb); if (!pinfo->fragmented && (gint)tvb_length(tvb) >= carp_len) { /* The packet isn't part of a fragmented datagram @@ -142,19 +144,13 @@ dissect_carp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) cksum_vec[0].len = carp_len; computed_cksum = in_cksum(&cksum_vec[0], 1); if (computed_cksum == 0) { - proto_tree_add_text(carp_tree, tvb, offset, 2, - "Checksum: 0x%04x [correct]", - cksum); + proto_item_append_text(ti, " [correct]"); } else { - proto_tree_add_text(carp_tree, tvb, offset, 2, - "Checksum: 0x%04x [incorrect, should be 0x%04x]", - cksum, + proto_item_append_text(ti, " [incorrect, should be 0x%04x]", in_cksum_shouldbe(cksum, computed_cksum)); } - } else { - proto_tree_add_text(carp_tree, tvb, offset, 2, - "Checksum: 0x%04x", cksum); } + offset+=2; /* Counter */ @@ -229,6 +225,11 @@ void proto_register_carp(void) {"HMAC", "carp.hmac", FT_BYTES, BASE_NONE, NULL, 0x0, "SHA-1 HMAC", HFILL }}, + + { &hf_carp_checksum, + {"Checksum", "carp.checksum", + FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL }}, }; static gint *ett[] = { |