Linux userland API discussions
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Yuen Su <zypulsecore@gmail.com>
Cc: netdev@vger.kernel.org, David Ahern <dsahern@kernel.org>,
	Stephen Hemminger <stephen@networkplumber.org>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-api@vger.kernel.org
Subject: Re: [PATCH net 1/2] ipv4: accept nexthop dump attributes in route deletes
Date: Wed, 18 Nov 2026 14:21:10 +0200	[thread overview]
Message-ID: <20261118122110.GA1179460@shredder> (raw)
In-Reply-To: <20261118084510.332821-2-zypulsecore@gmail.com>

On Wed, Nov 18, 2026 at 04:45:09PM +0800, Yuen Su wrote:
> ip route flush reuses route dump messages as RTM_DELROUTE requests.

That's an iproute2 design choice. Where does it say that the kernel has
to accept netlink messages that it dumped when they are delivered as
requests (potentially with a different type, as in this case:
RTM_NEWROUTE -> RTM_DELROUTE)?

I assume it was implemented this way because it was easy / convenient,
but you can tell that it doesn't make sense by how fragile it is.

Another example (that wasn't accepted):

https://lore.kernel.org/netdev/20260923-lwt-encap-noflag-v1-0-8de7ab6c86e9@gmail.com/

> 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.

OK, but why do you need this compatibility mode in the first place and
you're not simply disabling it like most production systems that are
using nexthop objects?

Note that iproute2 can include the necessary information in route dumps
even when the compatibility mode is disabled (with -d):

# sysctl -wq net.ipv4.nexthop_compat_mode=0
# ip route show
192.0.2.0/24 nhid 1
# ip -d route show
unicast 192.0.2.0/24 nhid 1 proto boot scope global
	nh_info id 1 dev dummy1 scope host proto unspec
# ip nexthop
id 1 dev dummy1 scope host

Is this patch motivated by an actual use case or an LLM report?

> 
> Skip the mutual exclusion check for RTM_DELROUTE. fib_nh_match()
> already uses the ID to match the nexthop when an ID is supplied, so
> the expanded fields do not constrain that match. Keep the validation
> for RTM_NEWROUTE and leave the other delete selectors intact.

This leaves save / restore broken.

> 
> The failure was reproduced while investigating the iproute2 flush
> report below. An unmodified kernel and iproute2 reproduced it without
> fault injection in a fresh network namespace with compatibility mode
> enabled.
> 
>     ip link add d0 type dummy
>     ip link set d0 up
>     ip -4 nexthop add id 101 via 192.0.2.1 dev d0 onlink
>     ip -4 route add 198.51.100.0/24 table 1111 nhid 101 metric 10
>     ip -4 route flush table 1111 metric 10
> 
> Verified the flush and the existing new-route validation in QEMU/KVM.
> The IPv4 compatibility selftest reproduced the failure on the base
> kernel and passed with the fix. The IPv4 group and IPv6 compatibility
> selftests also passed with the fix.
> 
> Codex assisted with isolating the IPv4 delete change, writing the
> regression test and running the QEMU comparisons.
> 
> Fixes: 493ced1ac47c ("ipv4: Allow routes to use nexthop objects")

Not a regression, never worked. If anything it should be targeted at
net-next, but I don't think that such patches should be accepted. The
fix belongs in iproute2.

> Link: https://lists.openwall.net/netdev/2026/10/26/186
> Signed-off-by: Yuen Su <zypulsecore@gmail.com>

  reply	other threads:[~2026-11-18 12:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  8:45 [PATCH net 0/2] ipv4: allow route dump replay with nexthop IDs Yuen Su
2026-11-18  8:45 ` [PATCH net 1/2] ipv4: accept nexthop dump attributes in route deletes Yuen Su
2026-11-18 12:21   ` Ido Schimmel [this message]
2026-11-18  8:45 ` [PATCH net 2/2] selftests: net: test flushing IPv4 nexthop routes in compat mode Yuen Su

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=20261118122110.GA1179460@shredder \
    --to=idosch@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=zypulsecore@gmail.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