🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23166

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

#23166
From: Yifei Sun
Date: Thu, 26 Nov 2026 16:25
55 lines
10084 bytes
With veth1 on 172.16.1.0/24 and veth3 on 172.16.2.0/24:

  # 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. Fix this by trying the
next alias in the same leaf. The lookup already does this when no
inline nexthop is usable.

Fixes: af7888ad9edb ("ipv4: Refactor nhc evaluation in fib_table_lookup")
Signed-off-by: Yifei Sun <yifei.sun@inria.fr>
---
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.

v2: Reworded.
v1: https://lore.kernel.org/netdev/20261121182031.36626-1-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 @@ int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,
 						     &nhsel);
 			if (nhc)
 				goto set_result;
-			goto miss;
+			continue;
 		}
 
 		for (nhsel = 0; nhsel < fib_info_num_path(fi); nhsel++) {
@@ -1622,7 +1622,6 @@ int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,
 			return err;
 		}
 	}
-miss:
 #ifdef CONFIG_IP_FIB_TRIE_STATS
 	this_cpu_inc(stats->semantic_match_miss);
 #endif

base-commit: ae8e5ef9fa9eeaf4ee0a9a9bde0fc63023d9b154
-- 
2.56.1
Technical Details
Message-ID: <20261126162538.2509994-1-yifei.sun@inria.fr>
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-372222-linux-kernel-netdev=dewy.ru

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-372222-linux-kernel-netdev=dewy.ru
From: yifei.sun@inria.fr (Yifei Sun)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 1/2] ipv4: keep scanning the leaf when a nexthop object is unusable
Date: Thu, 26 Nov 2026 17:25:37 +0100
Organization: Usenet Network
Message-ID: <20261126162538.2509994-1-yifei.sun@inria.fr>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="507275"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:suQSMl6uv/L+nPIZpCSFMIoJMhc= sha256:6VY89XwV7pwdLUeh8MCtq5e/YtJGgIEgUcmI+3QXccM=
	sha1:t9pmj6UF3UF4oM5Gqzs5v1osU1E= sha256:pCFNJX4q/CSQW3xYKUH6Nanbt7uLX04MYXyXth1gC5o=
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 B9E37125EED; Thu, 26 Nov 2026 19:26:39 +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 5HCdF_xs5q_5;
	Thu, 26 Nov 2026 19:26:34 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-372222-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 ECBFB125EEB; Thu, 26 Nov 2026 19:26: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 7287229ECC; Thu, 26 Nov 2026 16:26:17 +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=1795710376;
	b=qMN3CE9IJtmIqwGKVYkDIyGkBw8T7wcuPtJTSRGPxWwopuDLoRxpgokWN8wRGUnPuCDG
	 MUk91/kxQd+ij/WX0vqLt3gLDKlO9oCKd1XApw1wQ3NQTt3FQ0Tf87kswCpnZ1mtPpPmq
	 k6+ll1fu5k/99MEEoX635nhsKeqLIrzxzuZ9BFqWWHsVx0qk6ER+cW4BBdjPW1+450qhZ
	 r99b0+1dSap0aWzc0KAfz481n1C5rsVzVFES9eGWYlFnZ/YgQmWn7b+wck4wUN4bcvV+p
	 AZACwBmD7LkZK3XHkv8NvVg29G3v3UEdOWjerHn2+lg+tQYPiDfuY3CWMQyNRQio+zA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795710376;
	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=TbxJ3LbvU8Nhy28uNO/Ztu+jASIooU9yLHxeJDHUje0=;
	b=jH6j1FDl11doQr2dHGTaM+Ueu9fNPAwkTfHXOVBos2FhLy00vAHGaQtDlF/XWnS7HAYj
	 BLXONG60JD03knaqCgpZfk4S0wX8rGzE0AUUuHlL35OM3WZDDkDC1Hu4uZRGxNuAc2TMe
	 tJbzEsiVtRqHtvl4/i5/R9YmZ0KNABW3HTHgh3tlxyZ19VoPUc5QJTZHh72eskuDn4oM7
	 MD7Q6hgIemKjW7RFpcM4C+8xdh33HH3boUvb59yasXbWqc+Fzcgfx5Hg+49YawiszspVe
	 +MyLBYn+hV1iWICkfwNLaQTDJXNyKAkpbdRGyeaaEnruz67UKncthmt/BKSlWYFa1Ng==
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=poKfav3i;
	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 C0AF3606A332;
	Thu, 26 Nov 2026 16:26:16 +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=poKfav3i
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.134.164.104
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795710375;
	b=evE0HfQq8QTsOzG18j85m9oX/e95qv8WY/695DF0WgRVu+9STkiBoGYIbNSzDC43kEFe
	 8aVfYVLEeJcdndkr0QMLFwZ2H2ypBkeLBH+a48B49n3jCsJr8ylIfwZ7KY3VrvW4TzJqi
	 zkWJncdtmp39VRyCH4o27Io0wLvgSMopzstFmF0yRv8BrQMIPO+4JA5/cuTRGLXPT2sVH
	 OgMZsqhpbvmYf3rZFV6ItPp4VVAsbz6LYKEpVxceglStEG6Mdh+HWD4VAya79KOcCV2YV
	 s2Sg25xjsWRP9dBqpqHSLW5nVXMm3gCs/O8gBUKDRTljcG4rHRmHxM7+1tqljtfSD2g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795710375;
	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=TbxJ3LbvU8Nhy28uNO/Ztu+jASIooU9yLHxeJDHUje0=;
	b=475a79s0ofnPw3fX1unyc8Qd+PKLYmsicvzF1YNbi2LLpv73S4aZfeqBzy54z1wjhdK9
	 1/+Yj8Fjc/oH95769XpFcE/G7slUz0V3uIEElq0jbB9a9yFP348tpdawBeem8I0bMqf6o
	 I8HimKwnu3+OLcONlv4wsK/u7+bpoPiHqeR9sZjv7ppK4YJ5yF+JqAP8TCvQlHfS0LhG4
	 O6PwiUyr8lqoN3jM4AeSkpy/xnnKC875qj+grZXqgK8rvhYyf7sN4hrztLx02464uaQyl
	 koLtQ/rFCqjOmGrtdQ/jM54iFOCchPenjpwW7ink0DS3mkvTx8yF4qWe81AUDnfEchQ==
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=poKfav3i;
	arc=none smtp.remote-ip=192.134.164.104
X-Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104])
	(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 CD871606A31E;
	Thu, 26 Nov 2026 16:26:12 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CD871606A31E
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=TbxJ3LbvU8Nhy28uNO/Ztu+jASIooU9yLHxeJDHUje0=;
  b=poKfav3iC0rNecOR63YPzrbAaWLqYqiPL59gtzwe3JwsFn6LSHI8MK4L
   vOiVEhbg5/oXjAhhf9ON/RNQSzp65DWlU3T25Hn913X5pu/WsFyhHICD/
   RKLBjvUGrp3RGi+Fuj0l8OCFGnpxsAtIJCM1LzdCDcGPEy7tlGWlzUOO5
   8=;
X-CSE-ConnectionGUID: /PIaF0J+SPWSQru3Asdtgw==
X-CSE-MsgGUID: yOLGbBo2RKKP0Mldw/0rKw==
X-Authentication-Results: mail3-relais-sop.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,235,1787004000"; 
   d="scan'208";a="163990378"
X-Received: from datamove-nixosbtw.imag.fr (HELO framework.tail650e82.ts.net) ([129.88.52.51])
  by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Nov 2026 17:25:58 +0100
X-Cc: Yifei Sun <yifei.sun@inria.fr>,
	idosch@nvidia.com,
	dsahern@kernel.org,
	davem@davemloft.net,
	edumazet@kernel.org,
	kuba@kernel.org,
	pabeni@redhat.com,
	willemb@google.com,
	horms@kernel.org,
	razor@blackwall.org,
	shuah@kernel.org,
	linux-kselftest@vger.kernel.org
X-Mailer: git-send-email 2.56.1
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