]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
net/ipv6: Handle reject routes with onlink flag
authorDavid Ahern <dsahern@gmail.com>
Tue, 6 Feb 2018 20:14:12 +0000 (12:14 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 8 Feb 2018 02:52:06 +0000 (21:52 -0500)
Verification of nexthops with onlink flag need to handle unreachable
routes. The lookup is only intended to validate the gateway address
is not a local address and if the gateway resolves the egress device
must match the given device. Hence, hitting any default reject route
is ok.

Fixes: fc1e64e1092f ("net/ipv6: Add support for onlink flag")
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/route.c

index fb2d251c0500349dec7803cf1f084edf874f3035..69c43d289c69913f663edc0fa4fadd050bd7b909 100644 (file)
@@ -2488,7 +2488,8 @@ static int ip6_route_check_nh_onlink(struct net *net,
        err = 0;
        grt = ip6_nh_lookup_table(net, cfg, gw_addr, tbid, 0);
        if (grt) {
-               if (grt->rt6i_flags & flags || dev != grt->dst.dev) {
+               if (!grt->dst.error &&
+                   (grt->rt6i_flags & flags || dev != grt->dst.dev)) {
                        NL_SET_ERR_MSG(extack, "Nexthop has invalid gateway");
                        err = -EINVAL;
                }