lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CANn89iJP84M3Jj0=6-dhsSMDnE8Wj7M7QwcMa3qbpqxbS-CfQw@mail.gmail.com>
Date: Tue, 30 Jul 2024 09:09:41 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: xiaolinkui <xiaolinkui@....com>
Cc: davem@...emloft.net, dsahern@...nel.org, kuba@...nel.org, 
	pabeni@...hat.com, netdev@...r.kernel.org, 
	Linkui Xiao <xiaolinkui@...inos.cn>
Subject: Re: Re: [PATCH] tcp/dccp: Add another way to allocate local ports in connect()

On Tue, Jul 30, 2024 at 8:38 AM xiaolinkui <xiaolinkui@....com> wrote:
>
> Thanks for your reply.
>
> At 2024-07-29 19:46:38, "Eric Dumazet" <edumazet@...gle.com> wrote:
> >On Mon, Jul 29, 2024 at 11:56 AM <xiaolinkui@....com> wrote:
> >>
> >> From: Linkui Xiao <xiaolinkui@...inos.cn>
> >>
> >> Commit 07f4c90062f8 ("tcp/dccp: try to not exhaust ip_local_port_range
> >> in connect()") allocates even ports for connect() first while leaving
> >> odd ports for bind() and this works well in busy servers.
> >>
> >> But this strategy causes severe performance degradation in busy clients.
> >> when a client has used more than half of the local ports setted in
> >> proc/sys/net/ipv4/ip_local_port_range, if this client try to connect
> >> to a server again, the connect time increases rapidly since it will
> >> traverse all the even ports though they are exhausted.
> >>
> >> So this path provides another strategy by introducing a system option:
> >> local_port_allocation. If it is a busy client, users should set it to 1
> >> to use sequential allocation while it should be set to 0 in other
> >> situations. Its default value is 0.
> >>
> >> In commit 207184853dbd ("tcp/dccp: change source port selection at
> >> connect() time"), tell users that they can access all odd and even ports
> >> by using IP_LOCAL_PORT_RANGE. But this requires users to modify the
> >> socket application. When even numbered ports are not sufficient, use the
> >> sysctl parameter to achieve the same effect:
> >>         sysctl -w net.ipv4.local_port_allocation=1
> >>
> >> Signed-off-by: Linkui Xiao <xiaolinkui@...inos.cn>
> >
> >Too many errors in this patch...
> >
> >Lack of READ_ONCE() when reading a sysctl.
> >Lack or per-netns sysctl.
> >No documentation.
> Yes, it was my negligence.But do you think it's necessary
> for me to send a v2 version?Or should we maintain the previous
> state here and put the sysctl setting method in my private kernel?

I think that adding a sysctl because some applications "can not be
changed" is not convincing.

Another useful socket option is IP_BIND_ADDRESS_NO_PORT, which also is
a choice made by applications.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ