diff options
author | Guy Harris <guy@alum.mit.edu> | 2005-09-11 21:25:37 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2005-09-11 21:25:37 +0000 |
commit | 25c4bc9379996f934e7648f2ab8b8db3857439f6 (patch) | |
tree | 802a39b3b32b8079ff58c90a7a4e4be6385eb515 /epan/dissectors/packet-icmpv6.c | |
parent | 0bb7a6e0038f5e90851c6d866d3f4d2e75903ab2 (diff) |
Replace tvb_memcpy() calls that extract IPv4 addresses into a guint32,
and that extract IPv6 addresses into a "struct e_in6_addr", with
tvb_get_ipv4() and tvb_get_ipv6() calls - except for some that we
remove, by using proto_tree_add_item(), rather than replacing.
Have epan/tvbuff.h include epan/ipv6-utils.h, to define "struct
e_in6_addr" (not necessary to declare the tvbuff routines, but including
it there means "struct e_in6_addr" is guaranteed to be defined before
those declarations, so we don't get compiler complaints if we define it
*after* those declarations).
svn path=/trunk/; revision=15758
Diffstat (limited to 'epan/dissectors/packet-icmpv6.c')
-rw-r--r-- | epan/dissectors/packet-icmpv6.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/epan/dissectors/packet-icmpv6.c b/epan/dissectors/packet-icmpv6.c index 2dc9601120..b68a747dcb 100644 --- a/epan/dissectors/packet-icmpv6.c +++ b/epan/dissectors/packet-icmpv6.c @@ -613,7 +613,7 @@ dissect_nodeinfo(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree p = offset + sizeof *ni; for (i = 0; i < n; i++) { struct e_in6_addr e_in6_addr; - tvb_memcpy(tvb, (guint8 *)&e_in6_addr, p, sizeof e_in6_addr); + tvb_get_ipv6(tvb, p, &e_in6_addr); proto_tree_add_text(field_tree, tvb, p, sizeof(struct e_in6_addr), "%s", ip6_to_str(&e_in6_addr)); @@ -728,7 +728,7 @@ dissect_nodeinfo(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree struct e_in6_addr e_in6_addr; gint32 ttl; ttl = (gint32)tvb_get_ntohl(tvb, p); - tvb_memcpy(tvb, (guint8 *)&e_in6_addr, p + sizeof ttl, sizeof e_in6_addr); + tvb_get_ipv6(tvb, p + sizeof ttl, &e_in6_addr); proto_tree_add_text(field_tree, tvb, p, sizeof(struct e_in6_addr) + sizeof(gint32), "%s (TTL %d)", ip6_to_str(&e_in6_addr), ttl); @@ -955,7 +955,7 @@ dissect_mldrv2( tvbuff_t *tvb, guint32 offset, guint16 count, proto_tree *tree ) localOffset += 2; recordSize = 4 + 16 + (16 * sourceNb) + (auxDataLen * 4); - tvb_memcpy(tvb, (guint8 *)&addr, localOffset, sizeof(addr) ); + tvb_get_ipv6(tvb, localOffset, &addr); tf = proto_tree_add_text( tree, tvb, offset, recordSize, #ifdef INET6 "%s: %s (%s)", val_to_str(recordType, mldrv2ModesNames,"Unknown mode"), @@ -974,7 +974,7 @@ dissect_mldrv2( tvbuff_t *tvb, guint32 offset, guint16 count, proto_tree *tree ) localOffset += 16; for( ; sourceNb; sourceNb--, localOffset += 16 ) { - tvb_memcpy(tvb, (guint8 *)&addr, localOffset, sizeof(addr) ); + tvb_get_ipv6(tvb, localOffset, &addr); proto_tree_add_text( sub_tree, tvb, localOffset, 16, #ifdef INET6 "Source Address: %s (%s)", get_hostname6(&addr), ip6_to_str(&addr) ); @@ -991,7 +991,7 @@ dissect_mldqv2(tvbuff_t *tvb, guint32 offset, guint16 count, proto_tree *tree) struct e_in6_addr addr; for ( ; count; count--, offset += 16) { - tvb_memcpy(tvb, (guint8 *)&addr, offset, sizeof(addr)); + tvb_get_ipv6(tvb, offset, &addr); proto_tree_add_text(tree, tvb, offset, 16, "Source Address: %s (%s)", get_hostname6(&addr), ip6_to_str(&addr)); } |