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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Znp5kEhm79Myg4zW@gmail.com>
Date: Tue, 25 Jun 2024 01:02:24 -0700
From: Breno Leitao <leitao@...ian.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
	pabeni@...hat.com, willemdebruijn.kernel@...il.com,
	ecree.xilinx@...il.com, dw@...idwei.uk,
	przemyslaw.kitszel@...el.com, michael.chan@...adcom.com,
	andrew.gospodarek@...adcom.com
Subject: Re: [PATCH net-next v2 1/4] selftests: drv-net: try to check if port
 is in use

On Mon, Jun 24, 2024 at 06:02:07PM -0700, Jakub Kicinski wrote:
> We use random ports for communication. As Willem predicted
> this leads to occasional failures. Try to check if port is
> already in use by opening a socket and binding to that port.
> 
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
> v2:
>  - remove v4 check (Willem)
>  - update comment (David, Przemek)
>  - cap the iterations (Przemek)
> ---
>  tools/testing/selftests/net/lib/py/utils.py | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py
> index 0540ea24921d..16907b51e034 100644
> --- a/tools/testing/selftests/net/lib/py/utils.py
> +++ b/tools/testing/selftests/net/lib/py/utils.py

> +        except OSError as e:
> +            if e.errno != 98:  # already in use

To make it a bit clearer, you can use something as:

	import errno

	if e.errno != errno.EADDRINUSE

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ