🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #1218

Re: [PATCH net v4 1/2] net/rds: keep the connected peer's scope id apart from the bound one

#1218
From: Simon Horman
Date: Fri, 09 Oct 2026 11:57
40 lines
7508 bytes
On Wed, Oct 07, 2026 at 08:14:25PM -0700, Allison Henderson wrote:
> rds_connect() has nowhere to keep the scope of a link-local peer, so
> it stores it in rs_bound_scope_id, the scope of the socket's own
> bound address, for rds_bind() to check a later link-local bind
> against.  That field is then also what a send without a destination
> uses as the request's scope, what getpeername() and recvmsg() report
> as the peer's scope, and what a later bind() overwrites:
> rds_add_bound() stores the bound address's scope unconditionally,
> which for a non-link-local address is 0.
> 
> So after connect(fe80::x%ifA) followed by bind(global), a send() with
> no destination asks for fe80::x with scope 0.  rds_conn_lookup() keys
> on the interface, so that finds or creates a connection with c_dev_if
> 0, which the TCP transport then tries to connect through
> sin6_scope_id 0 and tcp_v6_connect() rejects for a link-local peer:
> the connected socket's data is queued on a connection that can never
> come up.  In the other order, bind(global) then connect(fe80::x%ifB),
> the connect leaves a global-bound socket with rs_bound_scope_id ifB,
> so sends to other link-local peers are refused as off-link and sends
> to global peers inherit a meaningless interface.
> 
> Give the connected peer its own rs_conn_scope_id.  rds_connect()
> records it there and leaves the bound scope alone, rds_bind()'s
> connected-socket check compares against it, and the destination-less
> send takes its scope from it - falling back to the bound scope for a
> non-link-local peer, so that send() and sendto() to the connected
> peer compute the same scope, and so the same connection.
> getpeername() reports the connected peer with its own scope, and
> recvmsg() reports a sender with the connected peer's scope when there
> is one and the bound scope otherwise, as before.
> 
> Found by inspection while reworking the sendmsg connection cache; not
> observed in the field.
> 
> Fixes: 1e2b44e78eea ("rds: Enable RDS IPv6 support")
> Assisted-by: Claude-Code:claude-fable-5
> Signed-off-by: Allison Henderson <achender@kernel.org>

Reviewed-by: Simon Horman <horms@kernel.org>
Technical Details
Message-ID: <20261009115711.GZ83879@horms.kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-343612-linux-kernel-netdev=dewy.ru
References: <20261008031426.1142344-1-achender@kernel.org> <20261008031426.1142344-2-achender@kernel.org>

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-343612-linux-kernel-netdev=dewy.ru
From: horms@kernel.org (Simon Horman)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v4 1/2] net/rds: keep the connected peer's scope id
 apart from the bound one
Date: Fri, 9 Oct 2026 12:57:11 +0100
Organization: Usenet Network
Message-ID: <20261009115711.GZ83879@horms.kernel.org>
References: <20261008031426.1142344-1-achender@kernel.org>
 <20261008031426.1142344-2-achender@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="1101556"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:JsEHFVU5XvhyfjPh/uizzrGXQjA= sha256:A7oXzVZ2cQIZ2UDM8aplKd9Tvz6kehrmW1+hZzBzf+A=
	sha1:sOF/YwDYoY0+ygGqfMHpGniyo6g= sha256:sGlBEkpjNU2hWRP2xAb5u9u7XuosG63gUc4ZB3yGIX0=
Content-Disposition: inline
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 1D01A10F682; Fri,  9 Oct 2026 15:25:36 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.341
X-Spam-Status: No, score=-1.341 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.241, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, 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=kernel.org
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 yZaQ-GiGVTm8;
	Fri,  9 Oct 2026 15:25:28 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-343612-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id A06E710F66C; Fri,  9 Oct 2026 15:25:24 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by tor.lore.kernel.org (Postfix) with ESMTP id E57BD60F25; Fri,  9 Oct 2026 12:03:03 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id EA1A34E322C;
	Fri,  9 Oct 2026 11:57:21 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="onxaaafG"
X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id C704E4DA9D2;
	Fri,  9 Oct 2026 11:57:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791547041; cv=none; b=SUmfgkoLHcVZQTMna6nQAj0hPcW0fKMMZtupPA9GOiOzoIxnawF4SKhzZdPJeQtIiuBLpU6vpJ6DNONSLbAhGWCcwFGDbgjnA3BRTX0RwZYW2Q8F20S8KOy1iZyFI1UW3aKg1ZaZltvTh59NVLe+t80/XELKFqPgNo8a864/Tl8=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791547041; c=relaxed/simple;
	bh=v84WXKHBRkIPKMIRWCyBoGuMhQh2i5McFvIimU6RjvM=;
	h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
	 Content-Type:Content-Disposition:In-Reply-To; b=lkSKZ6W91RCdSGocJB4y+fE3QZHYfZzxsJYOs2Gm0KzpWBPeGiaF7exXgpfxCLqL5wDnaPpkBiqyKYzZ7fiKLjvvwwV5hdBnn/g+TyMfDK3JEbb17ZiKjWbgwUMdPbX/wOGYYHYGfCBf4l9SvqILRM3NN3taspyI1Nx4ezKBOkc=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=onxaaafG; arc=none smtp.client-ip=100.103.45.18
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 113F81F000FF;
	Fri,  9 Oct 2026 11:57:13 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1791547035;
	bh=mnj7YWVL8un/+HEREsby3Xeusast07rN6RHjgO1tuD4=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=onxaaafGHlAm5rfwt/JyK38iBsLmQkPz8/pundpp99RN2mUwrhoEkVphijH3/xw5o
	 ZG3DxYO16UmshwveCQpopyUuRjNTyBu22rFfcpFnD9hSqfQRjVliFpr0dWLCE3nQqZ
	 rGL7kTJrFZiMAe2IJd+9OswXE1prDLgozBimJn2ZEOoi4IVGDBHjPEniLWc+gbB7hR
	 Y+/SjEzHeBNh3XHoiD7BCRSZcmKB2s112DFEHXs1hLVtitXHzB05I/fIpieYhvGVlD
	 eiEh/0U2+4GC7tygaF09qxFJDv7cftHVXBRuPyy20S0D87WJlLFoTo1hffpUXD9HHi
	 dUhncXHBIsPIg==
X-Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, pabeni@redhat.com,
	edumazet@google.com, kuba@kernel.org
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <20261008031426.1142344-2-achender@kernel.org>