David, On Thu, 1 Aug 2019 13:51:25 -0600 David Ahern <dsah...@gmail.com> wrote:
> On 8/1/19 2:29 AM, Hangbin Liu wrote: > > Jianlin reported a bug that for IPv4, ip route get from src_addr would fail > > if src_addr is not an address on local system. > > > > \# ip route get 1.1.1.1 from 2.2.2.2 > > RTNETLINK answers: Invalid argument > > so this is a forwarding lookup in which case iif should be set. On actual forwarding, yes, it will be set. But if we are just doing a lookup for a route (iif is LOOPBACK_IFINDEX), I think this should still give us the matching route, which is what IPv6 already does and what this patch fixes for IPv4. Otherwise, we have no way to fetch that route, no matter if source routing is configured. So I think this patch is correct and to some extent necessary. -- Stefano