Skip to content

Commit

Permalink
[IPV6]: ROUTE: Clean up rt6_select() code path in ip6_route_{intput,o…
Browse files Browse the repository at this point in the history
…utput}().

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
YOSHIFUJI Hideaki authored and David S. Miller committed Mar 21, 2006
1 parent 118f8c1 commit 1ddef04
Showing 1 changed file with 7 additions and 26 deletions.
33 changes: 7 additions & 26 deletions net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,18 +426,12 @@ void ip6_route_input(struct sk_buff *skb)
restart:
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);
if (rt == &ip6_null_entry)
rt = rt6_select(&fn->leaf, skb->dev->ifindex, strict);
BACKTRACK();
if ((rt->rt6i_flags & RTF_CACHE))
goto out;

dst_hold(&rt->u.dst);
read_unlock_bh(&rt6_lock);
Expand Down Expand Up @@ -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);

restart:
rt = fn->leaf;

if ((rt->rt6i_flags & RTF_CACHE)) {
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();
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();
if ((rt->rt6i_flags & RTF_CACHE))
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);
read_unlock_bh(&rt6_lock);
Expand Down

0 comments on commit 1ddef04

Please sign in to comment.