From: Fernando Fernandez Mancera <fmancera@suse.de>
To: Eric Dumazet <edumazet@google.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, corbet@lwn.net,
ncardwell@google.com, kuniyu@google.com, dsahern@kernel.org,
idosch@nvidia.com, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
Thorsten Toepper <thorsten.toepper@sap.com>
Subject: Re: [PATCH RFC net-next] inet: add ip_retry_random_port sysctl to reduce sequential port retries
Date: Mon, 9 Feb 2026 12:56:57 +0100 [thread overview]
Message-ID: <d76cd8c3-deb0-4f39-b5b9-a711d155cd5f@suse.de> (raw)
In-Reply-To: <CANn89iK3Pu2NXxejTSLF-7MhBc03_ZJUjOtZcTC4nMsbsDpbSw@mail.gmail.com>
On 2/6/26 6:09 PM, Eric Dumazet wrote:
> On Fri, Feb 6, 2026 at 5:28 PM Fernando Fernandez Mancera
> <fmancera@suse.de> wrote:
>>
>>
>>
>> It makes sense. I have tested this approach and we got a more even
>> distribution of source ports when having thousands of reserved ports. No
>> difference at all when not using reserved ports.
>>
>> Please, you can find the distribution graph with the current algorithm
>> [1] and with the random step algorithm [2].
>>
>> While I understand that this approach is introducing a call to
>> get_random_u32_below() on every connect, I am wondering if it makes
>> sense to replace the existing algorithm with this variant. What do you
>> think?
>
> I would ask RFC 6056 experts like Fernando Gont what they think.
>
> Note that if we use random at each connect(), we defeat one of the principles
> of ephemeral port selection : try very hard to avoid 4-tuple collision.
>
Right. I will reach out to him and get his opinion. I have plenty of
time before net-next open again. I am also collecting some metrics
regarding the 4-tuple collision frequency.
>>
>> Please, notice the implementation below. I plan to send an official v1
>> once net-next is open. In addition, I am rewriting the commit message as
>> I find the current one confusing.
>>
>> [1] https://0xffsoftware.com/port_graph_current_alg.html
>>
>> [2] https://0xffsoftware.com/port_graph_random_step_alg.html
>
next prev parent reply other threads:[~2026-02-09 11:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-03 17:54 [PATCH RFC net-next] inet: add ip_retry_random_port sysctl to reduce sequential port retries Fernando Fernandez Mancera
2026-02-03 18:02 ` Fernando Fernandez Mancera
2026-02-04 16:25 ` Fernando Fernandez Mancera
2026-02-04 16:49 ` Eric Dumazet
2026-02-04 17:29 ` Fernando Fernandez Mancera
2026-02-06 16:27 ` Fernando Fernandez Mancera
2026-02-06 17:09 ` Eric Dumazet
2026-02-09 11:56 ` Fernando Fernandez Mancera [this message]
2026-02-09 13:53 ` longxie86
2026-02-09 15:25 ` Fernando Fernandez Mancera
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=d76cd8c3-deb0-4f39-b5b9-a711d155cd5f@suse.de \
--to=fmancera@suse.de \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=thorsten.toepper@sap.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