mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Valdis.Kletnieks@vt.edu
Cc: acme@kernel.org, linux-kernel@vger.kernel.org,
	Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH] tools lib traceevent: Add support for IP address formats
Date: Thu, 18 Dec 2014 15:13:59 -0700	[thread overview]
Message-ID: <549351A7.9040408@gmail.com> (raw)
In-Reply-To: <17321.1418939104@turing-police.cc.vt.edu>

On 12/18/14 2:45 PM, Valdis.Kletnieks@vt.edu wrote:
> On Thu, 18 Dec 2014 08:10:43 -0700, David Ahern said:
>> Adds helper for following kernel formats:
>>    %pi4 print an IPv4 address with leading zeros
>>    %pI4 print an IPv4 address without leading zeros
>>    %pi6 print an IPv6 address without colons
>>    %pI6 print an IPv6 address with colons
>>    %pI6c print an IPv6 address with colons
>>    %pISpc print an IP address from a sockaddr
>
> The description for %pI6C in the changelog doesn't match the code:
>
>> + * %pI6c  print an IPv6 address in compressed form with colons
>
> Threw me for a loop for a while trying to figure out how pI6 and pI6c were
> different, till I read the code...
>

Per Documentation/printk-formats.txt:

   %pI6    0001:0002:0003:0004:0005:0006:0007:0008
   %pi6    00010002000300040005000600070008
   %pI6c   1:2:3:4:5:6:7:8

   For printing IPv6 network-order 16-bit hex addresses. The 'I6' and 'i6'
   specifiers result in a printed address with ('I6') or without ('i6')
   colon-separators. Leading zeros are always used.

   The additional 'c' specifier can be used with the 'I' specifier to
   print a compressed IPv6 address as described by
         http://tools.ietf.org/html/rfc5952



I do see two mistakes in my patch -- use of 'c' and 'S' requires 'I'. 
After that the code that prints pI6c is a slightly modified version of 
what is in lib/vsprintf.c so the output between in-kernel tracing (cat 
trace_pipe) should match perf-script output. Compare 
ip6_compressed_string() in lib/vsprintf.c to print_ip6c_addr() in this 
patch.

Are you seeing something different?

David


  reply	other threads:[~2014-12-18 22:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-18 15:10 David Ahern
2014-12-18 15:52 ` Arnaldo Carvalho de Melo
2014-12-18 15:59   ` David Ahern
2014-12-18 16:27   ` Steven Rostedt
2014-12-18 22:16     ` Arnaldo Carvalho de Melo
2014-12-18 22:50       ` David Ahern
2014-12-18 21:45 ` Valdis.Kletnieks
2014-12-18 22:13   ` David Ahern [this message]
2014-12-19  1:41     ` David Ahern
2014-12-22 17:01       ` Jiri Olsa
2014-12-22 17:10         ` David Ahern
2014-12-22 17:28           ` Jiri Olsa
  -- strict thread matches above, loose matches on Subject: below --
2014-12-17 20:29 David Ahern
2014-12-18  4:26 ` Namhyung Kim
2014-12-18  4:32   ` David Ahern
2014-12-18  5:04     ` Namhyung Kim

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=549351A7.9040408@gmail.com \
    --to=dsahern@gmail.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=acme@kernel.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.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

Powered by JetHome