From: Ido Schimmel <idosch@nvidia.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@kernel.org, dsahern@kernel.org, horms@kernel.org,
andrew+netdev@lunn.ch, petrm@nvidia.com,
Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net 2/2] selftests: netdevsim: Add FIB notification tests for nexthop objects
Date: Mon, 19 Oct 2026 17:03:37 +0300 [thread overview]
Message-ID: <20261019140337.2886875-3-idosch@nvidia.com> (raw)
In-Reply-To: <20261019140337.2886875-1-idosch@nvidia.com>
Add IPv4 and IPv6 test cases that program a route that uses a nexthop
object and check that two notifications are emitted for it, with the
second one carrying the RTM_F_TRAP flag.
The new route_nexthop_check() helper follows the same pattern as the
existing route_{addition,deletion,replacement}_check() helpers.
Without "ipv6: Hold RCU when emitting route hardware flags
notification", the IPv6 test case passes, but triggers suspicious RCU
usage splats. The IPv4 test case is added for completeness.
Assisted-by: LLM
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
.../net/netdevsim/fib_notifications.sh | 66 +++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/tools/testing/selftests/drivers/net/netdevsim/fib_notifications.sh b/tools/testing/selftests/drivers/net/netdevsim/fib_notifications.sh
index 9896580c3d85..c49d6deb621a 100755
--- a/tools/testing/selftests/drivers/net/netdevsim/fib_notifications.sh
+++ b/tools/testing/selftests/drivers/net/netdevsim/fib_notifications.sh
@@ -8,10 +8,12 @@ ALL_TESTS="
ipv4_route_deletion_test
ipv4_route_replacement_test
ipv4_route_offload_failed_test
+ ipv4_route_nexthop_test
ipv6_route_addition_test
ipv6_route_deletion_test
ipv6_route_replacement_test
ipv6_route_offload_failed_test
+ ipv6_route_nexthop_test
"
NETDEVSIM_PATH=/sys/bus/netdevsim/
@@ -269,6 +271,50 @@ ipv4_route_offload_failed_test()
log_test "IPv4 route offload failed"
}
+route_nexthop_check()
+{
+ local ip=$1; shift
+ local route=$1; shift
+ local nhid=$1; shift
+ local expected_num_notifications=$1; shift
+ local outfile
+
+ ip netns exec testns1 sysctl -qw net.$ip.fib_notify_on_flag_change=1
+
+ outfile=$(mktemp)
+
+ $IP monitor route &> $outfile &
+ sleep 1
+ $IP route add $route nhid $nhid
+ sleep 1
+ kill_process %%
+
+ route_notify_check $outfile $expected_num_notifications
+ rm -f $outfile
+
+ $IP route del $route nhid $nhid
+}
+
+ipv4_route_nexthop_test()
+{
+ RET=0
+
+ local ip="ipv4"
+ local route=192.0.2.0/24
+ local nhid=1
+
+ $IP -4 nexthop add id $nhid dev dummy1
+
+ # Make sure two notifications will be emitted for a programmed route
+ # that uses a nexthop object.
+ local expected_num_notifications=2
+ route_nexthop_check $ip $route $nhid $expected_num_notifications
+
+ $IP nexthop del id $nhid
+
+ log_test "IPv4 route with nexthop object"
+}
+
ipv6_route_addition_test()
{
RET=0
@@ -385,6 +431,26 @@ ipv6_route_offload_failed_test()
log_test "IPv6 route offload failed"
}
+ipv6_route_nexthop_test()
+{
+ RET=0
+
+ local ip="ipv6"
+ local route=2001:db8:1::/64
+ local nhid=1
+
+ $IP -6 nexthop add id $nhid dev dummy1
+
+ # Make sure two notifications will be emitted for a programmed route
+ # that uses a nexthop object.
+ local expected_num_notifications=2
+ route_nexthop_check $ip $route $nhid $expected_num_notifications
+
+ $IP nexthop del id $nhid
+
+ log_test "IPv6 route with nexthop object"
+}
+
setup_prepare()
{
modprobe netdevsim &> /dev/null
--
2.56.0
next prev parent reply other threads:[~2026-10-19 14:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 14:03 [PATCH net 0/2] ipv6: Fix suspicious RCU usage in route hardware flags notification Ido Schimmel
2026-10-19 14:03 ` [PATCH net 1/2] ipv6: Hold RCU when emitting " Ido Schimmel
2026-10-19 17:23 ` Eric Dumazet
2026-10-19 14:03 ` Ido Schimmel [this message]
2026-10-19 17:39 ` [PATCH net 2/2] selftests: netdevsim: Add FIB notification tests for nexthop objects Eric Dumazet
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=20261019140337.2886875-3-idosch@nvidia.com \
--to=idosch@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.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