aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Maynard <Christopher.Maynard@GTECH.COM>2013-03-26 18:08:05 +0000
committerChris Maynard <Christopher.Maynard@GTECH.COM>2013-03-26 18:08:05 +0000
commit67ffb10e649188e64cdb58419ffecfba20e19c0d (patch)
treead004308ff67c1d9f6f2b6afac58e4e5cf218b9b
parent584c14c66cc55a88af24b4326f4e789bb6f09c11 (diff)
Add checksum_bad, set to FALSE to the tree when the checksum is correct. Use PROTO_ITEM_SET_HIDDEN instead of PROTO_ITEM_SET_GENERATED so ICMP and ICMPv6 are consistent.
See: http://ask.wireshark.org/questions/19844/icmp-display-filter-checksum_bad-ignored #BACKPORT(1.6, 1.8) svn path=/trunk/; revision=48563
-rw-r--r--epan/dissectors/packet-icmp.c22
-rw-r--r--epan/dissectors/packet-icmpv6.c5
2 files changed, 18 insertions, 9 deletions
diff --git a/epan/dissectors/packet-icmp.c b/epan/dissectors/packet-icmp.c
index d7c8cad94f..d4bdaba05c 100644
--- a/epan/dissectors/packet-icmp.c
+++ b/epan/dissectors/packet-icmp.c
@@ -881,19 +881,22 @@ dissect_extensions(tvbuff_t * tvb, gint offset, proto_tree * tree)
tvb, offset + 2, 2, cksum,
"Checksum: 0x%04x [correct]",
cksum);
- } else {
hidden_item =
proto_tree_add_boolean(ext_tree,
hf_icmp_ext_checksum_bad, tvb,
- offset + 2, 2, TRUE);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
-
+ offset + 2, 2, FALSE);
+ } else {
proto_tree_add_uint_format(ext_tree, hf_icmp_ext_checksum,
tvb, offset + 2, 2, cksum,
"Checksum: 0x%04x [incorrect, should be 0x%04x]",
cksum, in_cksum_shouldbe(cksum,
computed_cksum));
+ hidden_item =
+ proto_tree_add_boolean(ext_tree,
+ hf_icmp_ext_checksum_bad, tvb,
+ offset + 2, 2, TRUE);
}
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
if (version != 1 && version != 2) {
/* Unsupported version */
@@ -1033,7 +1036,7 @@ static icmp_transaction_t *transaction_start(packet_info * pinfo,
}
if (!PINFO_FD_VISITED(pinfo)) {
- /* this is a new request, create a new transaction structure and map it to the
+ /* this is a new request, create a new transaction structure and map it to the
unmatched table
*/
icmp_key[0].length = 2;
@@ -1362,12 +1365,12 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
2, 2, cksum,
"Checksum: 0x%04x [correct]",
cksum);
- } else {
item =
proto_tree_add_boolean(icmp_tree,
hf_icmp_checksum_bad,
- tvb, 2, 2, TRUE);
+ tvb, 2, 2, FALSE);
PROTO_ITEM_SET_HIDDEN(item);
+ } else {
proto_tree_add_uint_format(icmp_tree,
hf_icmp_checksum, tvb,
2, 2, cksum,
@@ -1375,6 +1378,11 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
cksum,
in_cksum_shouldbe(cksum,
computed_cksum));
+ item =
+ proto_tree_add_boolean(icmp_tree,
+ hf_icmp_checksum_bad,
+ tvb, 2, 2, TRUE);
+ PROTO_ITEM_SET_HIDDEN(item);
}
} else {
proto_tree_add_uint(icmp_tree, hf_icmp_checksum, tvb, 2, 2,
diff --git a/epan/dissectors/packet-icmpv6.c b/epan/dissectors/packet-icmpv6.c
index b3d8644153..c0a627f5a6 100644
--- a/epan/dissectors/packet-icmpv6.c
+++ b/epan/dissectors/packet-icmpv6.c
@@ -3272,11 +3272,12 @@ dissect_icmpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
computed_cksum = in_cksum(cksum_vec, 4);
if (computed_cksum == 0) {
+ hidden_item = proto_tree_add_boolean(icmp6_tree, hf_icmpv6_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(icmp6_tree, hf_icmpv6_checksum_bad, tvb, offset, 2, TRUE);
-
- PROTO_ITEM_SET_GENERATED(hidden_item);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
proto_item_append_text(checksum_item, " [incorrect, should be 0x%04x]", in_cksum_shouldbe(cksum, computed_cksum));
expert_add_info_format(pinfo, checksum_item, PI_CHECKSUM, PI_WARN,
"ICMPv6 Checksum Incorrect, should be 0x%04x", in_cksum_shouldbe(cksum, computed_cksum));