netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next] tcp: Check daddr_cache before use in tracepoint
Date: Mon, 16 Oct 2017 15:55:00 -0600	[thread overview]
Message-ID: <cfd6b39a-41a6-ccf6-80a7-07089a2d6fea@gmail.com> (raw)
In-Reply-To: <CAM_iQpUgWJwjaRYw3vX4t20foheOrebU3U2ACZqrAbTYqYc-5A@mail.gmail.com>

On 10/16/17 3:46 PM, Cong Wang wrote:
> Well, for NULL case, the entry->saddr_v6 will not be filled with
> your patch.

I think you meant daddr_v6 and yes it will not get filled in, but 0 is
better than a panic ;-)

> 
> How about using sk->sk_v6_daddr?
> 

That works, but then both addresses should come from sk and not np:

diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h
index 1ffab6d96e94..7989c2dcedf1 100644
--- a/include/trace/events/tcp.h
+++ b/include/trace/events/tcp.h
@@ -46,9 +46,9 @@ TRACE_EVENT(tcp_retransmit_skb,

                if (np) {
                        pin6 = (struct in6_addr *)__entry->saddr_v6;
-                       *pin6 = np->saddr;
+                       *pin6 = sk->sk_v6_rcv_saddr;
                        pin6 = (struct in6_addr *)__entry->daddr_v6;
-                       *pin6 = *(np->daddr_cache);
+                       *pin6 = sk->sk_v6_daddr;
                } else {
                        pin6 = (struct in6_addr *)__entry->saddr_v6;
                        ipv6_addr_set_v4mapped(inet->inet_saddr, pin6);


So np is just a trigger for IPv6 versus v4 mapped.

I do have a question about why ipv4 addresses are non-NULL:

$ perf script
         swapper     0 [000]    25.025102: tcp:tcp_retransmit_skb:
sport=22 dport=48076 saddr=127.0.0.6 daddr=127.0.0.6
saddrv6=2001:db8:1::4 daddrv6=2001:db8:1::64
         swapper     0 [000]    25.231125: tcp:tcp_retransmit_skb:
sport=22 dport=48076 saddr=127.0.0.6 daddr=127.0.0.6
saddrv6=2001:db8:1::4 daddrv6=2001:db8:1::64

  reply	other threads:[~2017-10-16 21:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 21:29 [PATCH net-next] tcp: Check daddr_cache before use in tracepoint David Ahern
2017-10-16 21:46 ` Cong Wang
2017-10-16 21:55   ` David Ahern [this message]
2017-10-16 22:05     ` Cong Wang
2017-10-16 22:08       ` David Ahern
2017-10-17  3:45 ` Eric Dumazet
2017-10-17 15:32   ` David Ahern
2017-10-17 17:05     ` Cong Wang

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=cfd6b39a-41a6-ccf6-80a7-07089a2d6fea@gmail.com \
    --to=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /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).