summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2017-06-21 10:45:29 -0400
committerAnders Broman <a.broman58@gmail.com>2017-06-22 16:26:16 +0000
commit99270048bcd7fbd80a8f3ce19683f7fad5bcf1ae (patch)
tree71bffb92602fe63f5048511ee2841b3f0fcc7d16
parent9bc595fdaca891143caccc633d9a1f48a2699daa (diff)
downloadwireshark-99270048bcd7fbd80a8f3ce19683f7fad5bcf1ae.tar.gz
TCP: Make the header length display consistent with IPv4.
Format tcp.hdr_len in the tree similar to ip.hdr_len. Add comments noting that they should be consistent. Change-Id: Ic64282d8386c8ed339811bc9c22b5962c707d292 Reviewed-on: https://code.wireshark.org/review/22314 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com> (cherry picked from commit b370c02a02cef0e26f327342e085fa45b4e06e3f) Reviewed-on: https://code.wireshark.org/review/22355
-rw-r--r--epan/dissectors/packet-ip.c1
-rw-r--r--epan/dissectors/packet-tcp.c6
2 files changed, 5 insertions, 2 deletions
diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c
index 689f6d9f2c..0e97ecf25a 100644
--- a/epan/dissectors/packet-ip.c
+++ b/epan/dissectors/packet-ip.c
@@ -1933,6 +1933,7 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
return tvb_captured_length(tvb);
}
+ // This should be consistent with tcp.hdr_len.
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);
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index d943c9fcac..a9852d6e02 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -5999,7 +5999,9 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
}
if (tree) {
- proto_tree_add_uint(tcp_tree, hf_tcp_hdr_len, tvb, offset + 12, 1, tcph->th_hlen);
+ // This should be consistent with ip.hdr_len.
+ proto_tree_add_uint_bits_format_value(tcp_tree, hf_tcp_hdr_len, tvb, (offset + 12) << 3, 4, tcph->th_hlen,
+ "%u bytes (%u)", tcph->th_hlen, tcph->th_hlen>>2);
tf = proto_tree_add_uint_format(tcp_tree, hf_tcp_flags, tvb, offset + 12, 2,
tcph->th_flags, "Flags: 0x%03x (%s)", tcph->th_flags, flags_str);
field_tree = proto_item_add_subtree(tf, ett_tcp_flags);
@@ -6497,7 +6499,7 @@ proto_register_tcp(void)
NULL, HFILL }},
{ &hf_tcp_hdr_len,
- { "Header Length", "tcp.hdr_len", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0,
+ { "Header Length", "tcp.hdr_len", FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_tcp_flags,