aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dhcpv6.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2005-09-11 21:25:37 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2005-09-11 21:25:37 +0000
commit8641192db38d14218994b79e3bd53d2066f74615 (patch)
tree802a39b3b32b8079ff58c90a7a4e4be6385eb515 /epan/dissectors/packet-dhcpv6.c
parent86d831bcefb013befdd8d10d1780d4cbd83c42fa (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). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15758 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-dhcpv6.c')
-rw-r--r--epan/dissectors/packet-dhcpv6.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/epan/dissectors/packet-dhcpv6.c b/epan/dissectors/packet-dhcpv6.c
index f969cd14f9..589bf78b3a 100644
--- a/epan/dissectors/packet-dhcpv6.c
+++ b/epan/dissectors/packet-dhcpv6.c
@@ -47,7 +47,6 @@
#include <string.h>
#include <glib.h>
#include <epan/packet.h>
-#include <epan/ipv6-utils.h>
#include "packet-arp.h"
static int proto_dhcpv6 = -1;
@@ -461,7 +460,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
optlen, "IAADDR: malformed option");
break;
}
- tvb_memcpy(tvb, (guint8 *)&in6, off, sizeof(in6));
+ tvb_get_ipv6(tvb, off, &in6);
proto_tree_add_text(subtree, tvb, off,
sizeof(in6), "IPv6 address: %s",
ip6_to_str(&in6));
@@ -563,7 +562,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
optlen, "UNICAST: malformed option");
break;
}
- tvb_memcpy(tvb, (guint8 *)&in6, off, sizeof(in6));
+ tvb_get_ipv6(tvb, off, &in6);
proto_tree_add_text(subtree, tvb, off,
sizeof(in6), "IPv6 address: %s",
ip6_to_str(&in6));
@@ -649,7 +648,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
break;
}
for (i = 0; i < optlen; i += 16) {
- tvb_memcpy(tvb, (guint8 *)&in6, off + i, sizeof(in6));
+ tvb_get_ipv6(tvb, off + i, &in6);
proto_tree_add_text(subtree, tvb, off + i,
sizeof(in6), "SIP servers address: %s",
ip6_to_str(&in6));
@@ -662,7 +661,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
break;
}
for (i = 0; i < optlen; i += 16) {
- tvb_memcpy(tvb, (guint8 *)&in6, off + i, sizeof(in6));
+ tvb_get_ipv6(tvb, off + i, &in6);
proto_tree_add_text(subtree, tvb, off + i,
sizeof(in6), "DNS servers address: %s",
ip6_to_str(&in6));
@@ -681,7 +680,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
break;
}
for (i = 0; i < optlen; i += 16) {
- tvb_memcpy(tvb, (guint8 *)&in6, off + i, sizeof(in6));
+ tvb_get_ipv6(tvb, off + i, &in6);
proto_tree_add_text(subtree, tvb, off + i,
sizeof(in6), "NIS servers address: %s",
ip6_to_str(&in6));
@@ -694,7 +693,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
break;
}
for (i = 0; i < optlen; i += 16) {
- tvb_memcpy(tvb, (guint8 *)&in6, off + i, sizeof(in6));
+ tvb_get_ipv6(tvb, off + i, &in6);
proto_tree_add_text(subtree, tvb, off + i,
sizeof(in6), "NISP servers address: %s",
ip6_to_str(&in6));
@@ -719,7 +718,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
break;
}
for (i = 0; i < optlen; i += 16) {
- tvb_memcpy(tvb, (guint8 *)&in6, off + i, sizeof(in6));
+ tvb_get_ipv6(tvb, off + i, &in6);
proto_tree_add_text(subtree, tvb, off + i,
sizeof(in6), "SNTP servers address: %s",
ip6_to_str(&in6));
@@ -793,7 +792,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
}
proto_tree_add_text(subtree, tvb, off + 8, 1,
"Prefix length: %d", prefix_length);
- tvb_memcpy(tvb, (guint8 *)&in6, off + 9 , sizeof(in6));
+ tvb_get_ipv6(tvb, off + 9, &in6);
proto_tree_add_text(subtree, tvb, off + 9,
16, "Prefix address: %s",
ip6_to_str(&in6));
@@ -816,7 +815,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
break;
}
- tvb_memcpy(tvb, (guint8 *)&in6, off , sizeof(in6));
+ tvb_get_ipv6(tvb, off, &in6);
proto_tree_add_text(subtree, tvb, off,
16, "Home Agent: %s", ip6_to_str(&in6));
break;
@@ -827,7 +826,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
break;
}
- tvb_memcpy(tvb, (guint8 *)&in6, off , sizeof(in6));
+ tvb_get_ipv6(tvb, off, &in6);
proto_tree_add_text(subtree, tvb, off,
16, "Home Address: %s", ip6_to_str(&in6));
break;
@@ -882,11 +881,11 @@ dissect_dhcpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
hop_count = tvb_get_guint8(tvb, off+1);
proto_tree_add_text(bp_tree, tvb, off+1, 1, "Hop count: %d", hop_count);
- tvb_memcpy(tvb, (guint8 *)&in6, off+2, sizeof(in6));
+ tvb_get_ipv6(tvb, off+2, &in6);
proto_tree_add_text(bp_tree, tvb, off+2, sizeof(in6),
"Link-address: %s",ip6_to_str(&in6));
- tvb_memcpy(tvb, (guint8 *)&in6, off+18, sizeof(in6));
+ tvb_get_ipv6(tvb, off+18, &in6);
proto_tree_add_text(bp_tree, tvb, off+18, sizeof(in6),
"Peer-address: %s",ip6_to_str(&in6));
@@ -909,7 +908,7 @@ dissect_dhcpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
msgtype);
proto_tree_add_text(bp_tree, tvb, off+1, 3, "Transaction-ID: 0x%08x", xid);
#if 0
- tvb_memcpy(tvb, (guint8 *)&in6, 4, sizeof(in6));
+ tvb_get_ipv6(tvb, 4, &in6);
proto_tree_add_text(bp_tree, tvb, 4, sizeof(in6),
"Server address: %s", ip6_to_str(&in6));
#endif