[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1250190346.28285.120.camel@Joe-Laptop.home>
Date: Thu, 13 Aug 2009 12:05:46 -0700
From: Joe Perches <joe@...ches.com>
To: Chuck Lever <chuck.lever@...cle.com>
Cc: Brian Haley <brian.haley@...com>, Jens Rosenboom <jens@...one.net>,
Linux Network Developers <netdev@...r.kernel.org>
Subject: Re: [RFC] ipv6: Change %pI6 format to output compacted addresses?
On Thu, 2009-08-13 at 14:39 -0400, Chuck Lever wrote:
> On Aug 13, 2009, at 2:21 PM, Joe Perches wrote:
> > On Thu, 2009-08-13 at 14:15 -0400, Chuck Lever wrote:
> >> On Aug 13, 2009, at 2:10 PM, Joe Perches wrote:
> >>> The patch allows "%p6ic" for compressed and "%p6ic4" for compressed
> >>> with ipv4 last u32.
> >> Why do these need to be separate?
> > Just an option.
> > I think it possible somebody will want "1::" instead of "1::0.0.0.0"
> Hrm.
> With %p6ic4, each call site now has to see that it's an IPv6 address,
> and then decide if the address is a mapped v4 address or not. It's
> the same logic everywhere.
I suppose ipv6_addr_v4mapped(addr) could be tested instead
Perhaps this on top of last:
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index dd02842..7ce34a7 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -25,6 +25,7 @@
#include <linux/kallsyms.h>
#include <linux/uaccess.h>
#include <linux/ioport.h>
+#include <net/ipv6.h>
#include <asm/page.h> /* for PAGE_SIZE */
#include <asm/div64.h>
@@ -701,7 +702,7 @@ static char *ip6_compressed_string(char *buf, char *end, u8 *addr,
u16 *addr16 = (u16 *)addr;
ip6_colon_t colon = DC_START;
- if (fmt[3] == '4') { /* use :: and ipv4 */
+ if (ipv6_addr_v4mapped((const struct in6_addr *)addr)) {
for (i = 0; i < 6; i++) {
p = ip6_compress_u16(p, addr16[i], addr16[i+1],
&colon, &needcolon);
@@ -832,8 +833,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
* Formatted IP supported
* 4: 001.002.003.004
* 6: 0001:0203:...:0708
- * 6c: 1::708
- * 6c4: 1::1.2.3.4
+ * 6c: 1::708 or 1::1.2.3.4
*/
case 'I': /* Contiguous: */
if (fmt[1] == '4' || fmt[1] == '6')
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists