From: Yuyang Huang <sigefriedhyy@gmail.com>
To: Yuyang Huang <sigefriedhyy@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Bobby Eshleman <bobbyeshleman@meta.com>,
Chris J Arges <carges@cloudflare.com>,
Daniel Zahka <daniel.zahka@gmail.com>,
David Ahern <dsahern@kernel.org>, David Wei <dw@davidwei.uk>,
Dimitri Daskalakis <dimitri.daskalakis1@gmail.com>,
Donald Hunter <donald.hunter@gmail.com>,
Eric Dumazet <edumazet@google.com>, Gal Pressman <gal@nvidia.com>,
Ido Schimmel <idosch@nvidia.com>,
Jakub Kicinski <kuba@kernel.org>, Nimrod Oren <noren@nvidia.com>,
Paolo Abeni <pabeni@redhat.com>, Shuah Khan <shuah@kernel.org>,
Simon Horman <horms@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>,
Willem de Bruijn <willemb@google.com>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
netdev@vger.kernel.org
Subject: [PATCH net-next v5 02/10] ipv6: propagate the route deletion reason to fib6_del_route()
Date: Tue, 4 Aug 2026 10:47:06 +0900 [thread overview]
Message-ID: <20260804014714.4362-3-sigefriedhyy@gmail.com> (raw)
In-Reply-To: <20260804014714.4362-1-sigefriedhyy@gmail.com>
Pass the deletion reason from ip6_del_rt_reason() down through
__ip6_del_rt(), fib6_del() and into fib6_del_route(). All existing
callers pass RT_DEL_REASON_UNSPEC.
fib6_del_route() ignores the reason until the notification path learns
to report it.
Signed-off-by: Yuyang Huang <sigefriedhyy@gmail.com>
---
include/net/ip6_fib.h | 3 ++-
net/ipv6/ip6_fib.c | 12 +++++++-----
net/ipv6/route.c | 19 +++++++++++--------
3 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 9cd27e1b9b69..0ba5d3c56543 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -468,7 +468,8 @@ void fib6_clean_all_skip_notify(struct net *net,
int fib6_add(struct fib6_node *root, struct fib6_info *rt,
struct nl_info *info, struct netlink_ext_ack *extack);
-int fib6_del(struct fib6_info *rt, struct nl_info *info);
+int fib6_del(struct fib6_info *rt, struct nl_info *info,
+ enum rt_del_reason del_reason);
static inline
void rt6_get_prefsrc(const struct rt6_info *rt, struct in6_addr *addr)
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index e9fc692d4f3b..1f6f6f33ded1 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1967,7 +1967,8 @@ static struct fib6_node *fib6_repair_tree(struct net *net,
}
static void fib6_del_route(struct fib6_table *table, struct fib6_node *fn,
- struct fib6_info __rcu **rtp, struct nl_info *info)
+ struct fib6_info __rcu **rtp, struct nl_info *info,
+ enum rt_del_reason del_reason)
{
struct fib6_info *leaf, *replace_rt = NULL;
struct fib6_walker *w;
@@ -2062,7 +2063,8 @@ static void fib6_del_route(struct fib6_table *table, struct fib6_node *fn,
}
/* Need to own table->tb6_lock */
-int fib6_del(struct fib6_info *rt, struct nl_info *info)
+int fib6_del(struct fib6_info *rt, struct nl_info *info,
+ enum rt_del_reason del_reason)
{
struct net *net = info->nl_net;
struct fib6_info __rcu **rtp;
@@ -2091,7 +2093,7 @@ int fib6_del(struct fib6_info *rt, struct nl_info *info)
if (rt == cur) {
if (fib6_requires_src(cur))
fib6_routes_require_src_dec(info->nl_net);
- fib6_del_route(table, fn, rtp, info);
+ fib6_del_route(table, fn, rtp, info, del_reason);
return 0;
}
rtp_next = &cur->fib6_next;
@@ -2253,7 +2255,7 @@ static int fib6_clean_node(struct fib6_walker *w)
res = c->func(rt, c->arg);
if (res == -1) {
w->leaf = rt;
- res = fib6_del(rt, &info);
+ res = fib6_del(rt, &info, RT_DEL_REASON_UNSPEC);
if (res) {
#if RT6_DEBUG >= 2
pr_debug("%s: del failed: rt=%p@%p err=%d\n",
@@ -2401,7 +2403,7 @@ static void fib6_gc_table(struct net *net,
hlist_for_each_entry_safe(rt, n, &tb6->tb6_gc_hlist, gc_link)
if (fib6_age(rt, gc_args) == -1)
- fib6_del(rt, &info);
+ fib6_del(rt, &info, RT_DEL_REASON_UNSPEC);
}
static void fib6_gc_all(struct net *net, struct fib6_gc_args *gc_args)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index ca374b056f5a..252f1825a199 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3973,7 +3973,8 @@ int ip6_route_add(struct fib6_config *cfg, gfp_t gfp_flags,
return err;
}
-static int __ip6_del_rt(struct fib6_info *rt, struct nl_info *info)
+static int __ip6_del_rt(struct fib6_info *rt, struct nl_info *info,
+ enum rt_del_reason del_reason)
{
struct net *net = info->nl_net;
struct fib6_table *table;
@@ -3986,7 +3987,7 @@ static int __ip6_del_rt(struct fib6_info *rt, struct nl_info *info)
table = rt->fib6_table;
spin_lock_bh(&table->tb6_lock);
- err = fib6_del(rt, info);
+ err = fib6_del(rt, info, del_reason);
spin_unlock_bh(&table->tb6_lock);
out:
@@ -4001,7 +4002,7 @@ int ip6_del_rt(struct net *net, struct fib6_info *rt, bool skip_notify)
.skip_notify = skip_notify
};
- return __ip6_del_rt(rt, &info);
+ return __ip6_del_rt(rt, &info, RT_DEL_REASON_UNSPEC);
}
int ip6_del_rt_reason(struct net *net, struct fib6_info *rt,
@@ -4009,7 +4010,7 @@ int ip6_del_rt_reason(struct net *net, struct fib6_info *rt,
{
struct nl_info info = { .nl_net = net };
- return __ip6_del_rt(rt, &info);
+ return __ip6_del_rt(rt, &info, del_reason);
}
static int __ip6_del_rt_siblings(struct fib6_info *rt, struct fib6_config *cfg)
@@ -4072,13 +4073,13 @@ static int __ip6_del_rt_siblings(struct fib6_info *rt, struct fib6_config *cfg)
list_for_each_entry_safe(sibling, next_sibling,
&rt->fib6_siblings,
fib6_siblings) {
- err = fib6_del(sibling, info);
+ err = fib6_del(sibling, info, RT_DEL_REASON_UNSPEC);
if (err)
goto out_unlock;
}
}
- err = fib6_del(rt, info);
+ err = fib6_del(rt, info, RT_DEL_REASON_UNSPEC);
out_unlock:
spin_unlock_bh(&table->tb6_lock);
out_put:
@@ -4204,7 +4205,8 @@ static int ip6_route_del(struct fib6_config *cfg,
if (!fib6_info_hold_safe(rt))
continue;
- err = __ip6_del_rt(rt, &cfg->fc_nlinfo);
+ err = __ip6_del_rt(rt, &cfg->fc_nlinfo,
+ RT_DEL_REASON_UNSPEC);
break;
}
if (cfg->fc_nh_id)
@@ -4223,7 +4225,8 @@ static int ip6_route_del(struct fib6_config *cfg,
/* if gateway was specified only delete the one hop */
if (cfg->fc_flags & RTF_GATEWAY)
- err = __ip6_del_rt(rt, &cfg->fc_nlinfo);
+ err = __ip6_del_rt(rt, &cfg->fc_nlinfo,
+ RT_DEL_REASON_UNSPEC);
else
err = __ip6_del_rt_siblings(rt, cfg);
break;
--
2.43.0
next prev parent reply other threads:[~2026-08-04 1:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 1:47 [PATCH net-next v5 00/10] ipv6: report why a route was deleted in RTM_DELROUTE Yuyang Huang
2026-08-04 1:47 ` [PATCH net-next v5 01/10] ipv6: add ip6_del_rt_reason() Yuyang Huang
2026-08-07 16:21 ` Ido Schimmel
2026-08-08 0:37 ` Yuyang Huang
2026-08-04 1:47 ` Yuyang Huang [this message]
2026-08-07 16:22 ` [PATCH net-next v5 02/10] ipv6: propagate the route deletion reason to fib6_del_route() Ido Schimmel
2026-08-04 1:47 ` [PATCH net-next v5 03/10] ipv6: record the reason for kernel-initiated route deletions Yuyang Huang
2026-08-07 16:22 ` Ido Schimmel
2026-08-04 1:47 ` [PATCH net-next v5 04/10] ipv6: add a deletion reason argument to rt6_fill_node() Yuyang Huang
2026-08-07 16:22 ` Ido Schimmel
2026-08-04 1:47 ` [PATCH net-next v5 05/10] ipv6: expose the route deletion reason in RTM_DELROUTE Yuyang Huang
2026-08-07 16:23 ` Ido Schimmel
2026-08-04 1:47 ` [PATCH net-next v5 06/10] ipv6: add inet6_rt_del_notify() Yuyang Huang
2026-08-07 16:23 ` Ido Schimmel
2026-08-04 1:47 ` [PATCH net-next v5 07/10] netlink: specs: rt-route: add route notifications Yuyang Huang
2026-08-04 1:47 ` [PATCH net-next v5 08/10] netlink: specs: rt-route: split out the request attribute list Yuyang Huang
2026-08-04 1:47 ` [PATCH net-next v5 09/10] netlink: specs: rt-route: add the route deletion reason Yuyang Huang
2026-08-04 1:47 ` [PATCH net-next v5 10/10] selftests: net: verify RTA_DEL_REASON on route deletion Yuyang Huang
2026-08-05 10:41 ` [PATCH net-next v5 00/10] ipv6: report why a route was deleted in RTM_DELROUTE Yuyang Huang
2026-08-07 10:11 ` Yuyang Huang
2026-08-07 15:52 ` Ido Schimmel
2026-08-08 0:36 ` Yuyang Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260804014714.4362-3-sigefriedhyy@gmail.com \
--to=sigefriedhyy@gmail.com \
--cc=bobbyeshleman@meta.com \
--cc=carges@cloudflare.com \
--cc=daniel.zahka@gmail.com \
--cc=davem@davemloft.net \
--cc=dimitri.daskalakis1@gmail.com \
--cc=donald.hunter@gmail.com \
--cc=dsahern@kernel.org \
--cc=dw@davidwei.uk \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=noren@nvidia.com \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox