diff options
author | David Ahern <dsahern@gmail.com> | 2019-06-08 14:53:30 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-06-10 10:44:56 -0700 |
commit | 49d5b8ef20d091d71a7fe019d71d0b2dd73a5b99 (patch) | |
tree | 7912ec1db8d5ae98fd395ff20a24db7d7e55d499 /net/ipv6 | |
parent | c55c89884d3d0686aa8b6ec7525c2561383e9490 (diff) | |
download | linux-49d5b8ef20d091d71a7fe019d71d0b2dd73a5b99.tar.bz2 |
ipv6: Handle all fib6_nh in a nexthop in rt6_do_redirect
Use nexthop_for_each_fib6_nh and fib6_nh_find_match to find the
fib6_nh in a nexthop that correlates to the device and gateway
in the rt6_info.
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/route.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 06498f6fa606..715356e00f58 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -3899,7 +3899,25 @@ static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_bu if (!res.f6i) goto out; - res.nh = res.f6i->fib6_nh; + if (res.f6i->nh) { + struct fib6_nh_match_arg arg = { + .dev = dst->dev, + .gw = &rt->rt6i_gateway, + }; + + nexthop_for_each_fib6_nh(res.f6i->nh, + fib6_nh_find_match, &arg); + + /* fib6_info uses a nexthop that does not have fib6_nh + * using the dst->dev. Should be impossible + */ + if (!arg.match) + goto out; + res.nh = arg.match; + } else { + res.nh = res.f6i->fib6_nh; + } + res.fib6_flags = res.f6i->fib6_flags; res.fib6_type = res.f6i->fib6_type; nrt = ip6_rt_cache_alloc(&res, &msg->dest, NULL); |