aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-vrrp.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-vrrp.c')
-rw-r--r--epan/dissectors/packet-vrrp.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/epan/dissectors/packet-vrrp.c b/epan/dissectors/packet-vrrp.c
index 00fa9cf9cd..e2819bd4c1 100644
--- a/epan/dissectors/packet-vrrp.c
+++ b/epan/dissectors/packet-vrrp.c
@@ -47,7 +47,7 @@ static gint hf_vrrp_virt_rtr_id = -1;
static gint hf_vrrp_prio = -1;
static gint hf_vrrp_addr_count = -1;
static gint hf_vrrp_checksum = -1;
-static gint hf_vrrp_checksum_bad = -1;
+static gint hf_vrrp_checksum_status = -1;
static gint hf_vrrp_auth_type = -1;
static gint hf_vrrp_adver_int = -1;
static gint hf_vrrp_reserved_mbz = -1;
@@ -101,10 +101,10 @@ dissect_vrrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
vec_t cksum_vec[4];
guint32 phdr[2];
gboolean is_ipv6;
- proto_item *ti, *tv, *hidden_item, *checksum_item;
+ proto_item *ti, *tv;
proto_tree *vrrp_tree, *ver_type_tree;
guint8 priority, addr_count = 0, auth_type = VRRP_AUTH_TYPE_NONE;
- guint16 cksum, computed_cksum;
+ guint16 computed_cksum;
is_ipv6 = (pinfo->src.type == AT_IPv6);
@@ -168,10 +168,6 @@ dissect_vrrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
offset += 6;
}
-
- checksum_item = proto_tree_add_item(vrrp_tree, hf_vrrp_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
-
- cksum = tvb_get_ntohs(tvb, offset);
vrrp_len = (gint)tvb_reported_length(tvb);
if (!pinfo->fragmented && (gint)tvb_captured_length(tvb) >= vrrp_len) {
/* The packet isn't part of a fragmented datagram
@@ -196,22 +192,11 @@ dissect_vrrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
break;
}
- if (computed_cksum == 0) {
- hidden_item = proto_tree_add_boolean(vrrp_tree, hf_vrrp_checksum_bad, tvb, offset, 2, FALSE);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- proto_item_append_text(checksum_item, " [correct]");
- } else {
- hidden_item = proto_tree_add_boolean(vrrp_tree, hf_vrrp_checksum_bad, tvb, offset, 2, TRUE);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- if(hi_nibble(ver_type)==3){
- proto_item_append_text(checksum_item, " [incorrect, should be 0x%04x(check preferences)]", in_cksum_shouldbe(cksum, computed_cksum));
- } else {
- proto_item_append_text(checksum_item, " [incorrect, should be 0x%04x]", in_cksum_shouldbe(cksum, computed_cksum));
- }
- expert_add_info_format(pinfo, checksum_item, &ei_vrrp_checksum,
- "VRRP Checksum Incorrect, should be 0x%04x", in_cksum_shouldbe(cksum, computed_cksum));
- }
-
+ proto_tree_add_checksum(vrrp_tree, tvb, offset, hf_vrrp_checksum, hf_vrrp_checksum_status, &ei_vrrp_checksum, pinfo, computed_cksum,
+ ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM);
+ } else {
+ proto_tree_add_checksum(vrrp_tree, tvb, offset, hf_vrrp_checksum, hf_vrrp_checksum_status, &ei_vrrp_checksum, pinfo, 0,
+ ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
}
offset += 2;
@@ -273,9 +258,9 @@ void proto_register_vrrp(void)
FT_UINT16, BASE_HEX, NULL, 0x0,
"Used to detect data corruption in the VRRP message", HFILL }},
- { &hf_vrrp_checksum_bad,
- { "Bad Checksum", "vrrp.checksum_bad",
- FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+ { &hf_vrrp_checksum_status,
+ { "Checksum Status", "vrrp.checksum.status",
+ FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
NULL, HFILL }},
{ &hf_vrrp_auth_type,