netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Florian Westphal <fw@strlen.de>, Lorenz Bauer <lmb@cloudflare.com>
Cc: herbert@gondor.apana.org.au, netdev@vger.kernel.org
Subject: Re: Question re. skb_orphan for TPROXY
Date: Thu, 2 May 2019 13:50:00 -0400	[thread overview]
Message-ID: <c0b633fc-a16d-5172-18a5-b909092173e9@gmail.com> (raw)
In-Reply-To: <20190416150002.cbkih4lfrna4ywdu@breakpoint.cc>



On 4/16/19 8:00 AM, Florian Westphal wrote:
> Lorenz Bauer <lmb@cloudflare.com> wrote:
>> Apologies for contacting you out of the blue. I'm currently trying to
>> understand how TPROXY works under the hood. As part of this endeavour,
>> I've stumbled upon the commit attached to this email.
>>
>> From the commit message I infer that somewhere, TPROXY relies on a
>> check of skb->sk == NULL to function. However, I can't figure out
>> where! I've traced TPROXY from NF_HOOK(NF_INET_PRE_ROUTING) just after
>> the call to skb_orphan to __inet_lookup_skb / skb_steal_sock called
>> from the TCP and UDP receive functions, and as far as I can tell there
>> is no such check. Can you maybe shed some light on this?
> 
> Without the skb_orphan udp/tcp might steal tunnel/ppp etc. socket
> instead of tproxy assigned tcp/udp socket.
> 

Florian, it is the responsibility of the loopback code to perform the skb_orphan()

I am confident we can revert 71f9dacd2e4d23 and fix the
paths that eventually miss the skb_orphan() call.

loopback_xmit() properly calls skb_orphan(), we also need to make sure that any kind 
of loopback (veth and others) do the same.

This is a prereq so that XDP or tc code can implement early demux earlier.

As a bonus we remove one skb_orphan() in rx fast path ;)

Note that skb_scrub_packet() used to call skb_orphan(), we need to a bit smarter
and insert it only in __dev_forward_skb()


      parent reply	other threads:[~2019-05-02 17:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16 14:49 Question re. skb_orphan for TPROXY Lorenz Bauer
2019-04-16 15:00 ` Florian Westphal
2019-04-18 12:01   ` Lorenz Bauer
2019-05-02 17:50   ` Eric Dumazet [this message]

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=c0b633fc-a16d-5172-18a5-b909092173e9@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=fw@strlen.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=lmb@cloudflare.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).