diff options
author | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2012-12-02 04:49:13 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2012-12-02 04:49:13 +0000 |
commit | 49466f95bc1fe3cc139f3750fcc934ffc210faef (patch) | |
tree | 14c72b7db9d4fe0af875d373d6023c92bae0463a /epan/dissectors/packet-ipv6.c | |
parent | da4442d6384b15530fd740295080a8ad3a145ca6 (diff) |
Introduce, and start using, TVB_SET_ADDRESS() and TVB_SET_ADDRESS_HF(). They
are like the non-TVB versions except that they take a TVB and an offset
instead of (frequently) a pointer into the TVB.
Calling tvb_get_ptr() before modifying the rest of the fields should help fix
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7960 (though I can't
reproduce that problem).
Replace a bunch of calls like:
SET_ADDRESS(..., AT_XXX, length, tvb_get_ptr(tvb, offset, length));
with:
TVB_SET_ADDRESS(..., AT_XXX, tvb, offset, length);
svn path=/trunk/; revision=46324
Diffstat (limited to 'epan/dissectors/packet-ipv6.c')
-rw-r--r-- | epan/dissectors/packet-ipv6.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index c91d138680..5532863d6c 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -631,16 +631,15 @@ dissect_routing6(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo + n * sizeof(struct e_in6_addr), sizeof(struct e_in6_addr), ENC_NA); if (seg_left) - SET_ADDRESS(&pinfo->dst, AT_IPv6, 16, tvb_get_ptr(tvb, - offset + offsetof(struct ip6_rthdr0, ip6r0_addr) - + n * sizeof(struct e_in6_addr), 16)); + TVB_SET_ADDRESS(&pinfo->dst, AT_IPv6, tvb, + offset + offsetof(struct ip6_rthdr0, ip6r0_addr) + n * sizeof(struct e_in6_addr), 16); } } if (rt.ip6r_type == IPv6_RT_HEADER_MobileIP) { proto_tree_add_item(rthdr_tree, hf_ipv6_mipv6_home_address, tvb, offset + 8, 16, ENC_NA); if (seg_left) - SET_ADDRESS(&pinfo->dst, AT_IPv6, 16, tvb_get_ptr(tvb, offset + 8, 16)); + TVB_SET_ADDRESS(&pinfo->dst, AT_IPv6, tvb, offset + 8, 16); } if (rt.ip6r_type == IPv6_RT_HEADER_RPL) { guint8 cmprI; @@ -975,7 +974,7 @@ dissect_opts(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info * pinfo, c } proto_tree_add_item(opt_tree, hf_ipv6_mipv6_home_address, tvb, offset, 16, ENC_NA); - SET_ADDRESS(&pinfo->src, AT_IPv6, 16, tvb_get_ptr(tvb, offset, 16)); + TVB_SET_ADDRESS(&pinfo->src, AT_IPv6, tvb, offset, 16); offset += 16; break; case IP6OPT_CALIPSO: @@ -1690,10 +1689,10 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Adjust the length of this tvbuff to include only the IPv6 datagram. */ set_actual_length(tvb, plen + sizeof (struct ip6_hdr)); - SET_ADDRESS(&pinfo->net_src, AT_IPv6, 16, tvb_get_ptr(tvb, offset + IP6H_SRC, 16)); - SET_ADDRESS(&pinfo->src, AT_IPv6, 16, tvb_get_ptr(tvb, offset + IP6H_SRC, 16)); - SET_ADDRESS(&pinfo->net_dst, AT_IPv6, 16, tvb_get_ptr(tvb, offset + IP6H_DST, 16)); - SET_ADDRESS(&pinfo->dst, AT_IPv6, 16, tvb_get_ptr(tvb, offset + IP6H_DST, 16)); + TVB_SET_ADDRESS(&pinfo->net_src, AT_IPv6, tvb, offset + IP6H_SRC, 16); + TVB_SET_ADDRESS(&pinfo->src, AT_IPv6, tvb, offset + IP6H_SRC, 16); + TVB_SET_ADDRESS(&pinfo->net_dst, AT_IPv6, tvb, offset + IP6H_DST, 16); + TVB_SET_ADDRESS(&pinfo->dst, AT_IPv6, tvb, offset + IP6H_DST, 16); if (tree) { proto_tree* pt; |