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 02:42:30 +0000
commitb370c02a02cef0e26f327342e085fa45b4e06e3f (patch)
tree2d568cf9eecb0857e240acbde2141cb17598a253
parent7af770dfa72eaca512b658b3ed702ad27c491e91 (diff)
downloadwireshark-b370c02a02cef0e26f327342e085fa45b4e06e3f.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>
-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 fd2af0f6e3..8c1b29edd6 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -6008,7 +6008,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);
@@ -6506,7 +6508,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,