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: <0bf4989c10917b2351636a2f19794e47f3d336e9.camel@redhat.com>
Date: Thu, 09 May 2024 19:39:36 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Jakub Kicinski <kuba@...nel.org>, davem@...emloft.net
Cc: netdev@...r.kernel.org, edumazet@...gle.com, shuah@...nel.org, 
	ap420073@...il.com, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH net] selftests: net: move amt to socat for better
 compatibility

On Thu, 2024-05-09 at 09:19 -0700, Jakub Kicinski wrote:
> The test seems to expect that nc will exit after the first
> received message. This is not the case with Ncat 7.94.
> There are multiple versions of nc out there, switch
> to socat for better compatibility.
> 
> Tell socat to exit after 128 bytes and pad the message.
> 
> Since the test sets -e make sure we don't set exit code
> (|| true) and print the pass / fail rather then silently
> moving over the test and just setting non-zero exit code
> with no output indicating what failed.
> 
> Fixes: c08e8baea78e ("selftests: add amt interface selftest script")
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
> CC: shuah@...nel.org
> CC: ap420073@...il.com
> CC: linux-kselftest@...r.kernel.org
> ---
>  tools/testing/selftests/net/amt.sh | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/amt.sh b/tools/testing/selftests/net/amt.sh
> index 75528788cb95..5175a42cbe8a 100755
> --- a/tools/testing/selftests/net/amt.sh
> +++ b/tools/testing/selftests/net/amt.sh
> @@ -210,8 +210,8 @@ check_features()
>  
>  test_ipv4_forward()
>  {
> -	RESULT4=$(ip netns exec "${LISTENER}" nc -w 1 -l -u 239.0.0.1 4000)
> -	if [ "$RESULT4" == "172.17.0.2" ]; then
> +	RESULT4=$(ip netns exec "${LISTENER}" timeout 15 socat - UDP4-LISTEN:4000,readbytes=128 || true)
> +	if echo "$RESULT4" | grep -q "172.17.0.2"; then
>  		printf "TEST: %-60s  [ OK ]\n" "IPv4 amt multicast forwarding"
>  		exit 0
>  	else
> @@ -222,8 +222,8 @@ test_ipv4_forward()
>  
>  test_ipv6_forward()
>  {
> -	RESULT6=$(ip netns exec "${LISTENER}" nc -w 1 -l -u ff0e::5:6 6000)
> -	if [ "$RESULT6" == "2001:db8:3::2" ]; then
> +	RESULT6=$(ip netns exec "${LISTENER}" timeout 15 socat - UDP6-LISTEN:6000,readbytes=128 || true)
> +	if echo "$RESULT6" | grep -q "2001:db8:3::2"; then

The patch LGTM:

Acked-by: Paolo Abeni<pabeni@...hat.com>

As a minor note, shell variable expansion should already trim all the
trailing/leading spaces from the socat command output, so it should not
be necessary replace the string comparison with the grep command:

	RESULT6=$(ip netns exec "${LISTENER}" timeout 15 socat - UDP6-LISTEN:6000,readbytes=128 || true)
	if [ "$RESULT6" == "2001:db8:3::2" ]; then

Should work

Cheers,

Paolo


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ