Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Gao feng <gaofeng@cn.fujitsu.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH] ipv6: Fix problem with expired dst cache
Date: Fri, 24 Feb 2012 07:51:08 +0100	[thread overview]
Message-ID: <1330066268.15610.48.camel@edumazet-laptop> (raw)
In-Reply-To: <1330064404-24763-1-git-send-email-gaofeng@cn.fujitsu.com>

Le vendredi 24 février 2012 à 14:20 +0800, Gao feng a écrit :
> if the ipv6 dst cache copy from the dst witch generated by ICMPV6 RA packet.
> this dst cache will not be checked expire because it has no RTF_EXPIRES flag
> So this dst cache always be used until the dst gc run.
> 
> add a pointer in struct rt6_info,point to where the dst cache copy from.
> in func rt6_check_expired check if rt6->info->rt6i_copy is expired.
> 

Sorry, I really dont understand what you are saying.

Also, adding a pointer to a structure without holding a reference on it
is suspicious.

> Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
> ---
>  include/net/ip6_fib.h |    1 +
>  net/ipv6/route.c      |   16 ++++++++++++++--
>  2 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
> index b26bb81..3da4d58c 100644
> --- a/include/net/ip6_fib.h
> +++ b/include/net/ip6_fib.h
> @@ -106,6 +106,7 @@ struct rt6_info {
>  	u32				rt6i_metric;
>  	u32				rt6i_peer_genid;
>  
> +	struct rt6_info			*rt6i_copy;
>  	struct inet6_dev		*rt6i_idev;
>  	struct inet_peer		*rt6i_peer;
>  
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 8c2e3ab..939d06a 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -316,8 +316,15 @@ static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
>  
>  static __inline__ int rt6_check_expired(const struct rt6_info *rt)
>  {
> -	return (rt->rt6i_flags & RTF_EXPIRES) &&
> -		time_after(jiffies, rt->dst.expires);
> +	if ((rt->rt6i_flags & RTF_EXPIRES) &&
> +		time_after(jiffies, rt->dst.expires))
> +		return 1;
> +
> +	if (rt->rt6i_copy && (rt->rt6i_copy->rt6i_flags & RTF_EXPIRES) &&
> +		time_after(jiffies, rt->rt6i_copy->dst.expires))
> +		return 1;
> +
> +	return 0;
>  }
>  
>  static inline int rt6_need_strict(const struct in6_addr *daddr)
> @@ -1804,6 +1811,11 @@ static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort,
>  		rt->rt6i_gateway = ort->rt6i_gateway;
>  		rt->rt6i_flags = ort->rt6i_flags & ~RTF_EXPIRES;
>  		rt->rt6i_metric = 0;
> +
> +		if (ort->rt6i_copy)
> +			rt->rt6i_copy = ort->rt6i_copy;
> +		else
> +			rt->rt6i_copy = ort;
>  
>  #ifdef CONFIG_IPV6_SUBTREES
>  		memcpy(&rt->rt6i_src, &ort->rt6i_src, sizeof(struct rt6key));

  parent reply	other threads:[~2012-02-24  6:51 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-24  6:20 [PATCH] ipv6: Fix problem with expired dst cache Gao feng
2012-02-24  6:47 ` David Miller
2012-02-24  7:10   ` Gao feng
2012-02-24  9:27   ` Gao feng
2012-02-24  6:51 ` Eric Dumazet [this message]
2012-02-24  7:21   ` Gao feng
2012-02-27  6:36 ` [PATCH V2] " Gao feng
2012-02-29  9:26   ` Gao feng
2012-02-29  9:45     ` [PATCH] " Gao feng
2012-02-29  9:52       ` Gao feng
2012-02-29 10:07     ` [PATCH v3] " Gao feng
2012-02-29 12:14       ` Eric Dumazet
2012-03-01  0:43         ` Gao feng
2012-03-05  3:53 ` [PATCH v4] " Gao feng
2012-03-05  5:05   ` David Miller
2012-03-05  7:10     ` Gao feng
2012-03-05  7:16 ` [PATCH v5] " Gao feng
2012-03-06  7:01   ` RongQing Li
2012-03-06  7:10     ` RongQing Li
2012-03-17  5:33   ` David Miller
2012-03-19  0:49     ` Gao feng
2012-03-22  2:47       ` David Miller
2012-04-06 10:13 ` [PATCH v6] ipv6: fix " Gao feng
2012-04-13 16:58   ` David Miller
2012-04-16 13:34     ` [PATCH] ipv6: fix rt6_update_expires Jiri Bohac
2012-04-18  2:24       ` Gao feng
2012-04-18  2:32         ` David Miller
2012-04-16 13:35     ` [PATCH] ipv6: clean up rt6_clean_expires Jiri Bohac
2012-04-18  2:32       ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330066268.15610.48.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=gaofeng@cn.fujitsu.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox