Commit 8238dd06 authored by YOSHIFUJI Hideaki's avatar YOSHIFUJI Hideaki Committed by David S. Miller

[IPV6]: ROUTE: Handle finding the next best route in reachability in BACKTRACK().

Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bb133964
...@@ -414,23 +414,22 @@ void ip6_route_input(struct sk_buff *skb) ...@@ -414,23 +414,22 @@ void ip6_route_input(struct sk_buff *skb)
int strict; int strict;
int attempts = 3; int attempts = 3;
int err; int err;
int reachable = RT6_SELECT_F_REACHABLE;
strict = ipv6_addr_type(&skb->nh.ipv6h->daddr) & (IPV6_ADDR_MULTICAST|IPV6_ADDR_LINKLOCAL) ? RT6_SELECT_F_IFACE : 0; strict = ipv6_addr_type(&skb->nh.ipv6h->daddr) & (IPV6_ADDR_MULTICAST|IPV6_ADDR_LINKLOCAL) ? RT6_SELECT_F_IFACE : 0;
relookup: relookup:
read_lock_bh(&rt6_lock); read_lock_bh(&rt6_lock);
restart_2:
fn = fib6_lookup(&ip6_routing_table, &skb->nh.ipv6h->daddr, fn = fib6_lookup(&ip6_routing_table, &skb->nh.ipv6h->daddr,
&skb->nh.ipv6h->saddr); &skb->nh.ipv6h->saddr);
restart: restart:
rt = fn->leaf; rt = rt6_select(&fn->leaf, skb->dev->ifindex, strict | reachable);
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(); BACKTRACK();
if ((rt->rt6i_flags & RTF_CACHE)) if (rt == &ip6_null_entry ||
rt->rt6i_flags & RTF_CACHE)
goto out; goto out;
dst_hold(&rt->u.dst); dst_hold(&rt->u.dst);
...@@ -467,6 +466,10 @@ void ip6_route_input(struct sk_buff *skb) ...@@ -467,6 +466,10 @@ void ip6_route_input(struct sk_buff *skb)
goto relookup; goto relookup;
out: out:
if (reachable) {
reachable = 0;
goto restart_2;
}
dst_hold(&rt->u.dst); dst_hold(&rt->u.dst);
read_unlock_bh(&rt6_lock); read_unlock_bh(&rt6_lock);
out2: out2:
...@@ -483,20 +486,21 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl) ...@@ -483,20 +486,21 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl)
int strict; int strict;
int attempts = 3; int attempts = 3;
int err; int err;
int reachable = RT6_SELECT_F_REACHABLE;
strict = ipv6_addr_type(&fl->fl6_dst) & (IPV6_ADDR_MULTICAST|IPV6_ADDR_LINKLOCAL) ? RT6_SELECT_F_IFACE : 0; strict = ipv6_addr_type(&fl->fl6_dst) & (IPV6_ADDR_MULTICAST|IPV6_ADDR_LINKLOCAL) ? RT6_SELECT_F_IFACE : 0;
relookup: relookup:
read_lock_bh(&rt6_lock); read_lock_bh(&rt6_lock);
restart_2:
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 = rt6_select(&fn->leaf, fl->oif, strict | RT6_SELECT_F_REACHABLE); rt = rt6_select(&fn->leaf, fl->oif, strict | reachable);
if (rt == &ip6_null_entry)
rt = rt6_select(&fn->leaf, fl->oif, strict);
BACKTRACK(); BACKTRACK();
if ((rt->rt6i_flags & RTF_CACHE)) if (rt == &ip6_null_entry ||
rt->rt6i_flags & RTF_CACHE)
goto out; goto out;
dst_hold(&rt->u.dst); dst_hold(&rt->u.dst);
...@@ -533,6 +537,10 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl) ...@@ -533,6 +537,10 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl)
goto relookup; goto relookup;
out: out:
if (reachable) {
reachable = 0;
goto restart_2;
}
dst_hold(&rt->u.dst); dst_hold(&rt->u.dst);
read_unlock_bh(&rt6_lock); read_unlock_bh(&rt6_lock);
out2: out2:
......
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