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] [day] [month] [year] [list]
Message-ID: <Z5-WpRAnP40UsMOS@shredder>
Date: Sun, 2 Feb 2025 18:00:37 +0200
From: Ido Schimmel <idosch@...sch.org>
To: Anna Emese Nyiri <annaemesenyiri@...il.com>
Cc: netdev@...r.kernel.org, fejes@....elte.hu, edumazet@...gle.com,
	kuba@...nel.org, pabeni@...hat.com, willemb@...gle.com,
	davem@...emloft.net, horms@...nel.org, shuah@...nel.org,
	linux-kselftest@...r.kernel.org
Subject: Re: [PATCH net-next 1/1] selftests: net: Add support for testing
 SO_RCVMARK and SO_RCVPRIORITY

On Wed, Jan 29, 2025 at 03:36:01PM +0100, Anna Emese Nyiri wrote:
> diff --git a/tools/testing/selftests/net/test_so_rcv.sh b/tools/testing/selftests/net/test_so_rcv.sh
> new file mode 100755
> index 000000000000..12d37f9ab905
> --- /dev/null
> +++ b/tools/testing/selftests/net/test_so_rcv.sh
> @@ -0,0 +1,56 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +
> +HOST=127.0.0.1
> +PORT=1234
> +TOTAL_TESTS=0
> +FAILED_TESTS=0
> +
> +declare -A TESTS=(
> +	["SO_RCVPRIORITY"]="-P 2"
> +	["SO_RCVMARK"]="-M 3"
> +)
> +
> +check_result() {
> +	((TOTAL_TESTS++))
> +	if [ "$1" -ne 0 ]; then
> +		((FAILED_TESTS++))
> +	fi
> +}
> +
> +for test_name in "${!TESTS[@]}"; do
> +	echo "Running $test_name test"
> +	arg=${TESTS[$test_name]}
> +
> +	./so_rcv_listener $arg $HOST $PORT &
> +	LISTENER_PID=$!
> +
> +	if ./cmsg_sender $arg $HOST $PORT; then

In addition to the other comments, please run both binaries in a
namespace that the test creates at the beginning via setup_ns() (from
lib.sh) and deletes at the end via cleanup_ns().

Thanks for adding the test.

> +		echo "Sender succeeded for $test_name"
> +	else
> +		echo "Sender failed for $test_name"
> +		kill "$LISTENER_PID" 2>/dev/null
> +		wait "$LISTENER_PID"
> +		check_result 1
> +		continue
> +	fi
> +
> +	wait "$LISTENER_PID"
> +	LISTENER_EXIT_CODE=$?
> +
> +	if [ "$LISTENER_EXIT_CODE" -eq 0 ]; then
> +		echo "Rcv test OK for $test_name"
> +		check_result 0
> +	else
> +		echo "Rcv test FAILED for $test_name"
> +		check_result 1
> +	fi
> +done
> +
> +if [ "$FAILED_TESTS" -ne 0 ]; then
> +	echo "FAIL - $FAILED_TESTS/$TOTAL_TESTS tests failed"
> +	exit 1
> +else
> +	echo "OK - All $TOTAL_TESTS tests passed"
> +	exit 0
> +fi
> -- 
> 2.43.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ