Skip to content

Improve bind(addr, 0) behaviour.

Kuniyuki Iwashima netdev 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest4 patches 2 repliesIn review
  2. v45 patches 5 repliesSuperseded
  3. v34 patches 6 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v23 patches2 repliesSuperseded
v13 patches7 repliesSuperseded

Changes in v5 from the cover letter

- Add more description to documents.
- Fix sysctl option to use proc_dointvec_minmax.
- Remove the Fixes: tag and squash two commits.

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4tcp: Remove unnecessary conditions in inet_csk_bind_conflict().net/ipv4/inet_connection_sock.c+8 -100 replies
2/4tcp: bind(0) remove the SO_REUSEADDR restriction when ephemeral ports are exhausted.Documentation/networking/ip-sysctl.txt include/net/netns/ipv4.h net/ipv4/inet_connection_sock.c +1 more+28 -10 replies
3/4tcp: Forbid to bind more than one sockets haveing SO_REUSEADDR and SO_REUSEPORT per EUID.net/ipv4/inet_connection_sock.c+9 -30 replies
4/4selftests: net: Add SO_REUSEADDR test to check if 4-tuples are fully utilized.tools/testing/selftests/net/.gitignore tools/testing/selftests/net/Makefile tools/testing/selftests/net/reuseaddr_ports_exhausted.c +1 more+200 -00 replies

Reviews trailers per patch

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

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

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

Read the v5 thread

Cover letter [PATCH v5 net-next 0/4] Improve bind(addr, 0) behaviour.

Currently we fail to bind sockets to ephemeral ports when all of the ports are exhausted even if all sockets have SO_REUSEADDR enabled. In this case, we still have a chance to connect to the different remote hosts.

These patches add net.ipv4.ip_autobind_reuse option and fix the behaviour to fully utilize all space of the local (addr, port) tuples.

---
Changes in v5:
- Add more description to documents.
- Fix sysctl option to use proc_dointvec_minmax.
- Remove the Fixes: tag and squash two commits.

Changes in v4:
- Add net.ipv4.ip_autobind_reuse option to not change the current behaviour.
- Modify .gitignore for test.
https://lore.kernel.org/netdev/[email protected]/

Changes in v3:
- Change the title and write more specific description of the 3rd patch.
- Add a test in tools/testing/selftests/net/ as the 4th patch.
https://lore.kernel.org/netdev/[email protected]/

Changes in v2:
- Change the description of the 2nd patch ('localhost' -> 'address').
- Correct the description and the if statement of the 3rd patch.
https://lore.kernel.org/netdev/[email protected]/

v1 with tests:
https://lore.kernel.org/netdev/[email protected]/
---

Kuniyuki Iwashima (4):
tcp: Remove unnecessary conditions in inet_csk_bind_conflict().
tcp: bind(0) remove the SO_REUSEADDR restriction when ephemeral ports
are exhausted.
tcp: Forbid to bind more than one sockets haveing SO_REUSEADDR and
SO_REUSEPORT per EUID.
selftests: net: Add SO_REUSEADDR test to check if 4-tuples are fully
utilized.

 Documentation/networking/ip-sysctl.txt        |   9 +
 include/net/netns/ipv4.h                      |   1 +
 net/ipv4/inet_connection_sock.c               |  36 ++--
 net/ipv4/sysctl_net_ipv4.c                    |   9 +
 tools/testing/selftests/net/.gitignore        |   1 +
 tools/testing/selftests/net/Makefile          |   2 +
 .../selftests/net/reuseaddr_ports_exhausted.c | 162 ++++++++++++++++++
 .../net/reuseaddr_ports_exhausted.sh          |  35 ++++
 8 files changed, 243 insertions(+), 12 deletions(-)
 create mode 100644 tools/testing/selftests/net/reuseaddr_ports_exhausted.c
 create mode 100755 tools/testing/selftests/net/reuseaddr_ports_exhausted.sh
Signature · 1 line
2.17.2 (Apple Git-113)