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>,
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>, 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 v4 06/10] ipv6: add inet6_rt_del_notify()
Date: Wed, 29 Jul 2026 21:07:35 +0900 [thread overview]
Message-ID: <20260729120739.47880-7-sigefriedhyy@gmail.com> (raw)
In-Reply-To: <20260729120739.47880-1-sigefriedhyy@gmail.com>
Move the body of inet6_rt_notify() to __inet6_rt_notify() and give it
the deletion reason. inet6_rt_notify() keeps its prototype, so the
route addition path does not change.
Add inet6_rt_del_notify() and call it from fib6_del_route().
RTA_DEL_REASON now reaches user space on RTM_DELROUTE for routes the
kernel deleted on its own.
Signed-off-by: Yuyang Huang <sigefriedhyy@gmail.com>
---
include/net/ip6_fib.h | 2 ++
net/ipv6/ip6_fib.c | 2 +-
net/ipv6/route.c | 20 ++++++++++++++++----
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index c57980671f28..c6dc23a42c11 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -533,6 +533,8 @@ static inline void fib6_rt_update(struct net *net, struct fib6_info *rt,
#endif
void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info,
unsigned int flags);
+void inet6_rt_del_notify(struct fib6_info *rt, struct nl_info *info,
+ enum rta_del_reason del_reason);
void fib6_age_exceptions(struct fib6_info *rt, struct fib6_gc_args *gc_args,
unsigned long now);
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index d77c61f53155..159db10a846c 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -2056,7 +2056,7 @@ static void fib6_del_route(struct fib6_table *table, struct fib6_node *fn,
call_fib6_entry_notifiers_replace(net, replace_rt);
}
if (!info->skip_notify)
- inet6_rt_notify(RTM_DELROUTE, rt, info, 0);
+ inet6_rt_del_notify(rt, info, del_reason);
fib6_info_release(rt);
}
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index b67c8a31ccd6..304879c6e7e5 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -6376,8 +6376,9 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
return err;
}
-void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info,
- unsigned int nlm_flags)
+static void __inet6_rt_notify(int event, struct fib6_info *rt,
+ struct nl_info *info, unsigned int nlm_flags,
+ enum rta_del_reason del_reason)
{
struct net *net = info->nl_net;
struct sk_buff *skb;
@@ -6396,8 +6397,7 @@ void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info,
goto errout;
err = rt6_fill_node(net, skb, rt, NULL, NULL, NULL, 0,
- event, info->portid, seq, nlm_flags,
- RTA_DEL_REASON_UNSPEC);
+ event, info->portid, seq, nlm_flags, del_reason);
if (err < 0) {
kfree_skb(skb);
/* -EMSGSIZE implies needed space grew under us. */
@@ -6418,6 +6418,18 @@ void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info,
rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err);
}
+void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info,
+ unsigned int nlm_flags)
+{
+ __inet6_rt_notify(event, rt, info, nlm_flags, RTA_DEL_REASON_UNSPEC);
+}
+
+void inet6_rt_del_notify(struct fib6_info *rt, struct nl_info *info,
+ enum rta_del_reason del_reason)
+{
+ __inet6_rt_notify(RTM_DELROUTE, rt, info, 0, del_reason);
+}
+
void fib6_rt_update(struct net *net, struct fib6_info *rt,
struct nl_info *info)
{
--
2.43.0
next prev parent reply other threads:[~2026-07-29 12:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 12:07 [PATCH net-next v4 00/10] ipv6: report why a route was deleted in RTM_DELROUTE Yuyang Huang
2026-07-29 12:07 ` [PATCH net-next v4 01/10] ipv6: add ip6_del_rt_reason() Yuyang Huang
2026-08-03 8:14 ` Ido Schimmel
2026-08-03 13:00 ` Yuyang Huang
2026-08-03 15:50 ` Ido Schimmel
2026-07-29 12:07 ` [PATCH net-next v4 02/10] ipv6: propagate the route deletion reason to fib6_del_route() Yuyang Huang
2026-07-29 12:07 ` [PATCH net-next v4 03/10] ipv6: record the reason for kernel-initiated route deletions Yuyang Huang
2026-07-29 12:07 ` [PATCH net-next v4 04/10] ipv6: add a deletion reason argument to rt6_fill_node() Yuyang Huang
2026-07-29 12:07 ` [PATCH net-next v4 05/10] ipv6: expose the route deletion reason in RTM_DELROUTE Yuyang Huang
2026-07-29 12:07 ` Yuyang Huang [this message]
2026-07-29 12:07 ` [PATCH net-next v4 07/10] netlink: specs: rt-route: add route notifications Yuyang Huang
2026-07-29 12:07 ` [PATCH net-next v4 08/10] netlink: specs: rt-route: split out the request attribute list Yuyang Huang
2026-07-29 12:07 ` [PATCH net-next v4 09/10] netlink: specs: rt-route: add the route deletion reason Yuyang Huang
2026-07-29 12:07 ` [PATCH net-next v4 10/10] selftests: net: verify RTA_DEL_REASON on route deletion 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=20260729120739.47880-7-sigefriedhyy@gmail.com \
--to=sigefriedhyy@gmail.com \
--cc=bobbyeshleman@meta.com \
--cc=carges@cloudflare.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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.