All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] route: update fnhe_expires for redirect when the fnhe exists
@ 2017-11-17  6:27 Xin Long
  2017-11-18  1:35 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Xin Long @ 2017-11-17  6:27 UTC (permalink / raw
  To: network dev; +Cc: davem, hannes, Paolo Abeni

Now when creating fnhe for redirect, it sets fnhe_expires for this
new route cache. But when updating the exist one, it doesn't do it.
It will cause this fnhe never to be expired.

Paolo already noticed it before, in Jianlin's test case, it became
even worse:

When ip route flush cache, the old fnhe is not to be removed, but
only clean it's members. When redirect comes again, this fnhe will
be found and updated, but never be expired due to fnhe_expires not
being set.

So fix it by simply updating fnhe_expires even it's for redirect.

Fixes: aee06da6726d ("ipv4: use seqlock for nh_exceptions")
Reported-by: Jianlin Shi <jishi@redhat.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/ipv4/route.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 3b42775..11cf2fe 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -678,10 +678,9 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
 	if (fnhe) {
 		if (gw)
 			fnhe->fnhe_gw = gw;
-		if (pmtu) {
+		if (pmtu)
 			fnhe->fnhe_pmtu = pmtu;
-			fnhe->fnhe_expires = max(1UL, expires);
-		}
+		fnhe->fnhe_expires = max(1UL, expires);
 		/* Update all cached dsts too */
 		rt = rcu_dereference(fnhe->fnhe_rth_input);
 		if (rt)
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] route: update fnhe_expires for redirect when the fnhe exists
  2017-11-17  6:27 [PATCH net] route: update fnhe_expires for redirect when the fnhe exists Xin Long
@ 2017-11-18  1:35 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-11-18  1:35 UTC (permalink / raw
  To: lucien.xin; +Cc: netdev, hannes, pabeni

From: Xin Long <lucien.xin@gmail.com>
Date: Fri, 17 Nov 2017 14:27:06 +0800

> Now when creating fnhe for redirect, it sets fnhe_expires for this
> new route cache. But when updating the exist one, it doesn't do it.
> It will cause this fnhe never to be expired.
> 
> Paolo already noticed it before, in Jianlin's test case, it became
> even worse:
> 
> When ip route flush cache, the old fnhe is not to be removed, but
> only clean it's members. When redirect comes again, this fnhe will
> be found and updated, but never be expired due to fnhe_expires not
> being set.
> 
> So fix it by simply updating fnhe_expires even it's for redirect.
> 
> Fixes: aee06da6726d ("ipv4: use seqlock for nh_exceptions")
> Reported-by: Jianlin Shi <jishi@redhat.com>
> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-18  1:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-17  6:27 [PATCH net] route: update fnhe_expires for redirect when the fnhe exists Xin Long
2017-11-18  1:35 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.