summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2026-03-24 02:59:36 +0300
committerJakub Kicinski <kuba@kernel.org>2026-03-24 02:59:36 +0300
commitb1791180a2710830bf909e1eadf2c3d362e7ce63 (patch)
treec28115df0e34fcf131bb5d18f131f0725e707960 /include
parentbc0151c59e639c1311ee573434af74b4e2c81de4 (diff)
parent3e9e84e92c9c2eec396ee62a2e47b85781520c57 (diff)
downloadlinux-b1791180a2710830bf909e1eadf2c3d362e7ce63.tar.xz
Merge branch 'ipv6-fix-two-gc-issues-with-permanent-routes'
Kuniyuki Iwashima says: ==================== ipv6: Fix two GC issues with permanent routes. Patch 1 fixes the unbounded growth of tb6_gc_hlist due to permanent routes whose exception routes have all expired. Patch 2 fixes an issue where exception routes tied to permanent routes are not properly aged. Patch 3 is a selftest for the issue fixed by Patch 2. ==================== Link: https://patch.msgid.link/20260320072317.2561779-1-kuniyu@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/ip6_fib.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 88b0dd4d8e09..9f8b6814a96a 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -507,12 +507,14 @@ void fib6_rt_update(struct net *net, struct fib6_info *rt,
void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info,
unsigned int flags);
+void fib6_age_exceptions(struct fib6_info *rt, struct fib6_gc_args *gc_args,
+ unsigned long now);
void fib6_run_gc(unsigned long expires, struct net *net, bool force);
-
void fib6_gc_cleanup(void);
int fib6_init(void);
+#if IS_ENABLED(CONFIG_IPV6)
/* Add the route to the gc list if it is not already there
*
* The callers should hold f6i->fib6_table->tb6_lock.
@@ -545,6 +547,23 @@ static inline void fib6_remove_gc_list(struct fib6_info *f6i)
hlist_del_init(&f6i->gc_link);
}
+static inline void fib6_may_remove_gc_list(struct net *net,
+ struct fib6_info *f6i)
+{
+ struct fib6_gc_args gc_args;
+
+ if (hlist_unhashed(&f6i->gc_link))
+ return;
+
+ gc_args.timeout = READ_ONCE(net->ipv6.sysctl.ip6_rt_gc_interval);
+ gc_args.more = 0;
+
+ rcu_read_lock();
+ fib6_age_exceptions(f6i, &gc_args, jiffies);
+ rcu_read_unlock();
+}
+#endif
+
struct ipv6_route_iter {
struct seq_net_private p;
struct fib6_walker w;