public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Lu Wei <luwei32@huawei.com>,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net,v2,2/2] selftests: fib_tests: Add test cases for IPv4/IPv6 in route notify
Date: Wed, 15 Feb 2023 22:52:11 -0700	[thread overview]
Message-ID: <9f83dac5-ab13-e0eb-3ce0-688e95703517@kernel.org> (raw)
In-Reply-To: <20230216042624.4069910-3-luwei32@huawei.com>

On 2/15/23 9:26 PM, Lu Wei wrote:
> diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh
> index 5637b5dadabd..4e48154bd195 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_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"
>  
>  VERBOSE=0
>  PAUSE_ON_FAIL=no
> @@ -655,6 +655,94 @@ fib_nexthop_test()
>  	cleanup
>  }
>  
> +fib6_notify_test()
> +{
> +	setup
> +
> +	echo
> +	echo "Fib6 info length calculation in route notify test"
> +	set -e
> +
> +	for i in 10 20 30 40 50 60 70;
> +	do
> +		$IP link add dummy$i type dummy
> +		$IP link set dev dummy$i up
> +		$IP -6 addr add 2002::$i/64 dev dummy$i
> +	done
> +
> +	for i in 10 20 30 40 50 60;
> +	do
> +		$IP -6 route append 100::/64 encap ip6 dst 2002::$i via \
> +		2002::1 dev dummy$i metric 100
> +	done

That creates a multipath route because of a quirk with IPv6. It would be
better to make this explicit by

	nexthops=
	for i in 10 20 30 40 50 60;
	do
		nexthops="$nexthops nexthop encap ip6 dst 2002::$i via 2002::1 dev
dummy$i metric 100"
	done

	$IP -6 route add 100::/64 ${nexthops}

> +
> +fib_notify_test()
> +{
> +	setup
> +
> +	echo
> +	echo "Fib4 info length calculation in route notify test"
> +
> +	set -e
> +
> +	for i in 10 20 30 40 50 60 70;
> +	do
> +		$IP link add dummy$i type dummy
> +		$IP link set dev dummy$i up
> +		$IP addr add 192.168.100.$i/24 dev dummy$i
> +	done
> +
> +	for i in 10 20 30 40 50 60;
> +	do
> +		$IP route append 10.0.0.0/24 encap ip dst 192.168.100.$i via \
> +		192.168.100.1 dev dummy$i metric 100
> +	done

With IPv4 that is not a multipath route but a series of independent
routes. Hence, doing the loop here like I showed above makes sure this
is a proper multipath route.

Thank you for adding the tests.


      reply	other threads:[~2023-02-16  5:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16  4:26 [PATCH net,v2,0/2] Fix a fib6 info notification bug Lu Wei
2023-02-16  4:26 ` [PATCH net,v2,1/2] ipv6: Add lwtunnel encap size of all siblings in nexthop calculation Lu Wei
2023-02-16  5:45   ` David Ahern
2023-02-16  4:26 ` [PATCH net,v2,2/2] selftests: fib_tests: Add test cases for IPv4/IPv6 in route notify Lu Wei
2023-02-16  5:52   ` David Ahern [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9f83dac5-ab13-e0eb-3ce0-688e95703517@kernel.org \
    --to=dsahern@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luwei32@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox