summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-icmpv6.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-08-28 06:44:06 +0000
committerGuy Harris <guy@alum.mit.edu>2005-08-28 06:44:06 +0000
commit374c3d0b7581648039cae9a16318619ad5340e29 (patch)
treeaef7dab7ca1133ccd8dc5d37a6b2612d2016e1bd /epan/dissectors/packet-icmpv6.c
parentd7f391d333c8e81515d64be3c0dc995c0eb91dce (diff)
downloadwireshark-374c3d0b7581648039cae9a16318619ad5340e29.tar.gz
Export "bytestring_to_str()", and use it when adding the link-layer
address for the ND_OPT_TARGET_LINKADDR ICMPv6 packet type. svn path=/trunk/; revision=15591
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: