Files
linux-stable-mirror/include/net
Jakub Sitnicki d57f4b8749 tcp: Update bind bucket state on port release
Today, once an inet_bind_bucket enters a state where fastreuse >= 0 or
fastreuseport >= 0 after a socket is explicitly bound to a port, it remains
in that state until all sockets are removed and the bucket is destroyed.

In this state, the bucket is skipped during ephemeral port selection in
connect(). For applications using a reduced ephemeral port
range (IP_LOCAL_PORT_RANGE socket option), this can cause faster port
exhaustion since blocked buckets are excluded from reuse.

The reason the bucket state isn't updated on port release is unclear.
Possibly a performance trade-off to avoid scanning bucket owners, or just
an oversight.

Fix it by recalculating the bucket state when a socket releases a port. To
limit overhead, each inet_bind2_bucket stores its own (fastreuse,
fastreuseport) state. On port release, only the relevant port-addr bucket
is scanned, and the overall state is derived from these.

Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20250917-update-bind-bucket-state-on-unhash-v5-1-57168b661b47@cloudflare.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2025-09-23 10:12:15 +02:00
..
2025-09-02 15:52:24 -07:00
2025-04-24 17:03:45 -07:00
2025-07-08 18:05:25 -07:00
2025-07-07 16:55:54 -07:00
2025-08-29 19:36:31 -07:00
2025-08-26 17:34:31 -07:00
2025-09-03 15:16:49 -07:00
2025-09-22 11:38:43 -07:00
2025-08-26 17:34:31 -07:00
2025-09-08 18:06:21 -07:00
2025-04-15 08:21:46 -07:00
2025-09-01 13:15:14 -07:00
2025-09-18 12:32:06 +02:00
2025-09-03 15:08:20 -07:00
2025-07-04 09:32:35 +02:00
2025-09-08 18:06:21 -07:00
2025-07-11 11:00:57 -07:00