From: Ido Schimmel <idosch@nvidia.com>
To: <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
<edumazet@google.com>, <dsahern@kernel.org>, <horms@kernel.org>,
<penguin-kernel@I-love.SAKURA.ne.jp>,
Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net 2/2] selftests: fib_nexthops: Add test cases for error routes deletion
Date: Sun, 21 Dec 2025 16:48:29 +0200 [thread overview]
Message-ID: <20251221144829.197694-2-idosch@nvidia.com> (raw)
In-Reply-To: <20251221144829.197694-1-idosch@nvidia.com>
Add test cases that check that error routes (e.g., blackhole) are
deleted when their nexthop is deleted.
Output without "ipv4: Fix reference count leak when using error routes
with nexthop objects":
# ./fib_nexthops.sh -t "ipv4_fcnal ipv6_fcnal"
IPv4 functional
----------------------
[...]
WARNING: Unexpected route entry
TEST: Error route removed on nexthop deletion [FAIL]
IPv6
----------------------
[...]
TEST: Error route removed on nexthop deletion [ OK ]
Tests passed: 20
Tests failed: 1
Tests skipped: 0
Output with "ipv4: Fix reference count leak when using error routes
with nexthop objects":
# ./fib_nexthops.sh -t "ipv4_fcnal ipv6_fcnal"
IPv4 functional
----------------------
[...]
TEST: Error route removed on nexthop deletion [ OK ]
IPv6
----------------------
[...]
TEST: Error route removed on nexthop deletion [ OK ]
Tests passed: 21
Tests failed: 0
Tests skipped: 0
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
tools/testing/selftests/net/fib_nexthops.sh | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/tools/testing/selftests/net/fib_nexthops.sh b/tools/testing/selftests/net/fib_nexthops.sh
index 2b0a90581e2f..21026b667667 100755
--- a/tools/testing/selftests/net/fib_nexthops.sh
+++ b/tools/testing/selftests/net/fib_nexthops.sh
@@ -800,6 +800,14 @@ ipv6_fcnal()
set +e
check_nexthop "dev veth1" ""
log_test $? 0 "Nexthops removed on admin down"
+
+ # error routes should be deleted when their nexthop is deleted
+ run_cmd "$IP li set dev veth1 up"
+ run_cmd "$IP -6 nexthop add id 58 dev veth1"
+ run_cmd "$IP ro add blackhole 2001:db8:101::1/128 nhid 58"
+ run_cmd "$IP nexthop del id 58"
+ check_route6 "2001:db8:101::1" ""
+ log_test $? 0 "Error route removed on nexthop deletion"
}
ipv6_grp_refs()
@@ -1459,6 +1467,13 @@ ipv4_fcnal()
run_cmd "$IP ro del 172.16.102.0/24"
log_test $? 0 "Delete route when not specifying nexthop attributes"
+
+ # error routes should be deleted when their nexthop is deleted
+ run_cmd "$IP nexthop add id 23 dev veth1"
+ run_cmd "$IP ro add blackhole 172.16.102.100/32 nhid 23"
+ run_cmd "$IP nexthop del id 23"
+ check_route "172.16.102.100" ""
+ log_test $? 0 "Error route removed on nexthop deletion"
}
ipv4_grp_fcnal()
--
2.52.0
next prev parent reply other threads:[~2025-12-21 14:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-21 14:48 [PATCH net 1/2] ipv4: Fix reference count leak when using error routes with nexthop objects Ido Schimmel
2025-12-21 14:48 ` Ido Schimmel [this message]
2025-12-22 23:13 ` [PATCH net 2/2] selftests: fib_nexthops: Add test cases for error routes deletion David Ahern
2025-12-22 23:12 ` [PATCH net 1/2] ipv4: Fix reference count leak when using error routes with nexthop objects David Ahern
2025-12-30 9:40 ` patchwork-bot+netdevbpf
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=20251221144829.197694-2-idosch@nvidia.com \
--to=idosch@nvidia.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
/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;
as well as URLs for NNTP newsgroup(s).