Commit b0a1ba59 authored by Martin KaFai Lau's avatar Martin KaFai Lau Committed by 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: default avatarMartin KaFai Lau <kafai@fb.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 24df8986
......@@ -1242,12 +1242,16 @@ static struct rt6_info *__ip6_route_redirect(struct net *net,
rt = net->ipv6.ip6_null_entry;
else if (rt->dst.error) {
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);
if (fn)
goto restart;
}
out:
dst_hold(&rt->dst);
read_unlock_bh(&table->tb6_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment