aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-icmp.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-09-15 01:48:30 +0000
committerMichael Mann <mmann78@netscape.net>2013-09-15 01:48:30 +0000
commitb38ee917b1953104c615056481d6df008ae94b53 (patch)
tree55024f9c53f083dc056540b6d887fc4550064008 /epan/dissectors/packet-icmp.c
parenta17cf67635c6e190c174bc131707804edca5c8f4 (diff)
Convert proto_tree_add_uint_format to proto_tree_add_uint_format_value if hf_ field name is the first part of the formatted string. This was done with a perl script on the dissectors directory (packet-*.c), followed by manual inspection of the output. The manual inspection yielded a few cases that really should have been proto_tree_add_uint or proto_tree_add_item, so I updated them accordingly.
The script didn't catch as many as I would have liked, but it's a start. The most common (ab)use of proto_tree_add_uint_format was for appending strings to CRC/checksum values to note good or bad CRC/checksum. svn path=/trunk/; revision=52045
Diffstat (limited to 'epan/dissectors/packet-icmp.c')
-rw-r--r--epan/dissectors/packet-icmp.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/epan/dissectors/packet-icmp.c b/epan/dissectors/packet-icmp.c
index 0c2a991ad9..d9cd166cbd 100644
--- a/epan/dissectors/packet-icmp.c
+++ b/epan/dissectors/packet-icmp.c
@@ -826,7 +826,6 @@ dissect_extensions(tvbuff_t * tvb, gint offset, proto_tree * tree)
guint8 version;
guint8 class_num;
guint8 c_type;
- guint16 reserved;
guint16 cksum, computed_cksum;
guint16 obj_length, obj_trunc_length;
proto_item *ti, *tf_object, *hidden_item;
@@ -864,10 +863,8 @@ dissect_extensions(tvbuff_t * tvb, gint offset, proto_tree * tree)
version);
/* Reserved */
- reserved = tvb_get_ntohs(tvb, offset) & 0x0fff;
- proto_tree_add_uint_format(ext_tree, hf_icmp_ext_reserved,
- tvb, offset, 2, reserved,
- "Reserved: 0x%03x", reserved);
+ proto_tree_add_item(ext_tree, hf_icmp_ext_reserved,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
/* Checksum */
cksum = tvb_get_ntohs(tvb, offset + 2);
@@ -877,18 +874,18 @@ dissect_extensions(tvbuff_t * tvb, gint offset, proto_tree * tree)
reported_length);
if (computed_cksum == 0) {
- proto_tree_add_uint_format(ext_tree, hf_icmp_ext_checksum,
+ proto_tree_add_uint_format_value(ext_tree, hf_icmp_ext_checksum,
tvb, offset + 2, 2, cksum,
- "Checksum: 0x%04x [correct]",
+ "0x%04x [correct]",
cksum);
hidden_item =
proto_tree_add_boolean(ext_tree,
hf_icmp_ext_checksum_bad, tvb,
offset + 2, 2, FALSE);
} else {
- proto_tree_add_uint_format(ext_tree, hf_icmp_ext_checksum,
+ proto_tree_add_uint_format_value(ext_tree, hf_icmp_ext_checksum,
tvb, offset + 2, 2, cksum,
- "Checksum: 0x%04x [incorrect, should be 0x%04x]",
+ "0x%04x [incorrect, should be 0x%04x]",
cksum, in_cksum_shouldbe(cksum,
computed_cksum));
hidden_item =
@@ -1356,10 +1353,10 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
ip_checksum(tvb_get_ptr(tvb, 0, reported_length),
reported_length);
if (computed_cksum == 0) {
- proto_tree_add_uint_format(icmp_tree,
+ proto_tree_add_uint_format_value(icmp_tree,
hf_icmp_checksum, tvb,
2, 2, cksum,
- "Checksum: 0x%04x [correct]",
+ "0x%04x [correct]",
cksum);
item =
proto_tree_add_boolean(icmp_tree,
@@ -1367,10 +1364,10 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
tvb, 2, 2, FALSE);
PROTO_ITEM_SET_HIDDEN(item);
} else {
- proto_tree_add_uint_format(icmp_tree,
+ proto_tree_add_uint_format_value(icmp_tree,
hf_icmp_checksum, tvb,
2, 2, cksum,
- "Checksum: 0x%04x [incorrect, should be 0x%04x]",
+ "0x%04x [incorrect, should be 0x%04x]",
cksum,
in_cksum_shouldbe(cksum,
computed_cksum));
@@ -1855,7 +1852,7 @@ void proto_register_icmp(void)
{&hf_icmp_ext_reserved,
{"Reserved", "icmp.ext.res", FT_UINT16, BASE_HEX, NULL,
- 0x0,
+ 0x0fff,
NULL, HFILL}},
{&hf_icmp_ext_checksum,