]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
route: update fnhe_expires for redirect when the fnhe exists
authorXin Long <lucien.xin@gmail.com>
Fri, 17 Nov 2017 06:27:06 +0000 (14:27 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 13 Mar 2018 10:27:34 +0000 (11:27 +0100)
BugLink: http://bugs.launchpad.net/bugs/1745047
[ Upstream commit e39d5246111399dbc6e11cd39fd8580191b86c47 ]

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
net/ipv4/route.c

index 4bb678f9c9d75b856c787e728c9f3ad060eb860d..ebe23e5c3dfd02fc1a19df8ce1b09b3d05291f81 100644 (file)
@@ -675,10 +675,9 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
                        fnhe->fnhe_genid = genid;
                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)