netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Haley <brian.haley@hp.com>
To: Joe Perches <joe@perches.com>
Cc: Jens Rosenboom <jens@mcbone.net>,
	Linux Network Developers <netdev@vger.kernel.org>,
	Chuck Lever <chuck.lever@oracle.com>
Subject: Re: [RFC] ipv6: Change %pI6 format to output compacted addresses?
Date: Thu, 13 Aug 2009 16:24:09 -0400	[thread overview]
Message-ID: <4A847669.7050508@hp.com> (raw)
In-Reply-To: <1250187034.28285.93.camel@Joe-Laptop.home>

Joe Perches wrote:
> On Thu, 2009-08-13 at 12:27 -0400, Brian Haley wrote:
>> Jens Rosenboom wrote:
>>> Here is a new version that also
>>> fixes
>>>
>>> - Leave %pi6 alone
>>> - Don't compress a single :0:
>>> - Do output 0
>>> The results and also the remaining issues can be seen with the attached
>>> test program, that also exposes a bug in glibc for v4-mapped addresses
>>> from 0/16.
>>> To fully conform to the cited draft, we would still have to implement
>>> v4-mapped and also check whether a second run of zeros would be longer
>>> than the first one, although the draft also suggests that operators
>>> should avoid using this kind of addresses, so maybe this second issue
>>> can be neglected.
>> Yes, the "compress the most zeros" would be harder, and require two
>> passes over the address.  I had to cut corners somewhere :)
> 
> 2 things.
> 
> First a question, then a compilable but untested patch.
> 
> The patch allows "%p6ic" for compressed and "%p6ic4" for compressed
> with ipv4 last u32.
> 
> Can somebody tell me what I'm doing wrong when I link Jens' test?
> 
> cc -o test test_ipv6.c lib/vsprintf.o lib/ctype.o
> lib/vsprintf.o: In function `global constructors keyed to
> 65535_0_simple_strtoul':
> /home/joe/linux/linux-2.6/lib/vsprintf.c:1972: undefined reference to
> `__gcov_init'
> lib/vsprintf.o:(.data+0x28): undefined reference to `__gcov_merge_add'
> collect2: ld returned 1 exit status

Is your arch "um"?  Seems like those are only defined there, I'm building
a straight x86 kernel.

> Now for the patch.  Perhaps something like this (compiled, untested)

This core dumps when running "test", I'm still trying to track down why.

I think we're thinking too hard about this, I would think we'd always
want to print the shortened IPv6 address in debugging messages with %pI6.
The %pi6 places need to stay since they're an API to userspace.  I don't
think we need the extra "c" and "c4" support.

One comment on a quick scan of the code:

>  static char *ip6_addr_string(char *buf, char *end, u8 *addr,
> -				struct printf_spec spec)
> +			     struct printf_spec spec, const char *fmt)
>  {
> -	char ip6_addr[8 * 5]; /* (8 * 4 hex digits), 7 colons and trailing zero */
> +	char ip6_addr[7 * 4 + 7 + 4 * 4]; /* (7 * 4 hex digits) + 7 colons +
> +					   * ipv4 address, and trailing zero */

ip6_addr[8 * 5] is fine here, we won't ever have all eight plus an IPv4 address.

-Brian

  parent reply	other threads:[~2009-08-13 20:24 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-12 15:39 [RFC] ipv6: Change %pI6 format to output compacted addresses? Jens Rosenboom
2009-08-13  1:33 ` Brian Haley
2009-08-13 10:39   ` Joe Perches
2009-08-13 13:52     ` Jens Rosenboom
2009-08-13 15:07       ` Joe Perches
2009-08-13 14:39   ` Jens Rosenboom
2009-08-13 15:14     ` Chuck Lever
2009-08-13 16:27     ` Brian Haley
2009-08-13 18:10       ` Joe Perches
2009-08-13 18:15         ` Chuck Lever
2009-08-13 18:21           ` Joe Perches
2009-08-13 18:39             ` Chuck Lever
2009-08-13 19:05               ` Joe Perches
2009-08-13 20:24                 ` Brian Haley
2009-08-13 20:28               ` Brian Haley
2009-08-13 20:24         ` Brian Haley [this message]
2009-08-13 20:34           ` Joe Perches
2009-08-13 21:02             ` Chuck Lever
2009-08-13 21:13               ` Joe Perches
2009-08-13 23:31                 ` David Miller
2009-08-14  6:22                   ` Jens Rosenboom
2009-08-14  7:15                     ` David Miller
2009-08-14  8:15                       ` Jens Rosenboom
2009-08-14 20:12                         ` David Miller
2009-08-15 15:24                           ` [PATCH] lib/vsprintf.c: Add "%pI6c" - print pointer as compressed ipv6 address Joe Perches
2009-08-16  4:10                             ` [RFC PATCH] lib/vsprintf.c: Add struct sockaddr * "%pN<foo>" output Joe Perches
2009-08-19 14:26                               ` Chuck Lever
2009-08-19 20:44                                 ` [RFC PATCH V2] " Joe Perches
2009-08-19 22:20                                   ` Chuck Lever
2009-08-19 22:36                                     ` Joe Perches
2009-08-19 23:00                                       ` Chuck Lever
2009-08-20  4:24                                       ` Joe Perches
2009-08-20  4:29                                         ` David Miller
2009-08-17 15:18                             ` [PATCH] lib/vsprintf.c: Add "%pI6c" - print pointer as compressed ipv6 address Jens Rosenboom
2009-08-17 22:29                               ` [PATCH V2] " Joe Perches
2009-08-18 13:48                                 ` Jens Rosenboom
2009-08-29  7:20                                   ` David Miller
2009-08-14 16:26                 ` [RFC] ipv6: Change %pI6 format to output compacted addresses? Chuck Lever
2009-08-13 14:18 ` Christoph Hellwig
2009-08-13 14:30   ` Jens Rosenboom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A847669.7050508@hp.com \
    --to=brian.haley@hp.com \
    --cc=chuck.lever@oracle.com \
    --cc=jens@mcbone.net \
    --cc=joe@perches.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).