]> git.baikalelectronics.ru Git - kernel.git/commit
net: ipv4: Make "ip route get" match iif lo rules again.
authorLorenzo Colitti <lorenzo@google.com>
Thu, 11 Jan 2018 09:36:26 +0000 (18:36 +0900)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 Jan 2018 18:53:30 +0000 (13:53 -0500)
commit6ef94464712f03295d1ad295fc9415a02a0cb96b
tree7a806e0521b02ee9b82dd0debb708c7481954986
parent48c2d82dd9756b34ab339802167acb997de392e0
net: ipv4: Make "ip route get" match iif lo rules again.

Commit e8cd5dfc30c0 ("net: ipv4: Convert inet_rtm_getroute to rcu
versions of route lookup") broke "ip route get" in the presence
of rules that specify iif lo.

Host-originated traffic always has iif lo, because
ip_route_output_key_hash and ip6_route_output_flags set the flow
iif to LOOPBACK_IFINDEX. Thus, putting "iif lo" in an ip rule is a
convenient way to select only originated traffic and not forwarded
traffic.

inet_rtm_getroute used to match these rules correctly because
even though it sets the flow iif to 0, it called
ip_route_output_key which overwrites iif with LOOPBACK_IFINDEX.
But now that it calls ip_route_output_key_hash_rcu, the ifindex
will remain 0 and not match the iif lo in the rule. As a result,
"ip route get" will return ENETUNREACH.

Fixes: e8cd5dfc30c0 ("net: ipv4: Convert inet_rtm_getroute to rcu versions of route lookup")
Tested: https://android.googlesource.com/kernel/tests/+/master/net/test/multinetwork_test.py passes again
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Acked-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/route.c