aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/common.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-11-16 20:17:12 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-11-16 20:17:12 +0100
commita092a89d8f052072e562861f2968573d89e10dd5 (patch)
tree43e7300d1825899e5c95ae9f557d0e2d1efde228 /networking/udhcp/common.c
parent39b233182c0a13200be051b993da181a1db80a87 (diff)
downloadbusybox-w32-a092a89d8f052072e562861f2968573d89e10dd5.tar.gz
busybox-w32-a092a89d8f052072e562861f2968573d89e10dd5.tar.bz2
busybox-w32-a092a89d8f052072e562861f2968573d89e10dd5.zip
udhcpc6: rudimentary code to export data to script; fix IAADDR parsing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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 2e6113627..a89dce3ae 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)
539 539
540 return retval; 540 return retval;
541} 541}
542
543/* note: ip is a pointer to an IPv6 in network order, possibly misaliged */
544int FAST_FUNC sprint_nip6(char *dest, /*const char *pre,*/ const uint8_t *ip)
545{
546 char hexstrbuf[16 * 2];
547 bin2hex(hexstrbuf, (void*)ip, 16);
548 return sprintf(dest, /* "%s" */
549 "%.4s:%.4s:%.4s:%.4s:%.4s:%.4s:%.4s:%.4s",
550 /* pre, */
551 hexstrbuf + 0 * 4,
552 hexstrbuf + 1 * 4,
553 hexstrbuf + 2 * 4,
554 hexstrbuf + 3 * 4,
555 hexstrbuf + 4 * 4,
556 hexstrbuf + 5 * 4,
557 hexstrbuf + 6 * 4,
558 hexstrbuf + 7 * 4
559 );
560}