Commit 27188af5 authored by David S. Miller's avatar David S. Miller

Merge branch 'ipv6-fixes-for-RTF_CACHE-entries'

Paolo Abeni says:

====================
ipv6: fixes for RTF_CACHE entries

This series addresses 2 different but related issues with RTF_CACHE
introduced by the recent refactory.

patch 1 restore the gc timer for such routes
patch 2 removes the aged out dst from the fib tree, properly coping with pMTU
routes

v1 -> v2:
 - dropped the  for ip route show cache
 - avoid touching dst.obsolete when the dst is aged out

v2 -> v3:
 - take care of pMTU exceptions
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 7f9ad2ac 1859bac0
...@@ -1340,8 +1340,10 @@ static int rt6_insert_exception(struct rt6_info *nrt, ...@@ -1340,8 +1340,10 @@ static int rt6_insert_exception(struct rt6_info *nrt,
spin_unlock_bh(&rt6_exception_lock); spin_unlock_bh(&rt6_exception_lock);
/* Update fn->fn_sernum to invalidate all cached dst */ /* Update fn->fn_sernum to invalidate all cached dst */
if (!err) if (!err) {
fib6_update_sernum(ort); fib6_update_sernum(ort);
fib6_force_start_gc(net);
}
return err; return err;
} }
...@@ -1573,7 +1575,13 @@ static void rt6_age_examine_exception(struct rt6_exception_bucket *bucket, ...@@ -1573,7 +1575,13 @@ static void rt6_age_examine_exception(struct rt6_exception_bucket *bucket,
{ {
struct rt6_info *rt = rt6_ex->rt6i; struct rt6_info *rt = rt6_ex->rt6i;
if (atomic_read(&rt->dst.__refcnt) == 1 && /* we are pruning and obsoleting aged-out and non gateway exceptions
* even if others have still references to them, so that on next
* dst_check() such references can be dropped.
* EXPIRES exceptions - e.g. pmtu-generated ones are pruned when
* expired, independently from their aging, as per RFC 8201 section 4
*/
if (!(rt->rt6i_flags & RTF_EXPIRES) &&
time_after_eq(now, rt->dst.lastuse + gc_args->timeout)) { time_after_eq(now, rt->dst.lastuse + gc_args->timeout)) {
RT6_TRACE("aging clone %p\n", rt); RT6_TRACE("aging clone %p\n", rt);
rt6_remove_exception(bucket, rt6_ex); rt6_remove_exception(bucket, rt6_ex);
...@@ -1593,6 +1601,10 @@ static void rt6_age_examine_exception(struct rt6_exception_bucket *bucket, ...@@ -1593,6 +1601,10 @@ static void rt6_age_examine_exception(struct rt6_exception_bucket *bucket,
rt6_remove_exception(bucket, rt6_ex); rt6_remove_exception(bucket, rt6_ex);
return; return;
} }
} else if (__rt6_check_expired(rt)) {
RT6_TRACE("purging expired route %p\n", rt);
rt6_remove_exception(bucket, rt6_ex);
return;
} }
gc_args->more++; gc_args->more++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment