Skip to content

net: prefer listeners bound to an address

Peter Oskolkov netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5net: udp: prefer listeners bound to an addressnet/ipv4/udp.c+19 -570 replies
2/5net: udp6: prefer listeners bound to an addressnet/ipv6/udp.c+21 -580 replies
3/5net: tcp: prefer listeners bound to an addressnet/ipv4/inet_hashtables.c+8 -520 replies
4/5net: tcp6: prefer listeners bound to an addressnet/ipv6/inet6_hashtables.c+6 -480 replies
5/5selftests: net: test that listening sockets match on address properlytools/testing/selftests/net/.gitignore tools/testing/selftests/net/Makefile tools/testing/selftests/net/reuseport_addr_any.c +1 more+271 -20 replies

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchEric Dumazet
SeriesR-b
1/5
2/5
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH net-next 0/5] net: prefer listeners bound to an address

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
Signature · 1 line
2.20.0.rc2.403.gdbc3b29805-goog