On 6/20/19 5:43 PM, Wei Wang wrote: > I am not very convinced that fib6_lookup() could be equivalent to > rt6_lookup(). Specifically, rt6_lookup() calls rt6_device_match() > while fib6_lookup() calls rt6_select() to match the oif. From a brief > glance, it does seem to be similar, especially considering that saddr > is NULL. So it probably is OK?
When you remove the rt6_check_neigh call since RT6_LOOKUP_F_REACHABLE is not set that removes the RT6_NUD_FAIL_DO_RR return and round-robin logic. I am reasonably confident that given the use case - validate the gateway and optionally given the device - it is the same. rt6_select is much more complicated than rt6_device_match, so there is a small possibility that in some corner case gateway validation fails / succeeds with fib6_table_lookup where it would succeed / fail with ip6_pol_route_lookup. But, ip6_pol_route and fib6_table_lookup is the code path actually used for packet Rx and Tx, so it seems to me to be the more proper one for gateway validation. I will send a v2 with idev change you mentioned.