🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #8283

[PATCH net] ipv6: ignore link state in gateway check

#8283
From: Yaroslav Dudkov
Date: Wed, 28 Oct 2026 15:26
87 lines
13892 bytes
IPv6 route cannot be added in table when all
following conditions are true:
- gateway is not link-local address
- ignore_routes_with_linkdown=1 on device
- nexthop has no carrier
- gateway is not present or covered by any route in table already
Also multipath routes addition is invalidated by kernel even
if only one of added nexthops satisfies all above conditions.

Reproducer:

  ip netns add t
  ip -n t link add va type veth peer name vb
  ip -n t link set va up
  ip -n t addr add fd00::1/64 dev va nodad
  ip netns exec t sysctl -w \
    net.ipv6.conf.va.ignore_routes_with_linkdown=1
  ip -n t -6 route add 2001:db8::/64 via fd00::2 dev va
  # added
  ip -n t -6 route add 2001:db8::/64 table 100 via fd00::2 dev va
  # RTNETLINK answers: No route to host
  ip -n t -6 route show table all
  ip netns del t

Route should be added because:
- RT6_LOOKUP_F_IGNORE_LINKSTATE in commit d5d32e4b7668
("net: ipv6: Do not consider link state for nexthop validation")
was added for this
- the same route is valid in main table (when no specifying table id
while adding route)
- fib6_nh_init() initializes nexthops with no carrier
- IPv4 already does this (fib_check_nh_v4_gw() ignores link state
using the FIB_LOOKUP_IGNORE_LINKSTATE flag)

Before commit b2c709cce682 ("ipv6: Convert gateway validation to
use fib6_info") rt6_lookup() was used for checking if nexthop is
valid, rt6_lookup called rt6_device_match() which does not check the
link state. After change rt6_lookup() to fib6_lookup()
find_match() under fib6_lookup() started to invalidate linkdown
devices, because RT6_LOOKUP_F_IGNORE_LINKSTATE is not passed to it.

Adding RT6_LOOKUP_F_IGNORE_LINKSTATE to flags for ip6_route_check_nh()
solves the problem. RT6_LOOKUP_F_IGNORE_LINKSTATE is already used
inside the first search ip6_nh_lookup_table() and fixes the
bug in second search fib6_lookup(). Also RT6_LOOKUP_F_IGNORE_LINKSTATE
isn't read inside fib6_select_path().

Fixes: b2c709cce682 ("ipv6: Convert gateway validation to use fib6_info")
Signed-off-by: Yaroslav Dudkov <aroslavdudkov622@gmail.com>
---
IPv4 example of this situation:
  ip netns add t
  ip -n t link add va type veth peer name vb
  ip -n t link set va up
  ip -n t addr add 192.168.0.1/24 dev va
  ip netns exec t sysctl -w \
    net.ipv4.conf.va.ignore_routes_with_linkdown=1
  ip -n t route add 192.0.2.0/24 table 100 via 192.168.0.2 dev va
  # added
  ip -n t route show table all
  ip netns del t

Also when adding RT6_LOOKUP_F_IGNORE_LINKSTATE to flags of
ip6_route_check_nh() makes adding this flag inside of
ip6_nh_lookup_table() unnecessary for this call, making another call in
ip6_route_check_nh_onlink() with flags=0 the only place where it is
needed.
---
 net/ipv6/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 94e5ef1c4f83..95d7b5b10e51 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3426,7 +3426,7 @@ static int ip6_route_check_nh(struct net *net,
 {
 	const struct in6_addr *gw_addr = &cfg->fc_gateway;
 	struct net_device *dev = _dev ? *_dev : NULL;
-	int flags = RT6_LOOKUP_F_IFACE;
+	int flags = RT6_LOOKUP_F_IFACE | RT6_LOOKUP_F_IGNORE_LINKSTATE;
 	struct fib6_result res = {};
 	int err = -EHOSTUNREACH;
 
-- 
2.54.0
Technical Details
Message-ID: <20261028152634.3355852-1-aroslavdudkov622@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352912-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352912-linux-kernel-netdev=dewy.ru
From: aroslavdudkov622@gmail.com (Yaroslav Dudkov)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] ipv6: ignore link state in gateway check
Date: Wed, 28 Oct 2026 15:26:33 +0000
Organization: Usenet Network
Message-ID: <20261028152634.3355852-1-aroslavdudkov622@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1801738"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:UgneyvHze7qphLO6VIj9YthU3uU= sha256:QCgs1yoAY3xR/SW5OJ/VFC4vl4VV3Q1SG8SF/vCAJLQ=
	sha1:hzPFTDlvUkcpNWlH4MStaw4d+QA= sha256:ppcNhqMPOKrLoM2sK3bS+sU1EytFWBBnf8oL7hvRiO0=
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 3A4C4125C38; Wed, 28 Oct 2026 18:38:25 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 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, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	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=gmail.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 w03jqMiGfODs;
	Wed, 28 Oct 2026 18:38:18 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-352912-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 05E42125C33; Wed, 28 Oct 2026 18:38:09 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 967F5305AD; Wed, 28 Oct 2026 15:32: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=1793201566;
	b=jpEo7BgiIxZIFsHTHtHxXCIq9rrbKsSQlMV9IfefRnHnMjjRsYNdJx4tkBLtj/jQwwXv
	 gatIRUYYCfyN+UD6XjBeXzOx+wZSA+PwZP9DHYRB9q6x3laPvDj9xMW4kOnqx9mEItHYB
	 HqewHSjBNgMC0q4dW4MyToNh5elDWGv+hNS9v9dhhprEWdW9qEbph6T71K5lvgZFsLo5k
	 PbU2dTUzajybsuuk94tic0ZnQtM79S4bO1qks3CwaupFc1TL3VAlbJ0KT9oAgIfFk8HJI
	 gIuaBsfjIfMPZHuwb6kpO/9gyn5dSYZ/IB8B4Nu9ws/jV2OMYaAI2DWn5C236wh1qeQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793201566;
	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=4CoutM7AnpgKYRtmRzJTqqEDXmlCJEKKkP9PY75AExE=;
	b=FMajwZSy8cc5CC6yTuVoKRZEaPoqRXpytff+YRdt/ieHPOhwcDtDfzcbg2IrpaWxntH8
	 R7lHoBjlPYaTUmJKzQ/tHDjqumlqgqZsAHcyEKjXHbZXIFJxbC61zunUqB10VTbiSwi6a
	 zCeVFygBjtJDXSLqhsXTaL2NWnT7vjUsgbBleu5kAT3493k9xjZ98M4R/RFm8tWXN+aD+
	 CmHUgM910GWPWR3xYVarmbvbdX6nWJipDf5Cz3sgDxeKJlzGpFH+uzbICeeJRSyxzXYIR
	 J1PBUa6vu01Aq6XAQV02nx52wiH336nUi94WYq03gR7vTczrN0TnIKwEWyQH3rSHngQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=heXmpuck;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	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 5E6CD606A326;
	Wed, 28 Oct 2026 15:32:46 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=heXmpuck
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.167.47
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793201565;
	b=hmoWe8TEUaZAUj5hlyUDYAlydfG3PNSg9oeQtxHZ6rc0uEB1Dz+BeH6DMBreSl3SioyG
	 un3K55zJpaiii9edkRrhKZUcMtaTZhyBUFtkNhISHYrr9UYwQ56po08+OzfWHylnJOjHM
	 Rb0I4AfXHmmG8k/afKjv1QLSqI2/Mo09bvnyFaYncoG/eVlzPFWdTtkc7UrZiPkAMVzyW
	 QdOOdZH4E1iFsWxjCO0hX/OQUW0SlO8vidCUsCCVJ8B7kspy8FO3wUH4jLGWrzsCqmhRE
	 0t79ZVUjRgw+Q3JsuV5r969jTNGrrnPOiYkNiIWLYrJIoWDao27ar6PDbePcHyc7yjQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793201565;
	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=4CoutM7AnpgKYRtmRzJTqqEDXmlCJEKKkP9PY75AExE=;
	b=XYHkNNINSNpvUo6FyiFtFH1QEAnXDeJ1ka4qJSClwqCZWVrFCE0EMM82aS+m6lTFt0D6
	 PQ+MN5NyPirmlA4M/oV05h8/uwwiWWAyIcNeTIL+eyougzzotosepe/jPsJ57XOw6Mt75
	 ZwDkctMzFvwZZKuENfk5EYhHa4tBsua3PqoKTrmKkjeO8qF8ri2cv3M31pQgC4ERNmCo9
	 HU/+B3eO2zWgyvERS0O8j55XjzHIEGCZrplrRLfCpaJWoJ4ix7XPTmDOmNvQ+1npYR4aI
	 FUmlBaKzcdkig0gZkDt/OjVfwuBHUp/KNwp+eAIUZtrqhyjMUDjepDDhAhLOjw8n0mQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=heXmpuck;
	arc=none smtp.remote-ip=209.85.167.47
X-Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47])
	(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 2029D606A31D
	for <netdev@vger.kernel.org>; Wed, 28 Oct 2026 15:32:44 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2029D606A31D
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-5ba328513b9so1247611e87.1
        for <netdev@vger.kernel.org>; Wed, 28 Oct 2026 08:32:44 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793201563; x=1793806363; 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=4CoutM7AnpgKYRtmRzJTqqEDXmlCJEKKkP9PY75AExE=;
        b=heXmpuckafKBBzZLru5IJ/va5qQlYdgMLi4tTuQgsejbiQrUne3QPPyo712jMF2Ws4
         naqfFmSORKdP82ovy4Ddq1iqs/GTETMzgJpoGjvxVkpGjU4fB478AMI5cw3W3CWPR7iM
         zWNm4UwcQFxHl5pixyIN94gJyr8hOyOKhwIuB2lsyG2ZnQrNTQc8aUGZEOX7iB/iCyWy
         3UUjNMTeKU4lnIvCddt6IJPdV8EqwWrNuoMnS1M3t0Ur4zoi0Rrp47BfBLjlsiSM1yrE
         6/GxNfUedNV7z4In+zUU2LQT1KvNVxGdkbqzG2wlN/C1B3lf7dmwR+gcLdvP7hHJoypa
         Iyug==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793201563; x=1793806363;
        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=4CoutM7AnpgKYRtmRzJTqqEDXmlCJEKKkP9PY75AExE=;
        b=Bv+Xm9SUvd7HLemyspR4v0ylJ/cltII2IDtQ6SaRnYyR11So7wn/qDeZDrYe1GDDbY
         4bJisaU/yximAeZxKXHJRDwm9O8f7Oq+fOnZHfFX3viQJHOWuj1HDNiFVxtXZgeI+ktw
         HASTgq7TG8PcRd9TmvARbkfnbHi3vvBqkobDI2ovBDq34kZsG4W9d3GQQs07aLZ9GiK2
         2WEfIeZGgHRp2ULfY909XaHXqu6OAY+qwJ1IpZZ7QP7UYVRAIO/a0spOBXDO75+y/ist
         praKRtAnAJfEpJyynyT1HfrknVst0zAFg46iGCTLJXYr2oYtmWEO+PyCKqDwRGMotmc+
         N/aw==
X-Gm-Message-State: AFq9FYKIPx/hXsYg/gjZWRvzTUWSBxJOasem2K5cN+ZKnQuUbmF9geDt
	wFO8gX9ImvRaLUTJCvgkHvUP6zAG7rFVdT0g8pKq45InqVYbwjiUpe0lS62XYISEYQ0=
X-Gm-Gg: AYBFou2y/qHhz2n26vpLL1Vtp8QApStl9v6KE7ESTNdkNk/wQX3SpctEPf7KB6rRH1s
	oAU5wcMCAa/sFES97tX2uSiI3rY9Mca8sb3uUIIZqIEr+HgcMTXpGxiAZyMG4Js4U0WRIcvrCCG
	TSrQ3itqlKqQmX6irqO/2kUYKS0L/u9Gi3lFD2sqKA9Te9XrEfkPWWl9Kq/HfI7Vr3v7wFiS69i
	nzvLqcYKqwJLI6UgA7KmWRnet9mxcwXtf3EawRQRUdGrKzhuG8ju8nqSFW/z1XVv60fnmMdVJTl
	EVIYpJVq840f/Iq/RD0Q7XXsOyFUU6OcNSa8iEO6w0sATsidGnxu5DMes0srtSPY/I9VXqeOxO+
	9Q3/svjG+xq6BSmRkioxTV74to7cNO5b3inlhg6YwTSY/3tL0f3BGNxbvuiVqpCLOADZ6iCdv9F
	+X1q5y3MuZW9pYFo/12JoRqpXJp8f60HJ/FlxO352rQQ1cexPmxixqtYjaEW3YVV6tw0CRmjf60
	jjnT6jcyZATXDv5FswRJIieW3U1CFQX6Qv9YePeoxpKxpSbnZKowgQUvuGyQqp+EvvvzNO1AHtr
	DpxqnPYsfWd6sJ2/cufww9uOVbo=
X-Received: by 2002:a05:6512:6cf:b0:5be:5d8c:85c7 with SMTP id 2adb3069b0e04-5bfcad4329dmr1063224e87.24.1793201563041;
        Wed, 28 Oct 2026 08:32:43 -0700 (PDT)
X-Received: from gentoo ([178.68.9.68])
        by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5bfca57ee5fsm669346e87.32.2026.10.28.08.32.41
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Wed, 28 Oct 2026 08:32:42 -0700 (PDT)
X-Cc: Yaroslav Dudkov <aroslavdudkov622@gmail.com>,
	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>,
	Simon Horman <horms@kernel.org>,
	Wei Wang <weiwan@google.com>,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.54.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