Skip to content

Commit 58e354c

Browse files
dsaherndavem330
authored andcommitted
net/ipv6: Handle reject routes with onlink flag
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: fc1e64e ("net/ipv6: Add support for onlink flag") Signed-off-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c861ef8 commit 58e354c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/ipv6/route.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2488,7 +2488,8 @@ static int ip6_route_check_nh_onlink(struct net *net,
24882488
err = 0;
24892489
grt = ip6_nh_lookup_table(net, cfg, gw_addr, tbid, 0);
24902490
if (grt) {
2491-
if (grt->rt6i_flags & flags || dev != grt->dst.dev) {
2491+
if (!grt->dst.error &&
2492+
(grt->rt6i_flags & flags || dev != grt->dst.dev)) {
24922493
NL_SET_ERR_MSG(extack, "Nexthop has invalid gateway");
24932494
err = -EINVAL;
24942495
}

0 commit comments

Comments
 (0)