netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Oskolkov <posk@google.com>
To: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Cc: Peter Oskolkov <posk.devel@gmail.com>,
	Eric Dumazet <edumazet@google.com>,
	Peter Oskolkov <posk@google.com>
Subject: [PATCH net-next 0/5] net: prefer listeners bound to an address
Date: Wed, 12 Dec 2018 13:15:32 -0800	[thread overview]
Message-ID: <20181212211537.199044-1-posk@google.com> (raw)

A relatively common use case is to have several IPs configured
on a host, and have different listeners for each of them. We would
like to add a "catch all" listener on addr_any, to match incoming
connections not served by any of the listeners bound to a specific
address.

However, port-only lookups can match addr_any sockets when sockets
listening on specific addresses are present if so_reuseport flag
is set. This patchset eliminates lookups into port-only hashtable,
as lookups by (addr,port) tuple are easily available.

In a future patchset I plan to explore whether it is possible
to remove port-only hashtables completely: additional refactoring
will be required, as some non-lookup code uses the hashtables.

Peter Oskolkov (5):
  net: udp: prefer listeners bound to an address
  net: udp6: prefer listeners bound to an address
  net: tcp: prefer listeners bound to an address
  net: tcp6: prefer listeners bound to an address
  selftests: net: test that listening sockets match on address properly

 net/ipv4/inet_hashtables.c                    |  60 +---
 net/ipv4/udp.c                                |  76 ++---
 net/ipv6/inet6_hashtables.c                   |  54 +---
 net/ipv6/udp.c                                |  79 ++----
 tools/testing/selftests/net/.gitignore        |   1 +
 tools/testing/selftests/net/Makefile          |   4 +-
 .../selftests/net/reuseport_addr_any.c        | 264 ++++++++++++++++++
 .../selftests/net/reuseport_addr_any.sh       |   4 +
 8 files changed, 325 insertions(+), 217 deletions(-)
 create mode 100644 tools/testing/selftests/net/reuseport_addr_any.c
 create mode 100755 tools/testing/selftests/net/reuseport_addr_any.sh

-- 
2.20.0.rc2.403.gdbc3b29805-goog

             reply	other threads:[~2018-12-12 21:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-12 21:15 Peter Oskolkov [this message]
2018-12-12 21:15 ` [PATCH net-next 1/5] net: udp: prefer listeners bound to an address Peter Oskolkov
2018-12-12 21:15 ` [PATCH net-next 2/5] net: udp6: " Peter Oskolkov
2018-12-12 21:15 ` [PATCH net-next 3/5] net: tcp: " Peter Oskolkov
2018-12-12 21:15 ` [PATCH net-next 4/5] net: tcp6: " Peter Oskolkov
2018-12-12 21:15 ` [PATCH net-next 5/5] selftests: net: test that listening sockets match on address properly Peter Oskolkov
2018-12-13  6:03 ` [PATCH net-next 0/5] net: prefer listeners bound to an address Eric Dumazet
2018-12-14 23:56 ` David Miller

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=20181212211537.199044-1-posk@google.com \
    --to=posk@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=posk.devel@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).