aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-10-21 01:39:11 +0100
committerDavid S. Miller <davem@davemloft.net>2017-10-21 01:39:11 +0100
commit27188af5ab2f11dd6a4b548940db6464c8fcfe28 (patch)
tree50297ab528d0e1eacc1ec9f34f1698500327c263
parentMerge branch 'bpf-lsm-hooks' (diff)
parentipv6: remove from fib tree aged out RTF_CACHE dst (diff)
downloadlinux-dev-27188af5ab2f11dd6a4b548940db6464c8fcfe28.tar.xz
linux-dev-27188af5ab2f11dd6a4b548940db6464c8fcfe28.zip
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: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/route.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 2e8842fa6450..074fac966018 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1340,8 +1340,10 @@ out:
spin_unlock_bh(&rt6_exception_lock);
/* Update fn->fn_sernum to invalidate all cached dst */
- if (!err)
+ if (!err) {
fib6_update_sernum(ort);
+ fib6_force_start_gc(net);
+ }
return err;
}
@@ -1573,7 +1575,13 @@ static void rt6_age_examine_exception(struct rt6_exception_bucket *bucket,
{
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)) {
RT6_TRACE("aging clone %p\n", rt);
rt6_remove_exception(bucket, rt6_ex);
@@ -1593,6 +1601,10 @@ static void rt6_age_examine_exception(struct rt6_exception_bucket *bucket,
rt6_remove_exception(bucket, rt6_ex);
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++;
}