summaryrefslogtreecommitdiff
path: root/net/ipv6
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2018-10-24 13:58:39 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-04 14:50:52 +0100
commit6a4aa53a94615ab4a8cf66b24e3780719378a059 (patch)
tree7e9c058780bfedeb8f2263bbc12ef143c8b44289 /net/ipv6
parent0024aeb00417eebdf08c51c3dea698f7f0e82452 (diff)
downloadlinux-rpi3-6a4aa53a94615ab4a8cf66b24e3780719378a059.tar.gz
linux-rpi3-6a4aa53a94615ab4a8cf66b24e3780719378a059.tar.bz2
linux-rpi3-6a4aa53a94615ab4a8cf66b24e3780719378a059.zip
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>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/route.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index abcb5ae77319..1cf00d857fc1 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2799,6 +2799,8 @@ static int ip6_route_check_nh_onlink(struct net *net,
grt = ip6_nh_lookup_table(net, cfg, gw_addr, tbid, 0);
if (grt) {
if (!grt->dst.error &&
+ /* ignore match if it is the default route */
+ grt->from && !ipv6_addr_any(&grt->from->fib6_dst.addr) &&
(grt->rt6i_flags & flags || dev != grt->dst.dev)) {
NL_SET_ERR_MSG(extack,
"Nexthop has invalid gateway or device mismatch");