From f29d1da0fbc86d84bceccda13cf226bce63f226f Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Fri, 29 Apr 2016 16:25:03 +0200 Subject: IPv4: use calculated value for Header Length display filter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: 12387 Change-Id: I63370ea884b6fb75a0743fecc06af2e213700645 Reviewed-on: https://code.wireshark.org/review/15163 Petri-Dish: Alexis La Goutte Petri-Dish: Pascal Quantin Tested-by: Petri Dish Buildbot Reviewed-by: Pascal Quantin Reviewed-by: João Valverde Reviewed-by: Anders Broman --- epan/dissectors/packet-ip.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'epan/dissectors/packet-ip.c') diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index 6bcabf9266..09f74ce48c 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -2052,13 +2052,13 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* "Bogus IP header length (%u, must be at least %u)", hlen, IPH_MIN_LEN); - proto_tree_add_uint_format_value(ip_tree, hf_ip_hdr_len, tvb, offset, 1, hlen/4, + proto_tree_add_uint_bits_format_value(ip_tree, hf_ip_hdr_len, tvb, (offset<<3)+4, 4, hlen, "%u bytes (bogus, must be at least %u)", hlen, IPH_MIN_LEN); return tvb_captured_length(tvb); } - proto_tree_add_uint_format_value(ip_tree, hf_ip_hdr_len, tvb, offset, 1, hlen/4, - "%u bytes", hlen); + proto_tree_add_uint_bits_format_value(ip_tree, hf_ip_hdr_len, tvb, (offset<<3)+4, 4, hlen, + "%u bytes (%u)", hlen, hlen>>2); iph->ip_tos = tvb_get_guint8(tvb, offset + 1); if (g_ip_dscp_actif) { @@ -2624,7 +2624,7 @@ proto_register_ip(void) { &hf_ip_hdr_len, { "Header Length", "ip.hdr_len", FT_UINT8, BASE_DEC, - NULL, 0x0F, NULL, HFILL }}, + NULL, 0x0, NULL, HFILL }}, { &hf_ip_dsfield, { "Differentiated Services Field", "ip.dsfield", FT_UINT8, BASE_HEX, -- cgit v1.2.3