summaryrefslogtreecommitdiff
path: root/networking/udhcp/common.c
diff options
context:
space:
mode:
authorDenys Vlasenko2011-11-21 14:25:15 +0100
committerDenys Vlasenko2011-11-21 14:25:15 +0100
commit5f118ff8851adb8370e8f130bb2ec2e80b55246c (patch)
tree6d8d2841a2ce317f0195fe5954dbbc8f046546bf /networking/udhcp/common.c
parent2951add2bf240e47b1d2e7bc384f138428391366 (diff)
parentfc186711fe75cfc4abda9a7ff29050bc7a56313b (diff)
downloadbusybox-5f118ff8851adb8370e8f130bb2ec2e80b55246c.zip
busybox-5f118ff8851adb8370e8f130bb2ec2e80b55246c.tar.gz
Merge branch 'master' of git+ssh://busybox.net/var/lib/git/busybox
Diffstat (limited to 'networking/udhcp/common.c')
-rw-r--r--networking/udhcp/common.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c
index 2e61136..a89dce3 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -539,3 +539,22 @@ int FAST_FUNC udhcp_str2optset(const char *const_str, void *arg)
return retval;
}
+
+/* note: ip is a pointer to an IPv6 in network order, possibly misaliged */
+int FAST_FUNC sprint_nip6(char *dest, /*const char *pre,*/ const uint8_t *ip)
+{
+ char hexstrbuf[16 * 2];
+ bin2hex(hexstrbuf, (void*)ip, 16);
+ return sprintf(dest, /* "%s" */
+ "%.4s:%.4s:%.4s:%.4s:%.4s:%.4s:%.4s:%.4s",
+ /* pre, */
+ hexstrbuf + 0 * 4,
+ hexstrbuf + 1 * 4,
+ hexstrbuf + 2 * 4,
+ hexstrbuf + 3 * 4,
+ hexstrbuf + 4 * 4,
+ hexstrbuf + 5 * 4,
+ hexstrbuf + 6 * 4,
+ hexstrbuf + 7 * 4
+ );
+}