aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorWei Wang <weiwan@google.com>2018-01-26 14:40:17 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-29 14:22:05 -0500
commit31afeb425f7fad8bcf9561aeb0b8405479f97a98 (patch)
tree08c7751b1ab6d54456473683a01af5471867a0c0 /net
parent0a797db323a6f74da3f43d5460792989da6617f4 (diff)
ipv6: change route cache aging logic
In current route cache aging logic, if a route has both RTF_EXPIRE and RTF_GATEWAY set, the route will only be removed if the neighbor cache has no NTF_ROUTER flag. Otherwise, even if the route has expired, it won't get deleted. Fix this logic to always check if the route has expired first and then do the gateway neighbor cache check if previous check decide to not remove the exception entry. Fixes: 1859bac04fb6 ("ipv6: remove from fib tree aged out RTF_CACHE dst") Signed-off-by: Wei Wang <weiwan@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/route.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index fe3966a9c999..fb2d251c0500 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1585,12 +1585,19 @@ static void rt6_age_examine_exception(struct rt6_exception_bucket *bucket,
1585 * EXPIRES exceptions - e.g. pmtu-generated ones are pruned when 1585 * EXPIRES exceptions - e.g. pmtu-generated ones are pruned when
1586 * expired, independently from their aging, as per RFC 8201 section 4 1586 * expired, independently from their aging, as per RFC 8201 section 4
1587 */ 1587 */
1588 if (!(rt->rt6i_flags & RTF_EXPIRES) && 1588 if (!(rt->rt6i_flags & RTF_EXPIRES)) {
1589 time_after_eq(now, rt->dst.lastuse + gc_args->timeout)) { 1589 if (time_after_eq(now, rt->dst.lastuse + gc_args->timeout)) {
1590 RT6_TRACE("aging clone %p\n", rt); 1590 RT6_TRACE("aging clone %p\n", rt);
1591 rt6_remove_exception(bucket, rt6_ex);
1592 return;
1593 }
1594 } else if (time_after(jiffies, rt->dst.expires)) {
1595 RT6_TRACE("purging expired route %p\n", rt);
1591 rt6_remove_exception(bucket, rt6_ex); 1596 rt6_remove_exception(bucket, rt6_ex);
1592 return; 1597 return;
1593 } else if (rt->rt6i_flags & RTF_GATEWAY) { 1598 }
1599
1600 if (rt->rt6i_flags & RTF_GATEWAY) {
1594 struct neighbour *neigh; 1601 struct neighbour *neigh;
1595 __u8 neigh_flags = 0; 1602 __u8 neigh_flags = 0;
1596 1603
@@ -1605,11 +1612,8 @@ static void rt6_age_examine_exception(struct rt6_exception_bucket *bucket,
1605 rt6_remove_exception(bucket, rt6_ex); 1612 rt6_remove_exception(bucket, rt6_ex);
1606 return; 1613 return;
1607 } 1614 }
1608 } else if (__rt6_check_expired(rt)) {
1609 RT6_TRACE("purging expired route %p\n", rt);
1610 rt6_remove_exception(bucket, rt6_ex);
1611 return;
1612 } 1615 }
1616
1613 gc_args->more++; 1617 gc_args->more++;
1614} 1618}
1615 1619