aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-icmpv6.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2005-08-28 06:44:06 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2005-08-28 06:44:06 +0000
commitd77b17cce349feb8d4e5e0b04b6b23254f31674b (patch)
treeaef7dab7ca1133ccd8dc5d37a6b2612d2016e1bd /epan/dissectors/packet-icmpv6.c
parenta35cbc7b87b469e21e6319197294e1ab723f3c15 (diff)
Export "bytestring_to_str()", and use it when adding the link-layer
address for the ND_OPT_TARGET_LINKADDR ICMPv6 packet type. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15591 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-icmpv6.c')
-rw-r--r--epan/dissectors/packet-icmpv6.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/epan/dissectors/packet-icmpv6.c b/epan/dissectors/packet-icmpv6.c
index f179350168..2dc9601120 100644
--- a/epan/dissectors/packet-icmpv6.c
+++ b/epan/dissectors/packet-icmpv6.c
@@ -215,22 +215,13 @@ again:
case ND_OPT_SOURCE_LINKADDR:
case ND_OPT_TARGET_LINKADDR:
{
- int len, i, p;
- const guint8 *a;
- char *t;
+ int len, p;
p = offset + sizeof(*opt);
len = (opt->nd_opt_len << 3) - sizeof(*opt);
- a = tvb_get_ptr(tvb, p, len);
- t = ep_alloc(len * 3);
- memset(t, 0, len * 3);
- for (i = 0; i < len; i++) {
- if (i)
- t[i * 3 - 1] = ':';
- g_snprintf(t+i*3, 2, "%02x", a[i]);
- }
proto_tree_add_text(icmp6opt_tree, tvb,
- offset + sizeof(*opt), len, "Link-layer address: %s", t);
+ offset + sizeof(*opt), len, "Link-layer address: %s",
+ bytestring_to_str(tvb_get_ptr(tvb, p, len), len, ':'));
break;
}
case ND_OPT_PREFIX_INFORMATION: