🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20388

Re: [PATCH net 1/2] ipv4: accept nexthop dump attributes in route deletes

#20388
From: netdev-bot+sashiko
Date: Sun, 22 Nov 2026 09:50
128 lines
12501 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 0 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] The patch fixes `ip route flush` of nexthop-object routes for
  IPv4 only.
- [Low] The commit message says the failure occurs "with nexthop
  compatibility mode enabled" and gives a reproducer "in a fresh network…

--

ipv4: accept nexthop dump attributes in route deletes

This commit skips the check in rtm_to_fib_config() that makes RTA_NH_ID
and the expanded nexthop attributes mutually exclusive, but only for
RTM_DELROUTE requests. This lets ip route flush delete routes that use
nexthop objects when the dump carries both. The check stays in place for
RTM_NEWROUTE.

Link: https://lists.openwall.net/netdev/2026/10/26/186

> ip route flush reuses route dump messages as RTM_DELROUTE requests.
> With nexthop compatibility mode enabled, the dump includes RTA_NH_ID
> alongside expanded nexthop attributes. rtm_to_fib_config() rejects the
> combination with -EINVAL, leaving the routes installed.

[ ... ]

> report below. An unmodified kernel and iproute2 reproduced it without
> fault injection in a fresh network namespace with compatibility mode
> enabled.

[Severity: Low]
This isn't a bug, but "with nexthop compatibility mode enabled" reads like
an opt-in setting. Isn't compat mode already on by default in every network
namespace?

net/ipv4/af_inet.c:inet_init_net() {
    ...
	net->ipv4.sysctl_nexthop_compat_mode = 1;
    ...
}

fib_dump_info() leaves out the expanded attributes only when compat mode
has been set to 0, so default configurations hit this bug.

Could the commit message say that default configurations are affected? That
would help with stable triage.

> diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
> index 8c123b111b3d8..6b012c8c6ea30 100644
> --- a/net/ipv4/fib_frontend.c
> +++ b/net/ipv4/fib_frontend.c
> @@ -868,7 +868,10 @@ static int rtm_to_fib_config(struct net *net, struct sk_buff *skb,
>  		goto errout;
>  	}
>  
> -	if (cfg->fc_nh_id) {
> +	/* Dumps can include both a nexthop ID and compatibility attributes.
> +	 * On deletion, fib_nh_match() uses the ID to match the nexthop.
> +	 */
> +	if (cfg->fc_nh_id && nlh->nlmsg_type != RTM_DELROUTE) {
>  		if (cfg->fc_oif || cfg->fc_gw_family ||
>  		    cfg->fc_encap || cfg->fc_mp) {
>  			NL_SET_ERR_MSG(extack,

[Severity: High]
Does IPv6 need the same change? rtm_to_fib6_config() in net/ipv6/route.c
still runs this check for every message type, including RTM_DELROUTE:

net/ipv6/route.c:rtm_to_fib6_config() {
    ...
	if (tb[RTA_NH_ID]) {
		if (tb[RTA_GATEWAY]   || tb[RTA_OIF] ||
		    tb[RTA_MULTIPATH] || tb[RTA_ENCAP]) {
			NL_SET_ERR_MSG(extack,
				       "Nexthop specification and nexthop id are mutually exclusive");
			goto errout;
		}
		cfg->fc_nh_id = nla_get_u32(tb[RTA_NH_ID]);
	}
    ...
}

err is already -EINVAL at this point.

In compat mode, rt6_fill_node() adds RTA_NH_ID to the dump and then calls
rt6_fill_node_nexthop(). For a group, that adds RTA_MULTIPATH. For a single
nexthop, fib_nexthop_info() adds RTA_OIF, plus RTA_GATEWAY when there is a
gateway. IPv6 nexthops always have a device, so RTA_OIF is always there.

When iproute2 sends that message back as RTM_DELROUTE, won't ip -6 route
flush on nhid routes fail with -EINVAL the same way, and leave the routes
installed?

ip6_route_del() already matches on the nexthop ID:

	if (rt->nh && cfg->fc_nh_id &&
	    rt->nh->id != cfg->fc_nh_id)
		continue;

It also skips routes without a nexthop object when fc_nh_id is set. That
suggests the same RTM_DELROUTE exemption would be safe in
rtm_to_fib6_config().

The commit message also says:

    The IPv4 group and IPv6 compatibility selftests also passed with the fix.

This could be read as saying IPv6 is not affected. However, those selftests
never run ip -6 route flush, and this patch leaves the IPv6 path unchanged.

The later patch in the series ("selftests: net: test flushing IPv4 nexthop
routes in compat mode") also covers only IPv4 and does not touch
net/ipv6/route.c.

Could the series be extended to cover the IPv6 parser too?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118084510.332821-1-zypulsecore%40gmail.com
Technical Details
Message-ID: <179534101163.3135.4888476897314424157@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368648-linux-kernel-netdev=dewy.ru
References: <20261118084510.332821-2-zypulsecore@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368648-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 1/2] ipv4: accept nexthop dump attributes in route deletes
Date: Sun, 22 Nov 2026 09:50:11 +0000
Organization: Usenet Network
Message-ID: <179534101163.3135.4888476897314424157@kernel.org>
References: <20261118084510.332821-2-zypulsecore@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3608347"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:SSAx7CY6ixJgJR3HGmFuFvkqveY= sha256:oAY6m8er6ogkTAgLay08bu8DuNjZBcDn2wvzLs3YDEU=
	sha1:vIN2HoS5Krb9gLtDfGq7yEHIK1k= sha256:TUeLe01uyOO5NueG/EV3ixl5HjKXQUE2MGqSWyMiJU4=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id CFD88125D75; Sun, 22 Nov 2026 12:50:37 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 2WU7Hqu6R48N;
	Sun, 22 Nov 2026 12:50:29 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-368648-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 26914125D74; Sun, 22 Nov 2026 12:50:21 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 793162C5D4; Sun, 22 Nov 2026 09:50:19 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795341019;
	b=jlz2s/QQDTw6qWsiOYpN5GTjn3q4XRQBcHytzOHu2UIAm71CMNJsBkGWYR+EARP6g1iK
	 7HffBbJaoko9zIIqS3VauSHqzmZ2uo4AuMNGMoEI+tNANzdQZxGup0iheSNhzPEf14TXl
	 UaUponNeo93H1FrKUlxT/MzYg1c6o8Bt4V6he0StAjifiDmBYwjOzrxz3xqemrbRt63PH
	 NZqAehVM444WYu4hX2zBpJyErnCZw2lF8LPIuasvPvj3ZMQizHLf62OS+k/AgNqv4jAGu
	 sNVlhFbRtNCB5hXXhccMYG+slW3rjNmbWkHQoGGemTyr4EZbPzWmmxTiSP6ZYYN6hHg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795341019;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=xfzV/JbzjYiMDIWRSSaim/SwI1CIWk/grhSKbqdBMOc=;
	b=FwlH7YOfp1VtLf8M0DgNkHNzMKssSAbHOZ6APbxFN+yGuzy7M0lgjxVSsQOFYkTJlwyu
	 lmsTTHsvpUJ6O0+SMoouS1/Xhr5vGDB5lTATTYJrMMU3nCovIy/f2aMkRESFVWyykqY2D
	 lu0GMVvhgbNgaoPRx6ETUAX5nwBQdj7qVhiaghbNTWu49Vu1zWjwpOVw4bB/leDpAhP7X
	 EojFqlmcPmxTUB9E6ISP+ExC/n9Ua95Ek+D0Zh08lnQ2lqr2/OvkCp1AwE9FHTZAcwkfn
	 96kMODXNuNxlHN8xTnR8q08ETJV3U9pfTJtzg8o/UcOtsNNruV2FmnYZJDo2cTxQW9A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Bwl65gyd;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F12D606A32C;
	Sun, 22 Nov 2026 09:50:19 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Bwl65gyd
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795341013;
	b=HO9jaRZ4kFgUCChcv8jWa2BZXhqiyxqtNAVUAWTkif/d8FmGSqIRuwsLRVXrYjtHy0/X
	 GSosKsMCz6BmESMVZyTSsbhT63YD0gxgGvx0FuY8blhsdycGArOoA2wQoNWS0A5T15dMY
	 gVfWr2EH38LhDGgMvBQP4P3qXERq51BUTI60f3w1XdqfPcfqfhFFk4ETjsL+MvYT5/xq0
	 OBHRi29vDaDHyMU8gZAbwl3Iw3m3Z5fWHMRarNqAjbb1JeVbCSdl4+BnM+6cpF6lOE0hF
	 py7wzkyZUS5n2/mE5s2TWuTe5VIQuMYoBMUJbFv5170QDCazeVAeLNQYUi9JgDE2p4g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795341013;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=xfzV/JbzjYiMDIWRSSaim/SwI1CIWk/grhSKbqdBMOc=;
	b=TdMVkBLJlBg6l4QR1yCeFMfLnViHKxmNmiJQVgKG5folDCw2vRn1UWguAtcKlSgzlqhe
	 Mf+vTsyKfFq5KptO+gGWlnBkCnd8GlX6xE1cutbS8jMrHWRo1rmnOOyEGOAEkxPKXHVIp
	 8LTwRfysaVY+TO0Q67xv50YmKSqRtv5enThp4a2vGUf1awTeb44pfgH1OXJ2w9EWG9rwd
	 2HJVd7dqleNkPdl9SNHn9BDBFGlx2GJszGvL870uxiQzlXWXyJq1+lt89Uw11e23AhJg9
	 /hlrxsRzDJRo9Z5z3k8TM9MfiEGLI2ZAZr7NizWvPfPIv8IVtKkz1a2OxNd1D7hUdCQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Bwl65gyd;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AB54606A320;
	Sun, 22 Nov 2026 09:50:12 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18F471F000C4;
	Sun, 22 Nov 2026 09:50:12 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795341012;
	bh=xfzV/JbzjYiMDIWRSSaim/SwI1CIWk/grhSKbqdBMOc=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Bwl65gydXAnqL+OkGowKb70TsIcZb6PFsMwxlflFq569a6orORLuf1U8kwEpVxIFl
	 CRktWeaoAIQrK2nXpA2ZGIh49lUzVIEuf7LRg30DF8bc1nEWHQngJCcEhS6BLpc6OU
	 q2ps7g9bj4HReoHY8X742irKfI8DYhcDyIo58at9xbHnqTROnBUR4d92L1/Up7WcY8
	 hfQUkeSyjUq8AKUqhr7s/2ZFaZ29v8nY47HBhlV+VvC0KGJYDISwD1RDRi5xdSsOM3
	 qryzhP/B4N5iVlwX0NMC2V/nAOLedrISAJWPyuELDXgJJyI6Z2lGfwFA/AIwZ2Fbkq
	 SIEhMXVZQnYhg==
X-Cc: netdev@vger.kernel.org, dsahern@kernel.org, idosch@nvidia.com,
 stephen@networkplumber.org, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, shuah@kernel.org,
 linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
 linux-api@vger.kernel.org
X-In-Reply-To: <20261118084510.332821-2-zypulsecore@gmail.com>
X-sashiko-severity: High
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list