]>
Commit | Line | Data |
---|---|---|
28cd9a8f GKH |
1 | From d0469d7ba38ac653c329264326f234440b1c8866 Mon Sep 17 00:00:00 2001 |
2 | From: Steffen Klassert <steffen.klassert@secunet.com> | |
3 | Date: Wed, 17 Oct 2012 21:17:44 +0000 | |
4 | Subject: ipv4: Fix flushing of cached routing informations | |
5 | ||
6 | ||
7 | From: Steffen Klassert <steffen.klassert@secunet.com> | |
8 | ||
9 | [ Upstream commit 13d82bf50dce632355fcccafa4fe44a9b5e706d8 ] | |
10 | ||
11 | Currently we can not flush cached pmtu/redirect informations via | |
12 | the ipv4_sysctl_rtcache_flush sysctl. We need to check the rt_genid | |
13 | of the old route and reset the nh exeption if the old route is | |
14 | expired when we bind a new route to a nh exeption. | |
15 | ||
16 | Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> | |
17 | Acked-by: Eric Dumazet <edumazet@google.com> | |
18 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
19 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
20 | --- | |
21 | net/ipv4/route.c | 9 ++++++--- | |
22 | 1 file changed, 6 insertions(+), 3 deletions(-) | |
23 | ||
24 | --- a/net/ipv4/route.c | |
25 | +++ b/net/ipv4/route.c | |
26 | @@ -1166,8 +1166,12 @@ static bool rt_bind_exception(struct rta | |
27 | spin_lock_bh(&fnhe_lock); | |
28 | ||
29 | if (daddr == fnhe->fnhe_daddr) { | |
30 | - struct rtable *orig; | |
31 | - | |
32 | + struct rtable *orig = rcu_dereference(fnhe->fnhe_rth); | |
33 | + if (orig && rt_is_expired(orig)) { | |
34 | + fnhe->fnhe_gw = 0; | |
35 | + fnhe->fnhe_pmtu = 0; | |
36 | + fnhe->fnhe_expires = 0; | |
37 | + } | |
38 | if (fnhe->fnhe_pmtu) { | |
39 | unsigned long expires = fnhe->fnhe_expires; | |
40 | unsigned long diff = expires - jiffies; | |
41 | @@ -1184,7 +1188,6 @@ static bool rt_bind_exception(struct rta | |
42 | } else if (!rt->rt_gateway) | |
43 | rt->rt_gateway = daddr; | |
44 | ||
45 | - orig = rcu_dereference(fnhe->fnhe_rth); | |
46 | rcu_assign_pointer(fnhe->fnhe_rth, rt); | |
47 | if (orig) | |
48 | rt_free(orig); |