]> git.hungrycats.org Git - linux/commit
net/ipv6: Allow onlink routes to have a device mismatch if it is the default route
authorDavid Ahern <dsahern@gmail.com>
Wed, 24 Oct 2018 20:58:39 +0000 (13:58 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Nov 2018 13:51:54 +0000 (14:51 +0100)
commit81e31abfa81d288baddd8045648d97ae72e6f42d
treee78501eccf63107b07554737ea11952152ec26d1
parentc5038b492cb1656d61a2983adbe794af7c3a4389
net/ipv6: Allow onlink routes to have a device mismatch if it is the default route

[ Upstream commit 4ed591c8ab44e711e56b8e021ffaf4f407c045f5 ]

The intent of ip6_route_check_nh_onlink is to make sure the gateway
given for an onlink route is not actually on a connected route for
a different interface (e.g., 2001:db8:1::/64 is on dev eth1 and then
an onlink route has a via 2001:db8:1::1 dev eth2). If the gateway
lookup hits the default route then it most likely will be a different
interface than the onlink route which is ok.

Update ip6_route_check_nh_onlink to disregard the device mismatch
if the gateway lookup hits the default route. Turns out the existing
onlink tests are passing because there is no default route or it is
an unreachable default, so update the onlink tests to have a default
route other than unreachable.

Fixes: fc1e64e1092f6 ("net/ipv6: Add support for onlink flag")
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv6/route.c
tools/testing/selftests/net/fib-onlink-tests.sh