diff options
author | Steffen Klassert <steffen.klassert@secunet.com> | 2012-10-17 21:17:44 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-17 13:18:52 -0800 |
commit | 400b8b8c0bc217c72caef1b980f218a0e3662a9a (patch) | |
tree | f00116d0e3a94d2b8d0474f03aeaf1e7b2e4aa62 /net | |
parent | f1d2d8a9f14c93996ebeb28e1da98b4eb025f88b (diff) |
ipv4: Fix flushing of cached routing informations
[ Upstream commit 13d82bf50dce632355fcccafa4fe44a9b5e706d8 ]
Currently we can not flush cached pmtu/redirect informations via
the ipv4_sysctl_rtcache_flush sysctl. We need to check the rt_genid
of the old route and reset the nh exeption if the old route is
expired when we bind a new route to a nh exeption.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/route.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 2a1383c10fb..c017cb1634e 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1166,8 +1166,12 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe, spin_lock_bh(&fnhe_lock); if (daddr == fnhe->fnhe_daddr) { - struct rtable *orig; - + struct rtable *orig = rcu_dereference(fnhe->fnhe_rth); + if (orig && rt_is_expired(orig)) { + fnhe->fnhe_gw = 0; + fnhe->fnhe_pmtu = 0; + fnhe->fnhe_expires = 0; + } if (fnhe->fnhe_pmtu) { unsigned long expires = fnhe->fnhe_expires; unsigned long diff = expires - jiffies; @@ -1184,7 +1188,6 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe, } else if (!rt->rt_gateway) rt->rt_gateway = daddr; - orig = rcu_dereference(fnhe->fnhe_rth); rcu_assign_pointer(fnhe->fnhe_rth, rt); if (orig) rt_free(orig); |