๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21808

Re: [PATCH net 1/2] ipv6: check the scope of the best source address candidate in a VRF

#21808
From: Nicolas Dichtel
Date: Tue, 24 Nov 2026 13:55
53 lines
13599 bytes
Le 23/11/2026 ร  15:30, Vincent Jardin via B4 Relay a รฉcritย :
> From: Vincent Jardin <vjardin@free.fr>
> 
> When a packet is sent through a device of a VRF, ipv6_dev_get_saddr()
> first checks the addresses of that device and of the VRF device.
> It stops there when the best of them has a scope that fits the
> destination.
> 
> Since the commit abb9a68d2c64 ("ipv6: take care of scope when
> choosing the src addr"), that is what the scopedist of the best
> candidate is tested for.
> 
> scopedist is only written when the rule scope compares 2 candidates.
> With a single candidate, the rules stop at the first one, which only
> tells that there was no candidate yet, then scopedist is read without
> having been written.
> 
> It is 0 with CONFIG_INIT_STACK_ALL_ZERO, which passes the test:
> a device that only has an IPv6 link-local address sends to
> global destinations with that link-local address,
> although another device of the VRF has a global address.
> 
>   # ip link add site2 type vrf table 30
>   # ip link set site2 up
>   # ip link add dummy0 type dummy
>   # ip link set dummy0 master site2 up
>   # ip addr add fd00:91::1/64 dev dummy0 nodad
>   # ip link add dummy1 type dummy
>   # ip link set dummy1 master site2 up
>   # ip -6 route add fd00:93::/64 vrf site2 dev dummy1
>   # ip -6 route get fd00:93::1 vrf site2
>   fd00:93::1 dev dummy1 table 30 src fe80::5cb7:13ff:fe96:87ac metric 1024 pref medium
> 
> When the scope rule does run, scopedist is negative, whether the scope
> fits or not: the test fails, and the other devices of the VRF are
> checked too. One of their addresses can then win on a later rule,
> the longest matching prefix for instance, over the address of the VRF
> device, which the first lookup is meant to prefer.
> 
> So let's compare the scope of the best candidate with the scope of the
> destination instead.
> 
> This issue was found for a development of a UDP tunnel device with
> IPv6 addresses in a VRF selecting an IPv6 link-local source
> address for a global destination: then it was confirmed with the
> fib_tests.sh case of the next commit, whose first two checks fail without
> this fix on a CONFIG_INIT_STACK_ALL_ZERO=y kernel.
> 
> Fixes: abb9a68d2c64 ("ipv6: take care of scope when choosing the src addr")
> Cc: stable@vger.kernel.org
> Signed-off-by: Vincent Jardin <vjardin@free.fr>
Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Technical Details
Message-ID: <8f0c4cb5-8754-4636-abdd-ccec7ad5d932@6wind.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370398-linux-kernel-netdev=dewy.ru
References: <20261123-for-upstream-ipv6-vrf-saddr-scope-v1-v1-0-f667ab150ade@free.fr> <20261123-for-upstream-ipv6-vrf-saddr-scope-v1-v1-1-f667ab150ade@free.fr>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370398-linux-kernel-netdev=dewy.ru
From: nicolas.dichtel@6wind.com (Nicolas Dichtel)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 1/2] ipv6: check the scope of the best source address
 candidate in a VRF
Date: Tue, 24 Nov 2026 14:55:25 +0100
Organization: Usenet Network
Message-ID: <8f0c4cb5-8754-4636-abdd-ccec7ad5d932@6wind.com>
References: <20261123-for-upstream-ipv6-vrf-saddr-scope-v1-v1-0-f667ab150ade@free.fr>
 <20261123-for-upstream-ipv6-vrf-saddr-scope-v1-v1-1-f667ab150ade@free.fr>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="4148696"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ZscTDLKsUtSre8NYFng+sKhzICg= sha256:Xx//lHTH94LolSjrqEMROtkaAYeyWePoCblXjcR13og=
	sha1:kC1fHBvZy6ZBuroE+LTpZLRuRps= sha256:iXZGbE6oqTualtc9Q0QKWPMlSwnenXrrF7GiMwbgU/I=
Content-Language: en-US
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 E545E125E1A; Tue, 24 Nov 2026 16:55:44 +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 (2048-bit key)
	header.d=6wind.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 Tu9_Mn_myXoa;
	Tue, 24 Nov 2026 16:55:41 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-370398-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=6wind.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 3FCC2125E16; Tue, 24 Nov 2026 16:55:32 +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 34BA723F30; Tue, 24 Nov 2026 13:55:31 +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=1795528530;
	b=A0uwauHatF4dLYxgH9NKGK1GRsSAD6ram3xxMNTlRoDCJL+gWcmMn4yy5fYngWXAyh2e
	 /7/Am1aFknokwJcnuC3ZGrS6Hb3/0VmlGP2x8rct1Hrs2mEcyNkqa4BfA08qJAIzz5XL9
	 0ZNmYBY4iMgQvKzDhTdte34ywu4F5EsGwJ2hEbBCxlnx9sSXFEj+7S/N4Ch6nDavHJiJ5
	 lW4EQijCzGzyHSGYVisKjckr9Dw/brqDk2RERH5S8/gA1kyikDSODKiVucMIlCwbE1tHR
	 hcGDjie5cTihh+9B/C8BHxgMMskfYPjdtl9QSHAwgsULauB+eMnr/gOJEkyzHhgbjng==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795528530;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:Message-ID:Date:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 User-Agent:Reply-To:Subject:To:Cc:References:From:Content-Language:
	 Organization:In-Reply-To:Content-Type:Content-Transfer-Encoding;
	bh=I1beTTuDkHcJrFtkrdIEDwGOge1ar4jfKSDiYm+SAes=;
	b=Jv0wpLya5oFQaVBp77Ir5ECgGA7lEphm51NK8LxfoBIKUIM0Cgq/ztEDxOo5+s5hidrX
	 5VdTqAUfLboDDbhtAU3lyAutXJyEj9DNxrGpBQTAYN3WrWyIWD7ux5XF5LpioyWbM2lUu
	 juCMENNU+BVpN1HnUN3/SE0rP4ocfjGukoVn0lgsMUJkF3TOSstFDohtSjlutwbLiAHIW
	 A8a5Qq9bOPL20/dmKP+ezp0IZuXrj089qIcAv0xrCoDsXw/ZJDzFk7JaKrtLdKmmKpego
	 trxlTLTBRpA6knnaKnqqVd2PS7Rn9DRBe8dJ85o9z0B2JyB+CKaL+vm+3xVs3h7Pb+g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=6wind.com header.i=@6wind.com header.a=rsa-sha256 header.s=google header.b=Y2bsdeUG;
	dmarc=pass header.from=6wind.com;
	spf=pass smtp.mailfrom=6wind.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 C5763606A330;
	Tue, 24 Nov 2026 13:55:30 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=6wind.com header.i=@6wind.com header.a=rsa-sha256 header.s=google header.b=Y2bsdeUG
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.49
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795528530;
	b=ZZRLSdKCEr0gs4JUFOk2Xta/xPdjGWE/Gp365IMnHCnhc1Q7ap80YT5EO9XFm8bNUsZN
	 Y5Opdy04i1T58RRulYt4leW8hftYcwuycv9S5ygUDWGW3nWVVLGMlF6hGh0UnS6l0daNS
	 67xnsJmvxidYmdEQj7wBrPgFgBLwgS0N8UPbkjFN1oPbCBYuNY1ENqH1zkWK1vlsLt8Am
	 /zJmnlmyrTJGr8m4Cqn7GJOdznu+wnmV/71+d415MEwuf4FkdNhGto1E4ISH4sgUaBG/e
	 gZ/hBSIrlZ1anX6SzbbxfwyPvur4/cYbWrl8SZbPQYwRaCJSLAee34mqf3KInnEMlvA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795528530;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-ID:Date:
	 MIME-Version:User-Agent:Reply-To:Subject:To:Cc:References:From:
	 Content-Language:Organization:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding;
	bh=I1beTTuDkHcJrFtkrdIEDwGOge1ar4jfKSDiYm+SAes=;
	b=G3SL2ykWynZhI9oRNxZyKcxEyavb+93o5Olpo6z9RzMfhJeh6Y4lSfy0uW4Iw7JBXSvT
	 iujDQ5pPr2rz0kXesOfoq80XUaDeLFQJ0OqRRvRwNjdygwLSqLDQGz7cBLzSagnUUJqoP
	 67lB/IpYff+cUENZIu/3RQU0RTsUZlwsItIFIFfzl7KTQB/rT4hiu8RFlBlW/XldUJpn0
	 N6CqInhCS4xtOdpTev6VqrEoSd0QETlwSyFIt2pOLQ8eheuwbVM83jzo9BtcIa5jA8dB6
	 xWmmiU9fjBxLL36aYfiTzlKhAXgaCQTo4qJfQwaBFtFieuv35WffpsPEqdK4aRVNzVQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=6wind.com;
	spf=pass smtp.mailfrom=6wind.com;
	dkim=pass header.d=6wind.com header.i=@6wind.com header.a=rsa-sha256 header.s=google header.b=Y2bsdeUG;
	arc=none smtp.remote-ip=209.85.218.49
X-Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49])
	(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 C811C606A31E
	for <netdev@vger.kernel.org>; Tue, 24 Nov 2026 13:55:28 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C811C606A31E
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=6wind.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=6wind.com
X-Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-c408e21e8acso74159066b.3
        for <netdev@vger.kernel.org>; Tue, 24 Nov 2026 05:55:28 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=6wind.com; s=google; t=1795528527; x=1796133327; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:in-reply-to:organization
         :content-language:from:references:cc:to:subject:reply-to:user-agent
         :mime-version:date:message-id:from:to:cc:subject:date:message-id
         :reply-to:content-type;
        bh=I1beTTuDkHcJrFtkrdIEDwGOge1ar4jfKSDiYm+SAes=;
        b=Y2bsdeUGRkhvEwUU7zA+Ccwi7nQaUwSHzxZBaZ4811Twitth90vemfuauNp3AqPTj5
         FzQ2ayO2yIqj2+f5itd7nxfGgGmg46Y42OdYNwLVeKI1BvNLReA7ROzQg5P5QM1jfE+x
         ERu6bMFz1PNLPKVM/wxS0Z1Ggk2SW9lhivGplwZnVpSMC5fdYcuB/Cn9qGdq4URirwED
         van4HZN7J1SKjJ9KU/JspZfLnbHYMonP2cokgyoMnPREAQDWLkuFpvMwLbwyKFxv/WZy
         DH7TB2xui6Lg3bS8WmzuzW2wxpA7MXXUCrNaKcxy+XTz28I3PPQMyWL6amYPir4Ud9ax
         32Kw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795528527; x=1796133327;
        h=content-transfer-encoding:content-type:in-reply-to:organization
         :content-language:from:references:cc:to:subject:reply-to:user-agent
         :mime-version:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc
         :subject:date:message-id:reply-to:content-type;
        bh=I1beTTuDkHcJrFtkrdIEDwGOge1ar4jfKSDiYm+SAes=;
        b=y3c9APobbxmxt6Vq1Dq0ZOSOoW95FUJj58SJ8MlomSBtF+XxBW24D72SySo6mqhB7m
         d8C+7Ac9oNlIfw4ZCyfIu51WKwCVLvh6uoOOLaDW610JXTNyQlk3RfXwx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OQCnt1bd0ojGRqqJfQUkjwg=
X-Received: by 2002:a17:906:2b5b:b0:c29:4634:5c8f with SMTP id a640c23a62f3a-c513a284994mr1056327766b.0.1795528527042;
        Tue, 24 Nov 2026 05:55:27 -0800 (PST)
X-Received: from ?IPV6:2a01:e0a:ab7:2110:6a1d:efff:fe52:1959? ([2a01:e0a:ab7:2110:6a1d:efff:fe52:1959])
        by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ad01afbsm518330366b.5.2026.11.24.05.55.26
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Tue, 24 Nov 2026 05:55:26 -0800 (PST)
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
X-User-Agent: Mozilla Thunderbird
X-Reply-To: nicolas.dichtel@6wind.com
X-Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
 stable@vger.kernel.org
X-Organization: 6WIND
X-In-Reply-To: <20261123-for-upstream-ipv6-vrf-saddr-scope-v1-v1-1-f667ab150ade@free.fr>