🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20174

[PATCH net 1/2] ipv4: keep scanning the leaf when a nexthop object is unusable

#20174
From: Yifei Sun
Date: Sat, 21 Nov 2026 18:20
51 lines
9922 bytes
With veth1 on 172.16.1.0/24 and veth3 on 172.16.2.0/24:

```console
$ ip nexthop add id 12 via 172.16.1.2 dev veth1
$ ip route add 10.0.0.0/24 nhid 12
$ ip route add 10.0.0.0/16 via 172.16.2.2 dev veth3
$ ip route get fibmatch 10.0.0.1 oif veth3
RTNETLINK answers: No route to host
```

When the /24's nexthop object has no path on veth3, fib_table_lookup()
backtracks past the /16 in the same leaf. A socket bound to veth3 then
ARPs for the destination instead of the gateway. Try the next alias,
as for inline nexthops.

Encountered this while work on a unrelated IPv4 SADR patch (not sure if
this is even needed...)

In QEMU with lockdep on 5e2976e52671, the selftest and device-bound
ping and UDP failed before the fix and passed after it.

Fixes: af7888ad9edb ("ipv4: Refactor nhc evaluation in fib_table_lookup")
Signed-off-by: Yifei Sun <yifei.sun@inria.fr>
---
 net/ipv4/fib_trie.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 394df1de1281..2a670e9b0417 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1591,7 +1591,7 @@ out_reject:
 						     &nhsel);
 			if (nhc)
 				goto set_result;
-			goto miss;
+			continue;
 		}
 
 		for (nhsel = 0; nhsel < fib_info_num_path(fi); nhsel++) {
@@ -1622,7 +1622,6 @@ set_result:
 			return err;
 		}
 	}
-miss:
 #ifdef CONFIG_IP_FIB_TRIE_STATS
 	this_cpu_inc(stats->semantic_match_miss);
 #endif

base-commit: d5b89d55a322b632e2b465b392a4c1d9d338db9c
Technical Details
Message-ID: <20261121182031.36626-1-yifei.sun@inria.fr>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368385-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368385-linux-kernel-netdev=dewy.ru
From: yifei.sun@inria.fr (Yifei Sun)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 1/2] ipv4: keep scanning the leaf when a nexthop object is unusable
Date: Sat, 21 Nov 2026 19:20:16 +0100
Organization: Usenet Network
Message-ID: <20261121182031.36626-1-yifei.sun@inria.fr>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3464899"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:WC+q1qkh8oZxwWtBjUZeOLDfSGI= sha256:qTjPpK/EBD68a/ywQAXyUN9URzWSEzIkrWrB2HsldCA=
	sha1:hQfz34tBBkDH3NwQLHze8+4lEg0= sha256:f1Vsgv/gsbHG7I8lQkz8v7K1BAFlOjdQbFTOnCg3GCc=
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 D3D9A115BA9; Sat, 21 Nov 2026 21:21:30 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-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 (1024-bit key)
	header.d=inria.fr
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 Rd3J_5dRhzNt;
	Sat, 21 Nov 2026 21:21:23 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-368385-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=inria.fr
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 0D0AE115B48; Sat, 21 Nov 2026 21:21:15 +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 A1178366E4; Sat, 21 Nov 2026 18:21:13 +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=1795285273;
	b=VrzRR2fdBvCyQ+YlvZHZ7uUQ9/SNZQkfeAmUJl0I2Xob41foJYDbpGS+WmwhPXKeYS7U
	 DGY5uS+n63NBa8QCjkEVKJTk4LfV9afhDlP5/DftwqoylPlK4dJ5dKpbItG7Axf5CsS0M
	 ZDgMCJUD/UiNxrY2bhHXHMzOa0Ck9/Rj5iuwqLjZvZBFSZsvg/fM6QUl90ezcfifd8QAI
	 TyRrZCtUweZsto6dfS25/FojT60sFRn4B9puPKbGq5HinIGg0rWiXDqHZUh++W6vvOnZ6
	 m3VDK14A9m3wxmEnrRTUD/dS9L5kioTRKwPO/8zP/Zo2pXd24SqQxQ2Pcciu4uTYiFg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795285273;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:
	 X-CSE-ConnectionGUID:X-CSE-MsgGUID:X-IronPort-AV: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=BiTHRKW3n1NEjNfmnAFRnK5r5gKkPivxMejwt+0oWMk=;
	b=Z04V+of9ayOuk7bJo7XIM0iQJ6f7kL2fAqtuWk4DE/bESgj3YxSIPVbfzZ5Bc0rOiqTW
	 XAhM4r9wyusUIlP5CMOIYUYZgUe7B2fA7eFG+Ni1OFZBMVAdwco2Yci/AydAejjymmA75
	 h/ptW9eTq1X7Rr8d95eEiZBLW+6iXH6T59JTTVIuK41rH1KHV6N7EZJAz1Gx5ohy16KkF
	 Nn/Xi/yGRj8v5lZUMU/UQvSWtPMw1sCU/JtmH1kyIYuCmlujdMuJoy1b1PlAmdHOkOXnu
	 sAKmeh+nt0uUzM+20CMSWPE48ZXkKF/fWnVPocbmGalBwkL+SRlMYRciOqHWi4jcSJA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=inria.fr header.i=@inria.fr header.a=rsa-sha256 header.s=dc header.b="HSPYYjR/";
	dmarc=pass header.from=inria.fr;
	spf=pass smtp.mailfrom=inria.fr;
	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 7845B606A335;
	Sat, 21 Nov 2026 18:21:13 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.a=rsa-sha256 header.s=dc header.b=HSPYYjR/
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.134.164.83
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795285272;
	b=HRPw1ShpAdcnHcip+QeEFicbRy8MboRPv62AaoLa76PfpNy8iKKgYtYkvf3MWb43echl
	 qm5PjhtvbstSgPnHXIKhF9HvQx9qTxgjURfKL1q909oozFI8CEg5otIuSjDlk3+La8SmS
	 PELs0a+/xZEo/CbcsJ3Po6i9I/VI+W8t4TYvo24srMkDpECuZtqjLM0Tcx4xx3+e6ZLmc
	 2J9JYmZB6N7nhlcDoyNO60WmFXkJzl2Lny1U47P9DqUXFmQ9Z3v4+gkxCZ3ofkVUg6KwA
	 CNDDsQkY31gVlj8YqERcpMtKLDK0NpjRSusJIhrbeyjwtSZl8SifG7G67PqBG64vKRA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795285272;
	h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID:
	 X-IronPort-AV:Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 MIME-Version:Content-Transfer-Encoding;
	bh=BiTHRKW3n1NEjNfmnAFRnK5r5gKkPivxMejwt+0oWMk=;
	b=QB2ylhCd1NIkZXpuLkzJ05wckdscjkznqaQuGF06+uSAx9QmYJlf7sZL4gqslJwTfhfH
	 gnbT0wiW7rJL+uOnqQp1QdFU302oH+UFRsGcx6Vx7/DddDg+5EwXjUleW8rUshK/1/HBm
	 uo8vnVpJXMH8J6TbUorVdxydRhGEcVflPsKBL6MwRG7WNB6tgyCsTnpndJeUL8mLLVQAn
	 DG4XV3CPjawVJ4cWQZSHSLrnPdP9W/kzWIfY3vUhVFasFdqQc3SJRbCNbfXPsXMOI9aUt
	 5bmNxKFs5RVSyvRkC2lZeudBy0Ixgw48CPFGP+a6c3JAeBO/pKGO/pWFxf3N9DwbzZA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=inria.fr;
	spf=pass smtp.mailfrom=inria.fr;
	dkim=pass header.d=inria.fr header.i=@inria.fr header.a=rsa-sha256 header.s=dc header.b="HSPYYjR/";
	arc=none smtp.remote-ip=192.134.164.83
X-Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83])
	(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id C32B0606A320;
	Sat, 21 Nov 2026 18:21:10 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C32B0606A320
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=inria.fr
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
  d=inria.fr; s=dc;
  h=from:to:cc:subject:date:message-id:mime-version:
   content-transfer-encoding;
  bh=BiTHRKW3n1NEjNfmnAFRnK5r5gKkPivxMejwt+0oWMk=;
  b=HSPYYjR/Zr29tCwa2+h9g0/n5xh3obrl7x1wprN/glMjEUC5DySZRYVX
   h+KB43PxIMO+BHb5sjYGUpJQ9369GZmDzzEgIAJit+dek0Obn019u7U0q
   zXFF/O1PifgfgSw0olbbkz216sXWXOa4yvhXbipvRcnWWYYWSPRicPIgB
   c=;
X-CSE-ConnectionGUID: COjrWgzxS2qBVH8SBH+IoA==
X-CSE-MsgGUID: 9+G7ILc6Tze+/79Je3eaeg==
X-Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=yifei.sun@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr
X-IronPort-AV: E=Sophos;i="6.27,225,1787004000"; 
   d="scan'208";a="306681183"
X-Received: from 193.186.140.88.rev.sfr.net (HELO macbook.tail650e82.ts.net) ([88.140.186.193])
  by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2026 19:21:02 +0100
X-Cc: Yifei Sun <yifei.sun@inria.fr>,
	David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	Simon Horman <horms@kernel.org>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org
X-Mailer: git-send-email 2.56.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