diff options
author | Kevin Bracey <kevin.bracey@arm.com> | 2016-01-12 13:20:46 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-01-24 00:03:18 +0000 |
commit | 9eda2fa063569c49ce238d6bbee023c91b46d879 (patch) | |
tree | 0b1da4fcc19e0e328fa9c87b9839f9a8f3c130cc /epan/dissectors/packet-ipv6.c | |
parent | 88cd6552ea861a56df9355e681dcaec50e845bd6 (diff) |
Set width of hex output according to bitmask
Output from BASE_HEX et al has always been zero-padded to according to
the field type - 8 digits for FT_UINT32, etc.
When the field has a bitmask, this is definitely not appropriate - the
field type is used to indicate the size of the bitfield container, and
tells us nothing about the size of this field.
Instead, determine the actual size of the field by inspecting the
bitmask, and output the corresponding number of hex digits.
Change-Id: I10ec4e93e1e40e8b1354d5368cc8945cf671a617
Reviewed-on: https://code.wireshark.org/review/13225
Reviewed-by: João Valverde <j@v6e.pt>
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-ipv6.c')
-rw-r--r-- | epan/dissectors/packet-ipv6.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index 66f13b427e..e7280e0568 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -2067,9 +2067,9 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ if (tree) { /* !!! warning: (4-bit) version, (6-bit) DSCP, (2-bit) ECN and (20-bit) Flow */ - /* _format_value() used to elide leading zeros from hex representation for IPv6 Traffic Class */ - ti = proto_tree_add_uint_format_value(ipv6_tree, hf_ipv6_tclass, tvb, - offset + IP6H_CTL_FLOW, 4, g_ntohl(ipv6->ip6_flow), "0x%02x", tfc); + + ti = proto_tree_add_item(ipv6_tree, hf_ipv6_tclass, tvb, + offset + IP6H_CTL_FLOW, 4, ENC_BIG_ENDIAN); proto_item_append_text(ti, " (DSCP: %s, ECN: %s)", val_to_str_ext_const(IPDSFIELD_DSCP(tfc), &dscp_short_vals_ext, "Unknown"), val_to_str_ext_const(IPDSFIELD_ECN(tfc), &ecn_short_vals_ext, "Unknown")); |