mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:24:45 +01:00
selftests: net: add test for IPv4 route with loopback IPv6 nexthop
Add a regression test for a kernel panic that occurs when an IPv4 route references an IPv6 nexthop object created on the loopback device. The test creates an IPv6 nexthop on lo, binds an IPv4 route to it, then triggers a route lookup via ping to verify the kernel does not crash. ./fib_nexthops.sh Tests passed: 249 Tests failed: 0 Reviewed-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: Jiayuan Chen <jiayuan.chen@shopee.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://patch.msgid.link/20260304113817.294966-3-jiayuan.chen@linux.dev Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
21ec92774d
commit
46c1ef0cfc
1 changed files with 11 additions and 0 deletions
|
|
@ -1672,6 +1672,17 @@ ipv4_withv6_fcnal()
|
|||
|
||||
run_cmd "$IP ro replace 172.16.101.1/32 via inet6 2001:db8:50::1 dev veth1"
|
||||
log_test $? 2 "IPv4 route with invalid IPv6 gateway"
|
||||
|
||||
# Test IPv4 route with loopback IPv6 nexthop
|
||||
# Regression test: loopback IPv6 nexthop was misclassified as reject
|
||||
# route, skipping nhc_pcpu_rth_output allocation, causing panic when
|
||||
# an IPv4 route references it and triggers __mkroute_output().
|
||||
run_cmd "$IP -6 nexthop add id 20 dev lo"
|
||||
run_cmd "$IP ro add 172.20.20.0/24 nhid 20"
|
||||
run_cmd "ip netns exec $me ping -c1 -W1 172.20.20.1"
|
||||
log_test $? 1 "IPv4 route with loopback IPv6 nexthop (no crash)"
|
||||
run_cmd "$IP ro del 172.20.20.0/24"
|
||||
run_cmd "$IP nexthop del id 20"
|
||||
}
|
||||
|
||||
ipv4_fcnal_runtime()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue