提交 49d5b8ef 编写于 作者: D David Ahern 提交者: David S. Miller

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: NDavid Ahern <dsahern@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 c55c8988
......@@ -3899,7 +3899,25 @@ static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_bu
if (!res.f6i)
goto out;
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册