Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: fib_nexthops: Add test cases for error routes deletion

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>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/20251221144829.197694-2-idosch@nvidia.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Ido Schimmel and committed by
Paolo Abeni
44741e9d ac782f4e

+15
+15
tools/testing/selftests/net/fib_nexthops.sh
··· 800 800 set +e 801 801 check_nexthop "dev veth1" "" 802 802 log_test $? 0 "Nexthops removed on admin down" 803 + 804 + # error routes should be deleted when their nexthop is deleted 805 + run_cmd "$IP li set dev veth1 up" 806 + run_cmd "$IP -6 nexthop add id 58 dev veth1" 807 + run_cmd "$IP ro add blackhole 2001:db8:101::1/128 nhid 58" 808 + run_cmd "$IP nexthop del id 58" 809 + check_route6 "2001:db8:101::1" "" 810 + log_test $? 0 "Error route removed on nexthop deletion" 803 811 } 804 812 805 813 ipv6_grp_refs() ··· 1467 1459 1468 1460 run_cmd "$IP ro del 172.16.102.0/24" 1469 1461 log_test $? 0 "Delete route when not specifying nexthop attributes" 1462 + 1463 + # error routes should be deleted when their nexthop is deleted 1464 + run_cmd "$IP nexthop add id 23 dev veth1" 1465 + run_cmd "$IP ro add blackhole 172.16.102.100/32 nhid 23" 1466 + run_cmd "$IP nexthop del id 23" 1467 + check_route "172.16.102.100" "" 1468 + log_test $? 0 "Error route removed on nexthop deletion" 1470 1469 } 1471 1470 1472 1471 ipv4_grp_fcnal()