Netdev List
 help / color / mirror / Atom feed
From: Hangbin Liu <hangbin.liu@linux.dev>
To: Yaroslav Dudkov <aroslavdudkov622@gmail.com>
Cc: netdev@vger.kernel.org, dsahern@kernel.org, idosch@nvidia.com,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, shuah@kernel.org,
	weiwan@google.com, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net v2 2/2] selftests: fib_tests: Add carrier gateway test
Date: Thu, 5 Nov 2026 09:51:30 +0800	[thread overview]
Message-ID: <auvhInnH7ESZj5Xr@fedora> (raw)
In-Reply-To: <20261104195655.1406837-3-aroslavdudkov622@gmail.com>

On Wed, Nov 04, 2026 at 07:56:55PM +0000, Yaroslav Dudkov wrote:
> Test adds routes with a gateway while the nexthop device
> has no carrier and ignore_routes_with_linkdown is enabled on it. The
> routes are added to the main table and to a non-main table, with and
> without a device, for both IPv4 and IPv6. Routes are expected to be
> accepted disregarding the link state.
> 
> Without the previous patch, the IPv6 non-main table cases fail:
> 
> Without fix:
> Gateway validation with carrier down
>     TEST: IPv4 route in main table                                [ OK ]
>     TEST: IPv6 route in main table                                [ OK ]
>     TEST: IPv4 route in non-main table                            [ OK ]
>     TEST: IPv6 route in non-main table                            [FAIL]
>     TEST: IPv4 route in non-main table without device             [ OK ]
>     TEST: IPv6 route in non-main table without device             [FAIL]
>     TEST: IPv4 linkdown flag set                                  [ OK ]
>     TEST: IPv6 linkdown flag set                                  [FAIL]
> 
> With fix:
> Gateway validation with carrier down
>     TEST: IPv4 route in main table                                [ OK ]
>     TEST: IPv6 route in main table                                [ OK ]
>     TEST: IPv4 route in non-main table                            [ OK ]
>     TEST: IPv6 route in non-main table                            [ OK ]
>     TEST: IPv4 route in non-main table without device             [ OK ]
>     TEST: IPv6 route in non-main table without device             [ OK ]
>     TEST: IPv4 linkdown flag set                                  [ OK ]
>     TEST: IPv6 linkdown flag set                                  [ OK ]
> 
> Suggested-by: Ido Schimmel <idosch@nvidia.com>
> Signed-off-by: Yaroslav Dudkov <aroslavdudkov622@gmail.com>
> ---
>  tools/testing/selftests/net/fib_tests.sh | 40 ++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
> 
> diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh
> index 7c47d7fe250d..d7ac3c727f70 100755
> --- a/tools/testing/selftests/net/fib_tests.sh
> +++ b/tools/testing/selftests/net/fib_tests.sh
> @@ -406,10 +406,50 @@ fib_carrier_unicast_test()
>  	cleanup
>  }
>  
> +fib_carrier_gw_test()
> +{
> +	echo
> +	echo "Gateway validation with carrier down"
> +
> +	setup
> +
> +	set -e
> +	$NS_EXEC sysctl -qw net.ipv4.conf.dummy0.ignore_routes_with_linkdown=1
> +	$NS_EXEC sysctl -qw net.ipv6.conf.dummy0.ignore_routes_with_linkdown=1
> +	$IP link set dev dummy0 carrier off
> +	sleep 1
> +	set +e
> +
> +	$IP route add 203.0.113.0/25 via 198.51.100.2 dev dummy0 &> /dev/null
> +	log_test $? 0 "IPv4 route in main table"
> +	$IP -6 route add 2001:db8:10::/64 via 2001:db8:1::2 dev dummy0 &> /dev/null
> +	log_test $? 0 "IPv6 route in main table"
> +
> +	$IP route add 203.0.113.0/25 table 100 via 198.51.100.2 dev dummy0 &> /dev/null
> +	log_test $? 0 "IPv4 route in non-main table"
> +	$IP -6 route add 2001:db8:10::/64 table 100 via 2001:db8:1::2 dev dummy0 &> /dev/null
> +	log_test $? 0 "IPv6 route in non-main table"
> +
> +	$IP route add 203.0.113.128/25 table 100 via 198.51.100.2 &> /dev/null
> +	log_test $? 0 "IPv4 route in non-main table without device"
> +	$IP -6 route add 2001:db8:11::/64 table 100 via 2001:db8:1::2 &> /dev/null
> +	log_test $? 0 "IPv6 route in non-main table without device"
> +
> +	$IP route show table 100 203.0.113.0/25 | \
> +		grep -q "linkdown"
> +	log_test $? 0 "IPv4 linkdown flag set"
> +	$IP -6 route show table 100 2001:db8:10::/64 | \
> +		grep -q "linkdown"
> +	log_test $? 0 "IPv6 linkdown flag set"
> +
> +	cleanup
> +}
> +
>  fib_carrier_test()
>  {
>  	fib_carrier_local_test
>  	fib_carrier_unicast_test
> +	fib_carrier_gw_test
>  }
>  
>  fib_rp_filter_test()
> -- 
> 2.54.0
> 

Tested-by: Hangbin Liu <liuhangbin@kylinos.cn>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>

  reply	other threads:[~2026-11-05  1:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 19:56 [PATCH net v2 0/2] ipv6: ignore link state in gateway check Yaroslav Dudkov
2026-11-04 19:56 ` [PATCH net v2 1/2] " Yaroslav Dudkov
2026-11-05  2:12   ` Hangbin Liu
2026-11-04 19:56 ` [PATCH net v2 2/2] selftests: fib_tests: Add carrier gateway test Yaroslav Dudkov
2026-11-05  1:51   ` Hangbin Liu [this message]
2026-11-04 20:09 ` [PATCH net v2 0/2] ipv6: ignore link state in gateway check netdev-bot+sinfo

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=auvhInnH7ESZj5Xr@fedora \
    --to=hangbin.liu@linux.dev \
    --cc=aroslavdudkov622@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=weiwan@google.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