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: <9743a6cc267276bfeba5b0fdcf7ba9a4077c67e1.camel@redhat.com>
Date: Thu, 20 Jul 2023 11:32:20 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Kui-Feng Lee <thinker.li@...il.com>, dsahern@...nel.org, 
 davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
 netdev@...r.kernel.org,  martin.lau@...ux.dev, kernel-team@...a.com,
 yhs@...a.com
Cc: Kui-Feng Lee <kuifeng@...a.com>
Subject: Re: [PATCH net-next v2 2/2] selftests: fib_tests: Add a test case
 for IPv6 garbage collection

On Tue, 2023-07-18 at 11:03 -0700, Kui-Feng Lee wrote:
> Add 10 IPv6 routes with expiration time.  Wait for a few seconds
> to make sure they are removed correctly.
> 
> Signed-off-by: Kui-Feng Lee <kuifeng@...a.com>

Same thing as the previous patch.

> ---
>  tools/testing/selftests/net/fib_tests.sh | 49 +++++++++++++++++++++++-
>  1 file changed, 48 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh
> index 35d89dfa6f11..55bc6897513a 100755
> --- a/tools/testing/selftests/net/fib_tests.sh
> +++ b/tools/testing/selftests/net/fib_tests.sh
> @@ -9,7 +9,7 @@ ret=0
>  ksft_skip=4
>  
>  # all tests in this script. Can be overridden with -t option
> -TESTS="unregister down carrier nexthop suppress ipv6_notify ipv4_notify ipv6_rt ipv4_rt ipv6_addr_metric ipv4_addr_metric ipv6_route_metrics ipv4_route_metrics ipv4_route_v6_gw rp_filter ipv4_del_addr ipv4_mangle ipv6_mangle ipv4_bcast_neigh"
> +TESTS="unregister down carrier nexthop suppress ipv6_notify ipv4_notify ipv6_rt ipv4_rt ipv6_addr_metric ipv4_addr_metric ipv6_route_metrics ipv4_route_metrics ipv4_route_v6_gw rp_filter ipv4_del_addr ipv4_mangle ipv6_mangle ipv4_bcast_neigh fib6_gc_test"

At this point is likely worthy splitting the above line in multiple
ones, something alike:

TESTS="unregister down carrier nexthop suppress ipv6_notify \
	ipv4_notify ipv6_rt ipv4_rt ipv6_addr_metric ipv4_addr_metric
\
	ipv6_route_metrics ipv4_route_metrics ipv4_route_v6_gw \
	rp_filter ipv4_del_addr ipv4_mangle ipv6_mangle ipv4_bcast_neigh \
	fib6_gc_test"

>  
>  VERBOSE=0
>  PAUSE_ON_FAIL=no
> @@ -747,6 +747,52 @@ fib_notify_test()
>  	cleanup &> /dev/null
>  }
>  
> +fib6_gc_test()
> +{
> +	setup
> +
> +	echo
> +	echo "Fib6 garbage collection test"
> +	set -e
> +
> +	OLD_INTERVAL=$(sysctl -n net.ipv6.route.gc_interval)
> +	# Check expiration of routes every 3 seconds (GC)
> +	$NS_EXEC sysctl -wq net.ipv6.route.gc_interval=3
> +
> +	$IP link add dummy_10 type dummy
> +	$IP link set dev dummy_10 up
> +	$IP -6 address add 2001:10::1/64 dev dummy_10
> +
> +	for i in 0 1 2 3 4 5 6 7 8 9; do
		$(seq 0 9)

> +	    # Expire route after 2 seconds
> +	    $IP -6 route add 2001:20::1$i \
> +		via 2001:10::2 dev dummy_10 expires 2
> +	done
> +	N_EXP=$($IP -6 route list |grep expires|wc -l)
> +	if [ $N_EXP -ne 10 ]; then
> +		echo "FAIL: expected 10 routes with expires, got $N_EXP"
> +		ret=1
> +	else
> +	    sleep 4
> +	    N_EXP_s20=$($IP -6 route list |grep expires|wc -l)
> +
> +	    if [ $N_EXP_s20 -ne 0 ]; then
> +		echo "FAIL: expected 0 routes with expires, got $N_EXP_s20"
> +		ret=1
> +	    else
> +		ret=0
> +	    fi
> +	fi

Possibly also worth trying with a few K of permanent routes, and dump
the time required in both cases?

> +
> +	set +e
> +
> +	log_test $ret 0 "ipv6 route garbage collection"
> +
> +	sysctl -wq net.ipv6.route.gc_interval=$OLD_INTERVAL

No need to restore, gc_interval is a per namespace param specific
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ