* [RFC(v2) net-next 09/13] ipv6: Do not depend on rt->n in rt6_check_neigh().
@ 2013-01-15 16:46 YOSHIFUJI Hideaki
2013-01-16 6:53 ` Cong Wang
0 siblings, 1 reply; 2+ messages in thread
From: YOSHIFUJI Hideaki @ 2013-01-15 16:46 UTC (permalink / raw)
To: netdev; +Cc: yoshfuji, xiyou.wangcong
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
net/ipv6/route.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index e16a483..ffdc8a6 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -552,20 +552,25 @@ static inline bool rt6_check_neigh(struct rt6_info *rt)
struct neighbour *neigh;
bool ret = false;
- neigh = rt->n;
if (rt->rt6i_flags & RTF_NONEXTHOP ||
- !(rt->rt6i_flags & RTF_GATEWAY))
+ !(rt->rt6i_flags & RTF_GATEWAY)) {
ret = true;
- else if (neigh) {
- read_lock_bh(&neigh->lock);
+ goto out;
+ }
+ rcu_read_lock_bh();
+ neigh = __ipv6_neigh_lookup_noref(rt->dst.dev, &rt->rt6i_gateway);
+ if (neigh) {
+ read_lock(&neigh->lock);
if (neigh->nud_state & NUD_VALID)
ret = true;
#ifdef CONFIG_IPV6_ROUTER_PREF
else if (!(neigh->nud_state & NUD_FAILED))
ret = true;
#endif
- read_unlock_bh(&neigh->lock);
+ read_unlock(&neigh->lock);
}
+ rcu_read_unlock_bh();
+out:
return ret;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC(v2) net-next 09/13] ipv6: Do not depend on rt->n in rt6_check_neigh().
2013-01-15 16:46 [RFC(v2) net-next 09/13] ipv6: Do not depend on rt->n in rt6_check_neigh() YOSHIFUJI Hideaki
@ 2013-01-16 6:53 ` Cong Wang
0 siblings, 0 replies; 2+ messages in thread
From: Cong Wang @ 2013-01-16 6:53 UTC (permalink / raw)
To: YOSHIFUJI Hideaki; +Cc: netdev
On 01/16/2013 12:46 AM, YOSHIFUJI Hideaki wrote:
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> ---
> net/ipv6/route.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index e16a483..ffdc8a6 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -552,20 +552,25 @@ static inline bool rt6_check_neigh(struct rt6_info *rt)
> struct neighbour *neigh;
> bool ret = false;
>
> - neigh = rt->n;
> if (rt->rt6i_flags & RTF_NONEXTHOP ||
> - !(rt->rt6i_flags & RTF_GATEWAY))
> + !(rt->rt6i_flags & RTF_GATEWAY)) {
> ret = true;
> - else if (neigh) {
> - read_lock_bh(&neigh->lock);
> + goto out;
> + }
Just return true here...
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-16 6:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-15 16:46 [RFC(v2) net-next 09/13] ipv6: Do not depend on rt->n in rt6_check_neigh() YOSHIFUJI Hideaki
2013-01-16 6:53 ` Cong Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).