Module Name:    src
Committed By:   christos
Date:           Mon Oct 27 14:10:12 UTC 2014

Modified Files:
        src/sys/netinet6: in6.c

Log Message:
print mapped addresses better


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/sys/netinet6/in6.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.177 src/sys/netinet6/in6.c:1.178
--- src/sys/netinet6/in6.c:1.177	Mon Oct 20 10:50:09 2014
+++ src/sys/netinet6/in6.c	Mon Oct 27 10:10:12 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.177 2014/10/20 14:50:09 roy Exp $	*/
+/*	$NetBSD: in6.c,v 1.178 2014/10/27 14:10:12 christos Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.177 2014/10/20 14:50:09 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.178 2014/10/27 14:10:12 christos Exp $");
 
 #include "opt_inet.h"
 #include "opt_compat_netbsd.h"
@@ -1888,6 +1888,12 @@ ip6_sprintf(const struct in6_addr *addr)
 	ip6round = (ip6round + 1) & 7;
 	cp = ip6buf[ip6round];
 
+	if (IN6_IS_ADDR_V4MAPPED(addr)) {
+		struct in_addr ia = { .s_addr = addr->s6_addr32[3] };
+		snprintf(cp, 48, "::ffff:%s", inet_ntoa(ia));
+		return cp;
+	}
+
 	for (i = 0; i < 8; i++) {
 		if (dcolon == 1) {
 			if (*a == 0) {

Reply via email to