[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 20 Oct 2011 14:24:33 +0800
From: Gao feng <gaofeng@...fujitsu.com>
To: Steffen Klassert <steffen.klassert@...unet.com>
CC: David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH 3/4] ipv4: Fix inetpeer expiration handling
2011.10.11 19:11, Steffen Klassert wrote:
> We leak a trigger to check if the learned pmtu information has
> expired, so the learned pmtu informations never expire. This patch
> add such a trigger to ipv4_dst_check().
>
> Signed-off-by: Steffen Klassert <steffen.klassert@...unet.com>
> ---
> net/ipv4/route.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 9a6623e..cda370c 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -1660,6 +1660,10 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie)
>
> if (rt_is_expired(rt))
> return NULL;
> +
> + if (rt->peer && peer_pmtu_expired(rt->peer))
> + dst_metric_set(dst, RTAX_MTU, rt->peer->pmtu_orig);
> +
> if (rt->rt_peer_genid != rt_peer_genid()) {
> struct inet_peer *peer;
>
there are serval problem.
1:rt->peer maybe null,we should call rt_bind_peer just like the code below.
2:rt->peer_pmtu_orig is null. if we hasn't send packet before,the func check_peer_pmtu hasn't be called.
so the peer->pmtu_orig is null.
3:when rt->rt_peer_genid != rt_peer_genid(), we has no need to do dst_metric_set(dst, RTAX_MTU, rt->peer->pmtu_orig),
because check_peer_pmtu will do this.
what about this patch?
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 04a14db..45782d2 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1655,17 +1655,17 @@ static int check_peer_redir(struct dst_entry *dst, struct inet_peer *peer)
static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie)
{
struct rtable *rt = (struct rtable *) dst;
+ struct inet_peer *peer;
if (rt_is_expired(rt))
return NULL;
- if (rt->rt_peer_genid != rt_peer_genid()) {
- struct inet_peer *peer;
- if (!rt->peer)
- rt_bind_peer(rt, rt->rt_dst, 0);
+ if (!rt->peer)
+ rt_bind_peer(rt, rt->rt_dst, 0);
- peer = rt->peer;
- if (peer) {
+ peer = rt->peer;
+ if (peer) {
+ if (rt->rt_peer_genid != rt_peer_genid()) {
check_peer_pmtu(dst, peer);
if (peer->redirect_learned.a4 &&
@@ -1673,9 +1673,12 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie)
if (check_peer_redir(dst, peer))
return NULL;
}
- }
- rt->rt_peer_genid = rt_peer_genid();
+ rt->rt_peer_genid = rt_peer_genid();
+
+ }else if(peer_pmtu_expired(peer))
+ dst_metric_set(dst,RTAX_MTU,peer->pmtu_orig);
+
}
return dst;
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists