Article View: linux.kernel.netdev
Article #19947[RFC net-next 0/3] net: fix route flush for routes using nexthop objects
From: Stephen Hemminger
Date: Fri, 20 Nov 2026 20:01
Date: Fri, 20 Nov 2026 20:01
56 lines
13016 bytes
13016 bytes
"ip route flush" fails on any route that uses a nexthop object:
# ip nexthop add id 101 via 192.0.2.1 dev dummy0
# ip route add 203.0.113.0/24 nhid 101
# ip route flush to 203.0.113.0/24
Failed to send flush request: Invalid argument
The first attempt at fixing that was to modify iproute but
that is just working around a kernel bug. Flush should be
able to be done as dump-and-echo by flipping to set
RTM_DELROUTE. This always worked until nexthop compat mode
was introduced.
This series fixes thes by changing where fib handling
is done on delete. I don't use next hop id anywhere
so this is just a proposal.
Patch 1 ignores the legacy nexthop attributes on RTM_DELROUTE when
RTA_NH_ID is present, for both families. The id is already
authoritative in the matching code, so nothing downstream looks at the
fields being cleared. RTM_NEWROUTE stays strict.
Patch 2 accepts RTN_BLACKHOLE on delete when the alias uses a blackhole
nexthop object, so a route can be removed using the type the kernel
advertised. Dropping the dump-side rewrite instead would change what
every existing reader sees.
Patch 3 adds the selftest coverage that was missing. fib_nexthops.sh
exercises "ip nexthop flush" thoroughly but never "ip route flush"
against nhid routes, which is how the two paths drifted apart in the
first place.
Testing: the new tests fail 15 assertions against an unpatched kernel
and all 26 pass with the series applied, booted under qemu with
nexthop_compat_mode=1. The existing fib_nexthops cases, including the
legacy delete paths patch 1 must not disturb, still pass: 93
assertions across ipv4_fcnal, ipv6_fcnal, the compat_mode pair and the
fcnal_runtime pair.
Stephen Hemminger (3):
net: accept legacy nexthop attributes when deleting by nexthop id
ipv4: accept the reported route type when deleting a blackhole nexthop
route
selftests: fib_nexthops: test route flush with nexthop objects
net/ipv4/fib_frontend.c | 17 ++-
net/ipv4/fib_lookup.h | 1 +
net/ipv4/fib_semantics.c | 14 +++
net/ipv4/fib_trie.c | 2 +-
net/ipv6/route.c | 14 ++-
tools/testing/selftests/net/fib_nexthops.sh | 126 ++++++++++++++++++++
6 files changed, 169 insertions(+), 5 deletions(-)
--
2.53.0
Technical Details
Message-ID:
<20261120200635.95798-1-stephen@networkplumber.org>Path:
mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368117-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368117-linux-kernel-netdev=dewy.ru
From: stephen@networkplumber.org (Stephen Hemminger)
Newsgroups: linux.kernel.netdev
Subject: [RFC net-next 0/3] net: fix route flush for routes using nexthop objects
Date: Fri, 20 Nov 2026 12:01:27 -0800
Organization: Usenet Network
Message-ID: <20261120200635.95798-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="3252243"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:yIh9g2hhOFw/o04jri7FxutHj/s= sha256:fQBXXj2hlP+X0Ckb/0fnBp0M2pLM0myEqsryYsQNZEU=
sha1:hm/uJ04YtNYo2hTm4mZ8+w+6Kqk= sha256:mrfUECsBsKLWJ95a4VNPR/gBU/+VFIWgiTsNPww0aTc=
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 D99CE115A6D; Fri, 20 Nov 2026 23:07:25 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=networkplumber-org.20260707.gappssmtp.com
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 XK5GXbnkJumb;
Fri, 20 Nov 2026 23:07:23 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-368117-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=quarantine dis=none) header.from=networkplumber.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
by mail.dewy.ru (Postfix) with ESMTPS id 8A25D115A6B; Fri, 20 Nov 2026 23:07:09 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sin.lore.kernel.org (Postfix) with ESMTP id 60F074447C; Fri, 20 Nov 2026 20:06:49 +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=1795205208;
b=oGkrfEeW3UaEG/PsfVb5wN7Pl8P2rOK38OqhmpeqejT4D46NJjL3DwvfwQd4pYythVvn
t1zrxGoInzlCZfNMk03/3QtYJINQGwiagch1jWNfYtLCe1win8p73jjrAdmdgDgtxyp82
xjYzWttl8wAdOVKVmhq1DT9HhUm+sbH6fuXLAH+NqcqlmpfmrjCLcYeN0mt7DHbMZCwsc
r5UPFUcvVnX1piD6IIG/Fam77dckCY8Zhb+ldQlNB0LWdbDlHzDWBhyrL3GhgCJNQtFHf
fyYk6PJaGHTg7niPdHolDdTltCI1azsPZ0BwikEqlG6qoXWkZbhR5Ds6ucCmGLyD4IQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795205208;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:X-Mailing-List:
List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding;
bh=+C+q5ncc3dwft8pH4Ui5y/gC5sWH3mwGOFy5VnKoiV8=;
b=SpeChkeqBC+0DttbCxtmnGsYIoeKPywFk+xl5Bb1OCJjLmX7tMa+yf5lR/8xp0ZNlcpx
vlOxO53WiWwrQJ9BINkdveoEfT/r6vIEO7ixhK0RgFgzTXp+O9aROwqigPm8q4qSDwXeb
1Pgeft+DrolZ59KefjMMEMGOtz1TLzZqHsJre2Q4ngIoKJzz4RWi7ESVxOngApCLR47ro
tKDBXHoo7WpEJSuFAhwWBySG0nWEBDodwXgR35EkNQAo1Cx40T5Zun2+QhmfAgmKMshnY
fEptK58YDNJ3CeC3FjFloGSzaFphpQ8vStNHUz8YHYVh/qkRHAMjvFby1TFYUu0uWjA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=networkplumber-org.20260707.gappssmtp.com header.i=@networkplumber-org.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=Re3GQRgF;
dmarc=pass header.from=networkplumber.org;
spf=pass smtp.mailfrom=networkplumber.org;
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 6783B606A6DA;
Fri, 20 Nov 2026 20:06:48 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=networkplumber-org.20260707.gappssmtp.com header.i=@networkplumber-org.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=Re3GQRgF
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.173
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1795205207;
b=MZT4672KRirdmguXPrxI0FiTLOPgVUKIhS3ZnkXWGtGlG7PxbafAA5QIzGg4/QLCpDGs
dCWw5GlKnxCCcS0IEB1/wQy3OOy+gCN/nVyWwT4ew2vRcbCQssYa+QA3dG7WhYQlHvHuA
1QVU5sL7atDM2w+xPiiGKvRyEqXcuRFLOtNZcrU6S0LaXR9o9E/m+PV+j4VYwpZcXTI/T
W4C80OfUPBJT20CB8u/lQ7rHF5RBqt75mDCzayS4hoyf1k6UcL/kdtJCuQPumz4pQKL0d
dLUGhE3wKe4BRIBknQnH/Iy0YufmZhCLAzh0n68g17MvvHktaXppC4dubJBRLkU2lnw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795205207;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding;
bh=+C+q5ncc3dwft8pH4Ui5y/gC5sWH3mwGOFy5VnKoiV8=;
b=Tmycy+0hga3YkXNkTGqaeMf7HxuNWeCLln75WNvQ+6UI0sbEUhd8YE9x9ZLWybz+Hfop
oXW6pp/lBBX/4mAiIgRTdtev4L95Bw6+jjsWYMRzIsdevJoQe3Y+AOTqlbsgz5RMm8Ak5
7BNjYGcdurPTcPOYyue9pVh3Mycu1AcDZjfJd76e64WLMDvp8xsyDay/EUUfZEwi7vKo0
VkHX+xmm27CcYntZkMKMYltCgDUobvnuWExCdF9cmeibIC8Awf5mqygHB/NWReUK2kPT4
lCqvnlOMw3fcy6tzP8jti0qIujfeyNz8AzaRqU1k5x/xsA3CFWo8/qE1o9V1lxix0HQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=networkplumber.org;
spf=pass smtp.mailfrom=networkplumber.org;
dkim=pass header.d=networkplumber-org.20260707.gappssmtp.com header.i=@networkplumber-org.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=Re3GQRgF;
arc=none smtp.remote-ip=209.85.210.173
X-Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2572606A6F2
for <netdev@vger.kernel.org>; Fri, 20 Nov 2026 20:06:38 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C2572606A6F2
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=networkplumber.org
X-Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-8b32bc605d9so717793b3a.2
for <netdev@vger.kernel.org>; Fri, 20 Nov 2026 12:06:38 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=networkplumber-org.20260707.gappssmtp.com; s=20260707; t=1795205198; x=1795809998; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
bh=+C+q5ncc3dwft8pH4Ui5y/gC5sWH3mwGOFy5VnKoiV8=;
b=Re3GQRgFInWcgf1Ahl6u7Ra8im438UHwEQIp9iC7VIv0/HdZ/3uen4dP9k4SzltcWn
41KDM8spY3wJ5ExTfduROEXm4U+tQjtPBsUx6e8G5HFFLoirVg3ZugH/cp191BLIsIpt
t4reyjWpeC47sEwq+SPYVyxAoTAxPKKDFDWu5j6eBfRJGRHeph2SqAbLY9TY4ewyd9uv
kqjWVL/TCaUa7nXyI1peLS4fKgrh5M3K72/3nSqhDwz1VHoGA1b7+bELBNxL/T355Xr9
5mARg/5cIhtLPZK0HmYbPmPpQaIF2yjqEUT/j/mZ8pcbVdmdMuk70hWqxAgfhmnOqdm3
VoSg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1795205198; x=1795809998;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=+C+q5ncc3dwft8pH4Ui5y/gC5sWH3mwGOFy5VnKoiV8=;
b=a7H7oKe21uHvXCSC/xiBG9z4AWULe/sZBa3m2vX4Zfyfb5EBSBOvShm2xjGIeZ6H1v
9CwW3CTkwkzLk1pTBoAHxz7fkonMoxmkjJ5SETdGwtVZd+gLFR2htvtLG/HZ06oaQZBq
vp7J3q9ax8wL5uPmVtnxyRC/pnPbtnpCghIvoJMBFuCSaFpb9QyGfXU++wM0TBI+0L30
QkoRqlGW+toncx771qmnmc9bWTBVGOhUzqnyez8HQn/snZVqEGqcIuk8pQp3R1+uZJTw
ZDmLuie8IkSoYT5ce9thPC+5XpkcnMq4JnaQgSnQa/HMKFfRRaqrnUNdG14ulCuAfjtA
T6BQ==
X-Gm-Message-State: APuU4Z+X5KE0PbV+o92UnXVPJhaxyfJApSjrjmyqxRhbxEw9lSGXDuK2
CQ3BYSiXM0l3Y7bNa3SpHhHxv25RGIYptvT+dLHF7RUp7O34zZMUqvmSPclo5P07KKFllSRyjfV
idiWe9Bs=
X-Gm-Gg: AYBFou2JDywm3S9N8baC/SBojKyJUnuTgb9qsHUUitlTqlN5w1SAiO7Mzsy2Zj0bDKM
lvo8H6d3KM1qhQo5DU4OTcEQF4nhmdW1ORCnVdQ+ZRMeI+hLCIR6or78T1qgK1d0Siz1gitVL33
4RC/Udbq8lKXYID7OLDyqRooP+9F5y9Q+qTSHJn2Lxr/BdmN6lVZd891sMLMtF54lA6Eksuzrou
J2FzOIWK6rBqbbrz55qr2OpeXeYyw2So2bTaATow7yLLSU4Im83G27uJl7f5CM5biVqCw9+V+bO
I8SEkqyuSflJ9uk6bHblkGblGykNsvNcqJHeJizfvGh0WIDLF+/EhmiDse+VhQ3V+sdDOlJji/S
oWfvYBPmw4gvnFy1MatlygcRtOUPoKeS9RIgeSs7KNYF5rbFsXiAHTJB4i06myyj6OhxKy9/QRS
DYfoqs1IFn5RMS+4F+IFGqLwdWQT6ZeLaTrOPpwZBjCUC3AiS4Fbdn76vcdFFixpx3/EMBb3wSk
HC7b3lP06dFF+X9HF54aN0CuExsSPbIL2qdz+9HK4TfYkP3sosLbHtV2gNaeCkSlHa5vURSp+Kw
afKE2cAqtSE9TdIfGnaTjJLJzNgyXuUdMR040DvajQiXyQT1tIWkp7yqaYB8FNa0hiJcPssc6av
UI+Dgqtu+8xlc+g==
X-Received: by 2002:a05:6a20:1bc6:b0:3f4:79fa:414 with SMTP id adf61e73a8af0-401bb21187fmr2510018637.13.1795205197980;
Fri, 20 Nov 2026 12:06:37 -0800 (PST)
X-Received: from phoenix.lan (204-195-112-43.wavecable.com. [204.195.112.43])
by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cde6d028a54sm1619282a12.18.2026.11.20.12.06.36
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 20 Nov 2026 12:06:37 -0800 (PST)
X-Cc: dsahern@kernel.org,
Stephen Hemminger <stephen@networkplumber.org>
X-Mailer: git-send-email 2.53.0
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