From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAE4847CA77 for ; Wed, 29 Jul 2026 12:08:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785326903; cv=none; b=CgtXsSvjhsNaZKGdSYg4/acutWM/rOxQfTGbojvw8E52Ub2yV0aAqLlH+s/Bd/m8IDvQl+T483yUi6hgwjsApLCOrryCF/FG84iMaohOhbgde3dHCuTMkN7TLNhmyOiWgyDzwChyo9Vcf/C4GxCMj8eP/oCGWwLkwsXqgtklyrc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785326903; c=relaxed/simple; bh=j/YFlm+6KiqZ96WUYZ2v4lXl72N/2VjdREl7Xf5spFs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lUfl4o+slcsxz2r2sWZFetlL6D5idCCCrIe/99jTtFx7WGpb6NfXB7gsSzI+qd89NcJhLXHp6+RvOPga/8qs9eMwny71C3IrVk+JK2KdI/p/jNeK8SiXKzj/3Pg1yGJ5FL45obAAlNvS9U5MMGiCeWSBWyp9tZXr3mEQOc4i1eI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ErJCqMiw; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ErJCqMiw" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-84e0688b859so472191b3a.0 for ; Wed, 29 Jul 2026 05:08:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785326901; x=1785931701; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to:content-type; bh=0MQfNB1rogDS/50XyM99qlPBLLPAS0y2naXnL1l+SNM=; b=ErJCqMiw4Egbyl/FB56BdqZok9ho5jpq3X1n7kvs5p3v70hrQc/AaBXfZRJZRIATdB 7Jzi6uwQGvYstgo/rQU0iDy/hBXgeKdGirplQx9bCwCTrBFEYtu4IM4LlO5iGtvATXWl CyENpq0/cwQB/x583cfug4FKalxiioCxLnD9v+7dypDfpdh7WZE2fEKmNuvDY+JGBaO/ HNXkrHKpViiZZQ25KfeLVEde8+B/vUu9jixGb6PIhxTWP5RFF9cac5qxJEXq66Wp8mOR Ri12D3Q887AwUzNpHgnwmkTJFmWfis46GUVyBP59VWikcpLo7jltmz/UPAoz12h5f+6D 0+NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785326901; x=1785931701; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=0MQfNB1rogDS/50XyM99qlPBLLPAS0y2naXnL1l+SNM=; b=Pd0swD8GKToZFixWBgkAUVAaA5kilVhPGxflDahyNd9vEqHYzbbavQZ2UcODLmR1SA IVZ4pmu+jdo/z7NTHPqw4A43nWE4ADqOeR0X8Qm1D86fT9nybRERr1vVHC3wjQKicDRJ ITpFGtIe9e9oe7+ih6SEh4anpnOXLYXXIbsIN465Afi5dp0hSchx/1TiK2v4ap/EdMvu 3SveWydlZ2osGuFi9jW0LcuA4yaErT0S7N0ORX8XsSwYrolHAg7BdNtu1uQ7v6+rJim1 R5N9xSGk1cA+zIUK/o/Qw/5MWmnGsjCytjRXyknu+JG4mbpZluy42qiF0EbdXqQTGWrd L5TQ== X-Forwarded-Encrypted: i=1; AHgh+Rq1OvLT35LcJCtDHlrNepjPpbRowDHiDATFle/NtPz+UUMbYU0N8bXlCD7S+H0wGMkmGiUfzFbR1lMlqf8=@vger.kernel.org X-Gm-Message-State: AOJu0YxGRkzT/LdbMfTVqCUr1SwXl5d9/mW4hPK3znAGhdunLBTvaWjs Rg7lelVcdDEzZtzIYWUwcZzlmfYad+L4yST6bVWfNAAbAdBze3JmTBI5 X-Gm-Gg: AR+sD119P3ztxEOfyYd4iUyt+2kXZfxKF/uJgq4svbYBGvKzpa8ZBslONDb2CfB/Ybm wMXSeWjgt1LrQQ5D+JFbjEcqfe//mrx6t0aDGYSe8Ep2mxsWT50OY1lS6c2nfUOa4ku94HRsx2a 5NjzFy4zTPyCX+JvVPCUF7Odn3vopD/nspAZ3e/8GgeMknK5noP1Pm+Rq0AKERsk7mjlJhAhYm8 SBU9V0z3JEvjIQPs0tAjHI6iW2p23qpCAPJYQWcfCp5/Mbe/vegoUoFSQhEbHeQeQshKY6s2jP5 6JDz8JDKtQypQVti989ajhs6gaqFUNOPEtakefo/KNM0uAsv1IrgqTusRIaY4o291IJqADRDgf9 xmaPxrT5W/agvYj/Cdujf1rMyw/gk7Vkhb0odJ+YrgRlBG0pRWC/YnNS4MwsElWpLIM3e1J0CQX +wlaftvJ2mBVoLoGRE8Yn1fFkgPVzY9ZkaURDSzGseTKRjNT4CT2Mgbko+PhxHarWM+cfeeJZ0p Be0dimivp0LM4W85OJv2Addfyl6Wu7wzUzEqA== X-Received: by 2002:a05:6a00:1390:b0:848:82f0:679a with SMTP id d2e1a72fcca58-84e9335980emr7165149b3a.52.1785326901090; Wed, 29 Jul 2026 05:08:21 -0700 (PDT) Received: from m-upc-A520M-HDV.lan ([2400:2410:3f60:500:c705:d3b3:a6d9:8512]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84ea0300ac2sm1263482b3a.35.2026.07.29.05.08.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 05:08:19 -0700 (PDT) Sender: Yuyang Huang From: Yuyang Huang To: Yuyang Huang Cc: "David S. Miller" , Bobby Eshleman , Chris J Arges , David Ahern , David Wei , Dimitri Daskalakis , Donald Hunter , Eric Dumazet , Gal Pressman , Ido Schimmel , Jakub Kicinski , Paolo Abeni , Shuah Khan , Simon Horman , Stanislav Fomichev , Willem de Bruijn , 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 Message-ID: <20260729120739.47880-7-sigefriedhyy@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260729120739.47880-1-sigefriedhyy@gmail.com> References: <20260729120739.47880-1-sigefriedhyy@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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