mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
ipv6: fib6_select_path can not use out path for nexthop objects
[ Upstream commit 34fe5a1cf95c3f114068fc16d919c9cf4b00e428 ]
Brian reported a crash in IPv6 code when using rpfilter with a setup
running FRR and external nexthop objects. The root cause of the crash
is fib6_select_path setting fib6_nh in the result to NULL because of
an improper check for nexthop objects.
More specifically, rpfilter invokes ip6_route_lookup with flowi6_oif
set causing fib6_select_path to be called with have_oif_match set.
fib6_select_path has early check on have_oif_match and jumps to the
out label which presumes a builtin fib6_nh. This path is invalid for
nexthop objects; for external nexthops fib6_select_path needs to just
return if the fib6_nh has already been set in the result otherwise it
returns after the call to nexthop_path_fib6_result. Update the check
on have_oif_match to not bail on external nexthops.
Update selftests for this problem.
Fixes: f88d8ea67f ("ipv6: Plumb support for nexthop object in a fib6_info")
Reported-by: Brian Rak <[email protected]>
Signed-off-by: David Ahern <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
1418b60e99
commit
75270f8196
2 changed files with 17 additions and 1 deletions
|
|
@ -512,6 +512,19 @@ ipv6_fcnal_runtime()
|
|||
run_cmd "$IP nexthop add id 86 via 2001:db8:91::2 dev veth1"
|
||||
run_cmd "$IP ro add 2001:db8:101::1/128 nhid 81"
|
||||
|
||||
# rpfilter and default route
|
||||
$IP nexthop flush >/dev/null 2>&1
|
||||
run_cmd "ip netns exec me ip6tables -t mangle -I PREROUTING 1 -m rpfilter --invert -j DROP"
|
||||
run_cmd "$IP nexthop add id 91 via 2001:db8:91::2 dev veth1"
|
||||
run_cmd "$IP nexthop add id 92 via 2001:db8:92::2 dev veth3"
|
||||
run_cmd "$IP nexthop add id 93 group 91/92"
|
||||
run_cmd "$IP -6 ro add default nhid 91"
|
||||
run_cmd "ip netns exec me ping -c1 -w1 2001:db8:101::1"
|
||||
log_test $? 0 "Nexthop with default route and rpfilter"
|
||||
run_cmd "$IP -6 ro replace default nhid 93"
|
||||
run_cmd "ip netns exec me ping -c1 -w1 2001:db8:101::1"
|
||||
log_test $? 0 "Nexthop with multipath default route and rpfilter"
|
||||
|
||||
# TO-DO:
|
||||
# existing route with old nexthop; append route with new nexthop
|
||||
# existing route with old nexthop; replace route with new
|
||||
|
|
|
|||
Loading…
Reference in a new issue