summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2023-12-14 19:29:39 +0000
committerJakub Kicinski <kuba@kernel.org>2023-12-15 17:56:27 -0800
commit207184853dbdb62d8b02c7a141d3297e94e33451 (patch)
treedcf0343765740f75ebd2b1af6a36fca7c85d491f /security
parent41db7626b73210cb99eea9cf672dcfce58c68ab2 (diff)
tcp/dccp: change source port selection at connect() time
In commit 1580ab63fc9a ("tcp/dccp: better use of ephemeral ports in connect()") we added an heuristic to select even ports for connect() and odd ports for bind(). This was nice because no applications changes were needed. But it added more costs when all even ports are in use, when there are few listeners and many active connections. Since then, IP_LOCAL_PORT_RANGE has been added to permit an application to partition ephemeral port range at will. This patch extends the idea so that if IP_LOCAL_PORT_RANGE is set on a socket before accept(), port selection no longer favors even ports. This means that connect() can find a suitable source port faster, and applications can use a different split between connect() and bind() users. This should give more entropy to Toeplitz hash used in RSS: Using even ports was wasting one bit from the 16bit sport. A similar change can be done in inet_csk_find_open_port() if needed. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Jakub Sitnicki <jakub@cloudflare.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com> Reviewed-by: Jason Xing <kerneljasonxing@gmail.com> Link: https://lore.kernel.org/r/20231214192939.1962891-3-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'security')
0 files changed, 0 insertions, 0 deletions