diff options
author | Jörg Mayer <jmayer@loplof.de> | 2012-06-12 10:38:22 +0000 |
---|---|---|
committer | Jörg Mayer <jmayer@loplof.de> | 2012-06-12 10:38:22 +0000 |
commit | 9228ece476cfb7f9102ad84427f2c565e1614e10 (patch) | |
tree | 2818f23e07d741ee22c22e425db9a43d5874a26b | |
parent | 4f47eefa79dd75ba8d8455f21429fd49a8b25b1a (diff) |
Manually revert r41953
BACKPORT to 1.8
svn path=/trunk/; revision=43221
-rw-r--r-- | epan/dissectors/packet-ip.c | 14 | ||||
-rw-r--r-- | epan/dissectors/packet-ip.h | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ipv6.c | 10 |
3 files changed, 10 insertions, 16 deletions
diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index 5d25732782..feeef94ff5 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -1916,15 +1916,6 @@ add_ip_version_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset) return proto_tree_add_item(tree, hf_ip_version, tvb, offset, 1, ENC_BIG_ENDIAN); } -/* - * Note boffset is offset in BITS to ba able to use the function in both IPv4 and IPv6 - */ -proto_item * -add_ip_dscp_to_tree(proto_tree *tree, tvbuff_t *tvb, int boffset) -{ - return proto_tree_add_bits_item(tree, hf_ip_dsfield_dscp, tvb, boffset, 6, ENC_BIG_ENDIAN); -} - static void dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) { @@ -2013,8 +2004,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) ecn_vals, "Unknown ECN")); field_tree = proto_item_add_subtree(tf, ett_ip_dsfield); - /* Add DSCP using bit offset to be able to use the same hf field in IPv6 */ - add_ip_dscp_to_tree(field_tree, tvb, (offset+1)<<3); + proto_tree_add_item(field_tree, hf_ip_dsfield_dscp, tvb, offset + 1, 1, ENC_NA); proto_tree_add_item(field_tree, hf_ip_dsfield_ecn, tvb, offset + 1, 1, ENC_NA); } else { tf = proto_tree_add_uint_format(ip_tree, hf_ip_tos, tvb, offset + 1, 1, @@ -2443,7 +2433,7 @@ proto_register_ip(void) { &hf_ip_dsfield_dscp, { "Differentiated Services Codepoint", "ip.dsfield.dscp", FT_UINT8, BASE_HEX | BASE_EXT_STRING, - &dscp_vals_ext, 0, NULL, HFILL }}, + &dscp_vals_ext, IPDSFIELD_DSCP_MASK, NULL, HFILL }}, { &hf_ip_dsfield_ecn, { "Explicit Congestion Notification", "ip.dsfield.ecn", FT_UINT8, BASE_HEX, diff --git a/epan/dissectors/packet-ip.h b/epan/dissectors/packet-ip.h index 87a8beef9f..fcdf935ec8 100644 --- a/epan/dissectors/packet-ip.h +++ b/epan/dissectors/packet-ip.h @@ -45,8 +45,8 @@ guint16 ip_checksum(const guint8 *ptr, int len); /* Export the DSCP extended value-string table for other protocols */ WS_VAR_IMPORT value_string_ext dscp_vals_ext; +WS_VAR_IMPORT const value_string dscp_vals[]; proto_item *add_ip_version_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset); -proto_item *add_ip_dscp_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset); #endif diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index db9466ce1e..6cc443f853 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -223,6 +223,7 @@ static int hf_ipv6_shim6_loc_weight = -1; static int hf_ipv6_shim6_opt_locnum = -1; static int hf_ipv6_shim6_opt_elemlen = -1; static int hf_ipv6_shim6_opt_fii = -1; +static int hf_ipv6_traffic_class_dscp = -1; static int hf_ipv6_traffic_class_ect = -1; static int hf_ipv6_traffic_class_ce = -1; @@ -1707,9 +1708,8 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ipv6_tc_tree = proto_item_add_subtree(ipv6_tc, ett_ipv6_traffic_class); - /* Add DSCP using bit offset to be able to use the same hf field in IPv6 */ - add_ip_dscp_to_tree(ipv6_tc_tree, tvb, ((offset + offsetof(struct ip6_hdr, ip6_flow))<<3)+4); - + proto_tree_add_item(ipv6_tc_tree, hf_ipv6_traffic_class_dscp, tvb, + offset + offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); proto_tree_add_item(ipv6_tc_tree, hf_ipv6_traffic_class_ect, tvb, offset + offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); @@ -2735,6 +2735,10 @@ proto_register_ipv6(void) FT_UINT32, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_ipv6_traffic_class_dscp, + { "Differentiated Services Field", "ipv6.traffic_class.dscp", + FT_UINT32, BASE_HEX, VALS(dscp_vals), 0x0FC00000, NULL, HFILL }}, + { &hf_ipv6_traffic_class_ect, { "ECN-Capable Transport (ECT)", "ipv6.traffic_class.ect", FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x0200000, NULL, HFILL }}, |