Thread (5 messages) 5 messages, 2 authors, 23d ago

Re: [PATCH net-next v1] tcp/dccp: avoid parity split for socket-local bind range

From: Kuniyuki Iwashima <kuniyu@google.com>
Date: 2026-06-29 18:22:12

On Fri, Jun 26, 2026 at 7:00 PM luoxuanqiang [off-list ref] wrote:
quoted
2026年6月27日 07:40,Kuniyuki Iwashima [off-list ref] 写道:

On Fri, Jun 26, 2026 at 2:40 AM [off-list ref] wrote:
quoted
From: luoxuanqiang <redacted>

IP_LOCAL_PORT_RANGE lets applications override the netns ephemeral port
range on a per-socket basis.  __inet_hash_connect() already treats such a
range as an explicit application partition and scans it with step 1 [1].

Do the same in inet_csk_find_open_port():
What's the use case of IP_LOCAL_PORT_RANGE + bind(, 0)
without IP_BIND_ADDRESS_NO_PORT ?
Hi Kuniyuki,

Thanks for the question!

The use case is when an application wants to restrict ephemeral port
allocation to a socket-local IP_LOCAL_PORT_RANGE, but still needs
bind(..., 0) to allocate and reserve a local port immediately.
IP_LOCAL_PORT_RANGE was introduced for connect().

Unlike connect(), bind() occupies the port without SO_REUSEADDR/PORT,
so I don't think the step 1 or 2 makes any difference.

IP_BIND_ADDRESS_NO_PORT is useful when the application can defer port
allocation until connect(), but it changes this behavior: bind(..., 0)
does not reserve a port in that case. So it is not a replacement for
applications that need the local port before connect(), for example to
publish it to another component or set up local policy.

This patch is also intended to keep the bind(..., 0) path consistent with
Eric's earlier change in __inet_hash_connect().

Thanks,
Xuanqiang
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help