🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #11297

[PATCH net v2 1/2] ipv6: ignore link state in gateway check

#11297
From: Yaroslav Dudkov
Date: Wed, 04 Nov 2026 19:56
89 lines
14201 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..73d8a2c95602 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3424,9 +3424,9 @@ static int ip6_route_check_nh(struct net *net,
 			      netdevice_tracker *dev_tracker,
 			      struct inet6_dev **idev)
 {
+	int flags = RT6_LOOKUP_F_IFACE | RT6_LOOKUP_F_IGNORE_LINKSTATE;
 	const struct in6_addr *gw_addr = &cfg->fc_gateway;
 	struct net_device *dev = _dev ? *_dev : NULL;
-	int flags = RT6_LOOKUP_F_IFACE;
 	struct fib6_result res = {};
 	int err = -EHOSTUNREACH;
 
-- 
2.54.0
Technical Details
Message-ID: <20261104195655.1406837-2-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-356899-linux-kernel-netdev=dewy.ru
References: <20261104195655.1406837-1-aroslavdudkov622@gmail.com>

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-356899-linux-kernel-netdev=dewy.ru
From: aroslavdudkov622@gmail.com (Yaroslav Dudkov)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 1/2] ipv6: ignore link state in gateway check
Date: Wed,  4 Nov 2026 19:56:54 +0000
Organization: Usenet Network
Message-ID: <20261104195655.1406837-2-aroslavdudkov622@gmail.com>
References: <20261104195655.1406837-1-aroslavdudkov622@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3494731"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:5MTpW+yAV8sT9N4CQe/8l+m2OGI= sha256:wFasVmaT0qgZiGNDVUCFbcmlvpNzOGwAmAvUgPLmIyk=
	sha1:y+VCtlZA5CtYQmGyL3D8FXW23Ss= sha256:yn3OTp+XiMh/dKgAoO5TqnsNYxAbBG1puAtam772bhA=
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 41D80112D9F; Thu,  5 Nov 2026 00:44:08 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 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.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=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 ZueLf2w4Vz6e;
	Thu,  5 Nov 2026 00:44:05 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-356899-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 20380112C86; Thu,  5 Nov 2026 00:43:56 +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 1A86314584B; Wed,  4 Nov 2026 21:06:53 +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=1793822672;
	b=ETBs1DpLcYVbpeLQIrwo6LC5ohRbbEfgnifVeqpwCxISGl/0vzBhvtwfNNYw+CPOqyRo
	 xUjTl/EYvNR+6EyMvYjWoqgH0OE/aFX+EQnukVovh+PXhddM2+rPqcjykAi2EP15wSXb/
	 64Jb4ycVJ44j9MExkL15Jgndy9ZqevOKbxOdsKLOROdXRKFlag4h0Bx6izDtI2KCC2klf
	 gTkIN2MgHB2Il133iK0wNSb1VREu6cNhTVJTxd/I+z0FnfTTOygpUgFpfUjsAE+xNYr30
	 mMBhFYFWESUHduCUSRJHN/oarkxBwNFMuz7gya7KRy2W2ZWqKAiMUW2aVE5bHGsI4wg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793822672;
	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:In-Reply-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=mAUYa7DsnYJVWK5uXvFQ0zTldnyeSGGQ67HR5sn+wb4=;
	b=qXJXMyUNUuIrGuSygFwHkzzDOiG9B7Px5KeYRyqZUgbaE5BU2z4IIJ+N21EIanlhD2H+
	 Tt5fGC9FIH7YejzEqIYXIncRe7T8cydUrP0iEPRACwYuKjv/kMPODgWygj29R9vaBZOIW
	 90z76N0d4EULvFFFIoRzf48uS3iqTPlgR/wRj5upFc6m2YrZ+ZH18wZdlimGd+pQYkUP+
	 dmsOxapChxityWXjrilanK7xAw/sAn/P5/VkSFPST6cU6GbAsHEMkkYSI4NPDTEygPCme
	 nt5TD00uMJdKq8PAr6f+LtVJXeqH0BlkloxMC7Q+jypJxcufM14uLvBEpBtSgoAFU3w==
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=iIGQtM82;
	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 C7EDB607A7FD;
	Wed,  4 Nov 2026 20:04:32 +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=iIGQtM82
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.178
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793822672;
	b=hOM192gir7vbwqydfuyIhDOILFjQn0BEsX+TDrmXAL5h3fhTIH0bctxil8dC9CR357Sp
	 x8gbjR1STMxiHe48L6yzZZ+z2Xv7eXzWsjWqZhXQvscLLF9RwK0gwCfdupVFxB9eRGGX3
	 70Y/A8JwAEwpsv+CzpEByj3FTP5/YChbVPj8RS3T2RUUxWn8vTVgXSrcPuBM9itlVjRqg
	 8lE1S4r7CbFuuU8D8QOiL9ml9iW4h+6DLsv/02iXRNCDEjFE9Tg+RDQ586mW4K5lWJHmA
	 MKuJaPlMHDwlAvDcJXU0/8P8fYVWpQrqpcLjhyhVxjxg/PFff+EvUKU7048kHyofPiA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793822672;
	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:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=mAUYa7DsnYJVWK5uXvFQ0zTldnyeSGGQ67HR5sn+wb4=;
	b=x9XdsNDDXayq+BW80bCbZHJZVQYH3ZL8dEcyCqAIao7ceUP9oRzn0fQWAO+ChqNRNX2Y
	 SYyeD9gl+8Ih4s7CBmSoRsNSp3goFsEdvUJdTJmuJqsY5u8MEZ6AkY1dp7TvyQoCFvmMj
	 pXKJ+qQ9avDrIjaShV4A3kIoLCzfdjqKUzBxmFCydu0RBcKO5WKCC7w1W7AftrGPVRth3
	 wGnHdAPqkstzIvp8G84//pa0DkKPf++sVPm0SJ+JIAvpRslAoof7tc7xW7NrruNm90TYr
	 lemBot0LlgDcBURv0zLhKqiHzxswi6eciRS0r/ZtRuvwKrSAy4ju/EsraIxpXvguD5w==
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=iIGQtM82;
	arc=none smtp.remote-ip=209.85.208.178
X-Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178])
	(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 97B51606FACE
	for <netdev@vger.kernel.org>; Wed,  4 Nov 2026 20:04:31 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 97B51606FACE
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-lj1-f178.google.com with SMTP id 38308e7fff4ca-3ab39af88aeso14371191fa.2
        for <netdev@vger.kernel.org>; Wed, 04 Nov 2026 12:04:31 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793822670; x=1794427470; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=mAUYa7DsnYJVWK5uXvFQ0zTldnyeSGGQ67HR5sn+wb4=;
        b=iIGQtM82BiNLyonv+Vl1VspuOaMrUC9/Ps8jkarVh6KbuKTW0cgRyFG3800Y8PBh94
         0O1TWzSF/QTQci3Jk8AyntkfwTrPK+ONyfVuEcW5cRCww6IwspuYxE6yDuZO/To2EWNB
         SExxL0YrZIYwTAFcBxjHG/uRDjSNW/mA7AME+Q3Z7c7217QIh1j0Ie9cf+jgYRxX6wn3
         0CP8WkGxtJawP+paRtQYxDz+iqhcbKsDOFdDCIiSrryfAUVwYa7zt0xC2AbpU3KnJCHW
         P9MGnd0HI+2n2KJKUS6Mvd95vktqGYhifeMI/55MUHToq+3/nMCk15kwgFdTtDAF0d0k
         l3RQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793822670; x=1794427470;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :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=mAUYa7DsnYJVWK5uXvFQ0zTldnyeSGGQ67HR5sn+wb4=;
        b=Gs056xUdHVrBD0CuxxFORkIoQA0V4GN2Wh8qaWsejFe1Nza6+EgkJB1FAaHYZId9tc
         D/NE+a4739ddIuVeDJbX7cDK1Jz/wufx1zdpzebYY8WAM40UrqnTkZsEbwW7m02bWotq
         1H9PhaoGXRjMGqx0PCdb+MGlgPO1FWCOiNb+v0MGAHS+qZG7Rg2GZaATRxQ/u8ZbSeHY
         TkSU8n4748lSeKMZdZTL+oNx1Jc3LoBwbBWewjMkEdtwbTA4/qTYSVZrDH1UsHYeVatW
         18BFmtN3lYZPJCJlKhGDb9Nkiv6WPwdPwd0iNT8g9vFf6gd6R3hKxC9urRY1pJrG2sZk
         dslQ==
X-Gm-Message-State: APuU4Z8pbBUus5/mSAr8d5aYIaJKTN1FxKt7DXR4Q03NIUyyC40NED9E
	rnrJ3+m9LayuTlp5RxItCEA+RJXMnkqKmyRSuUPaM+IuNHqKlD/bK16YeIVyikNxFw0+XQ==
X-Gm-Gg: AYBFou2HCgEwCFhWj/0rOdPFhoYIWixKk3iwWlWM0CCI2H36sw38XkidvfR/2hXmmXa
	MJfQcjGcyMBPEeg1gU3tISyE5ND0kvyCnJbkZ407FW2tyY8sGfhm01Oq4IDF0tlYwetaTbEpSCM
	94QUIRfrrwREERs2FfOP8egwbq6ezodf9ARKCQF43ws+/0nRh9HKKuDuV52j4lIlcsoF9FSiWb3
	5vmwWnZdgSUzHogm0SRInHxodse64Pnd+2n91sZF6wRgtlJVCWSHuz7Y5skSLKdh570LjX4SzGZ
	N3uB9LqaJh+Bb2yJ8GxplkBrsPyVisx/tFJNG0nidpYjzM06TLLomv2TfVV3N6eztj3vzUOYcg5
	NvEaPHSdPIMncl6eAqyoABd+sa/3bPqAhbcDxFtRMLTesRgsU+1O1G1liWllSMDU+xB5tGrMz5X
	HDutUguac3NicSHl2ppxVURqn6izgxkcrw/pk8A0W0On1l+TyNxPsNhmlfR641qnewfblYnNsCM
	3IpdLj2GL4tiJpygP1B6DcXLgbXPeEiw9ZhiYcUrNKYrpBOjhG3DToelWI/qnXz39UCddJKVlFy
	8tr13bnC/vEA81IzDoSXUSgvJQU847rm165qxCBOyCahlelGOfA=
X-Received: by 2002:a05:651c:43d1:10b0:3ac:cf09:d6ff with SMTP id 38308e7fff4ca-3accf09d9c0mr17250161fa.24.1793822669498;
        Wed, 04 Nov 2026 12:04:29 -0800 (PST)
X-Received: from gentoo ([95.55.209.127])
        by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-3acdc6e9b60sm5848021fa.35.2026.11.04.12.04.26
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Wed, 04 Nov 2026 12:04:28 -0800 (PST)
X-Cc: dsahern@kernel.org,
	idosch@nvidia.com,
	davem@davemloft.net,
	edumazet@kernel.org,
	kuba@kernel.org,
	pabeni@redhat.com,
	horms@kernel.org,
	shuah@kernel.org,
	weiwan@google.com,
	linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	Yaroslav Dudkov <aroslavdudkov622@gmail.com>
X-Mailer: git-send-email 2.54.0
X-In-Reply-To: <20261104195655.1406837-1-aroslavdudkov622@gmail.com>
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