提交 b0a1ba59 编写于 作者: M Martin KaFai Lau 提交者: David S. Miller

ipv6: Fix __ip6_route_redirect

In my last commit (a3c00e46: ipv6: Remove BACKTRACK macro), the changes in
__ip6_route_redirect is incorrect.  The following case is missed:
1. The for loop tries to find a valid gateway rt. If it fails to find
   one, rt will be NULL.
2. When rt is NULL, it is set to the ip6_null_entry.
3. The newly added 'else if', from a3c00e46, will stop the backtrack from
   happening.
Signed-off-by: NMartin KaFai Lau <kafai@fb.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 24df8986
...@@ -1242,12 +1242,16 @@ static struct rt6_info *__ip6_route_redirect(struct net *net, ...@@ -1242,12 +1242,16 @@ static struct rt6_info *__ip6_route_redirect(struct net *net,
rt = net->ipv6.ip6_null_entry; rt = net->ipv6.ip6_null_entry;
else if (rt->dst.error) { else if (rt->dst.error) {
rt = net->ipv6.ip6_null_entry; rt = net->ipv6.ip6_null_entry;
} else if (rt == net->ipv6.ip6_null_entry) { goto out;
}
if (rt == net->ipv6.ip6_null_entry) {
fn = fib6_backtrack(fn, &fl6->saddr); fn = fib6_backtrack(fn, &fl6->saddr);
if (fn) if (fn)
goto restart; goto restart;
} }
out:
dst_hold(&rt->dst); dst_hold(&rt->dst);
read_unlock_bh(&table->tb6_lock); read_unlock_bh(&table->tb6_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册