netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: Christoph Paasch <cpaasch@apple.com>
Cc: netdev <netdev@vger.kernel.org>, Ian Swett <ianswett@google.com>,
	lhedstrom@apple.com, jri.ietf@gmail.com
Subject: Re: [PATCH] udp: Allow to defer reception until connect() happened
Date: Wed, 28 Nov 2018 18:19:07 -0800	[thread overview]
Message-ID: <CANn89iKuSEeOPoyzFBq-rzecZdi7V+1eSkf0bLf2aKoMTo5ORQ@mail.gmail.com> (raw)
In-Reply-To: <20181129015626.85441-1-cpaasch@apple.com>

On Wed, Nov 28, 2018 at 5:57 PM Christoph Paasch <cpaasch@apple.com> wrote:
>
> There are use-cases where a host wants to use a UDP socket with a
> specific 4-tuple. The way to do this is to bind() and then connect() the
> socket. However, after the bind(), the socket starts receiving data even
> if it does not match the intended 4-tuple. That is because after the
> bind() UDP-socket will match in the lookup for all incoming UDP-traffic
> that has the specific IP/port.
>
> This patch prevents any incoming traffic until the connect() system-call
> is called whenever the app sets the UDP socket-option
> UDP_WAIT_FOR_CONNECT.

Please do not add something that could mislead applications writers to
think UDP stack can scale.

UDP stack does not have a full hash on 4-tuples, it means that
incoming traffic on a 'shared port' has
to scan a list of XXX sockets to find the best match ...

Also you add another cache line miss in UDP lookup to access
udp_sk()->wait_for_connect.

recvfrom() can be used to filter whatever frame that came before the connect()

  reply	other threads:[~2018-11-29 13:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-29  1:56 [PATCH] udp: Allow to defer reception until connect() happened Christoph Paasch
2018-11-29  2:19 ` Eric Dumazet [this message]
     [not found]   ` <CACpbDcePg5pdQ50+sT+b4=N+ezQChmOH=KkyfmLJZkL4duXR5w@mail.gmail.com>
2018-11-29  3:15     ` Eric Dumazet
2018-11-29 22:47       ` Christoph Paasch
2018-11-29 22:59         ` Eric Dumazet
2018-12-03 16:45           ` Christoph Paasch
2018-12-03 16:50             ` Eric Dumazet

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=CANn89iKuSEeOPoyzFBq-rzecZdi7V+1eSkf0bLf2aKoMTo5ORQ@mail.gmail.com \
    --to=edumazet@google.com \
    --cc=cpaasch@apple.com \
    --cc=ianswett@google.com \
    --cc=jri.ietf@gmail.com \
    --cc=lhedstrom@apple.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).