提交 1ddef044 编写于 作者: Y YOSHIFUJI Hideaki 提交者: David S. Miller

[IPV6]: ROUTE: Clean up rt6_select() code path in ip6_route_{intput,output}().

Signed-off-by: NYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 118f8c16
...@@ -426,18 +426,12 @@ void ip6_route_input(struct sk_buff *skb) ...@@ -426,18 +426,12 @@ void ip6_route_input(struct sk_buff *skb)
restart: restart:
rt = fn->leaf; rt = fn->leaf;
if ((rt->rt6i_flags & RTF_CACHE)) {
rt = rt6_select(&fn->leaf, skb->dev->ifindex, strict | RT6_SELECT_F_REACHABLE);
if (rt == &ip6_null_entry)
rt = rt6_select(&fn->leaf, skb->dev->ifindex, strict);
BACKTRACK();
goto out;
}
rt = rt6_select(&fn->leaf, skb->dev->ifindex, strict | RT6_SELECT_F_REACHABLE); rt = rt6_select(&fn->leaf, skb->dev->ifindex, strict | RT6_SELECT_F_REACHABLE);
if (rt == &ip6_null_entry) if (rt == &ip6_null_entry)
rt = rt6_select(&fn->leaf, skb->dev->ifindex, strict); rt = rt6_select(&fn->leaf, skb->dev->ifindex, strict);
BACKTRACK(); BACKTRACK();
if ((rt->rt6i_flags & RTF_CACHE))
goto out;
dst_hold(&rt->u.dst); dst_hold(&rt->u.dst);
read_unlock_bh(&rt6_lock); read_unlock_bh(&rt6_lock);
...@@ -498,25 +492,12 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl) ...@@ -498,25 +492,12 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl)
fn = fib6_lookup(&ip6_routing_table, &fl->fl6_dst, &fl->fl6_src); fn = fib6_lookup(&ip6_routing_table, &fl->fl6_dst, &fl->fl6_src);
restart: restart:
rt = fn->leaf; rt = rt6_select(&fn->leaf, fl->oif, strict | RT6_SELECT_F_REACHABLE);
if (rt == &ip6_null_entry)
if ((rt->rt6i_flags & RTF_CACHE)) { rt = rt6_select(&fn->leaf, fl->oif, strict);
rt = rt6_select(&fn->leaf, fl->oif, strict | RT6_SELECT_F_REACHABLE); BACKTRACK();
if (rt == &ip6_null_entry) if ((rt->rt6i_flags & RTF_CACHE))
rt = rt6_select(&fn->leaf, fl->oif, strict);
BACKTRACK();
goto out; goto out;
}
if (rt->rt6i_flags & RTF_DEFAULT) {
rt = rt6_select(&fn->leaf, fl->oif, strict | RT6_SELECT_F_REACHABLE);
if (rt == &ip6_null_entry)
rt = rt6_select(&fn->leaf, fl->oif, strict);
} else {
rt = rt6_select(&fn->leaf, fl->oif, strict | RT6_SELECT_F_REACHABLE);
if (rt == &ip6_null_entry)
rt = rt6_select(&fn->leaf, fl->oif, strict);
BACKTRACK();
}
dst_hold(&rt->u.dst); dst_hold(&rt->u.dst);
read_unlock_bh(&rt6_lock); read_unlock_bh(&rt6_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册