Article View: linux.kernel.netdev
Article #5211[PATCH net-next v6 1/2] net/rds: include the scope id in the sendmsg connection cache check
From: Allison Henderson
Date: Tue, 20 Oct 2026 00:28
Date: Tue, 20 Oct 2026 00:28
48 lines
9644 bytes
9644 bytes
rds_sendmsg() reuses the connection cached in rs->rs_conn when its
peer address and ToS match the request. The interface index is part
of a connection's identity as well: rds_conn_create_outgoing() passes
the request's scope_id down as dev_if, and rds_conn_lookup() compares
c_dev_if, so sends to the same link-local address through two
interfaces are two different connections. The cache-hit test never
looked at it.
A socket bound to a non-link-local address has rs_bound_scope_id 0,
and the scope check at the top of rds_sendmsg() accepts any non-zero
destination scope for such a socket. So after a send to fe80::x%ifA,
a send to fe80::x%ifB hits the cached ifA connection and the datagram
leaves through ifA, to whichever peer answers to that address there.
Compare c_dev_if with the request's scope_id in the cache test, so
that such a send takes the lookup path and finds, or creates, the ifB
connection - the same key the lookup uses. A send without a
destination takes its scope from the socket, and the connection it
created was keyed on that same scope, so the comparison holds for it
too; the next patch gives that send the connected peer's own scope.
Found by inspection while reworking this cache for the connection
lifetime series on net-next; 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>
---
net/rds/send.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/rds/send.c b/net/rds/send.c
index 1afa981e5c06..38b9cc9e0d20 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -1342,7 +1342,8 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
/* rds_conn_create has a spinlock that runs with IRQ off.
* Caching the conn in the socket helps a lot. */
if (rs->rs_conn && ipv6_addr_equal(&rs->rs_conn->c_faddr, &daddr) &&
- rs->rs_tos == rs->rs_conn->c_tos) {
+ rs->rs_tos == rs->rs_conn->c_tos &&
+ rs->rs_conn->c_dev_if == scope_id) {
conn = rs->rs_conn;
} else {
conn = rds_conn_create_outgoing(sock_net(sock->sk),
--
2.50.1
Technical Details
Message-ID:
<20261020002816.3087414-2-achender@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-348931-linux-kernel-netdev=dewy.ruReferences:
<20261020002816.3087414-1-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-348931-linux-kernel-netdev=dewy.ru From: achender@kernel.org (Allison Henderson) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v6 1/2] net/rds: include the scope id in the sendmsg connection cache check Date: Mon, 19 Oct 2026 17:28:15 -0700 Organization: Usenet Network Message-ID: <20261020002816.3087414-2-achender@kernel.org> References: <20261020002816.3087414-1-achender@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3749149"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:soyI2kcrduzRMWULNHxKSXjNly0= sha256:tl04fOg6qdnLL8KBT18YgQ9Ikt6FzVGwuxup8JN47xE= sha1:ZfW4vqs4CIkuKE96GNjq9Na6rhM= sha256:jF1HmLmNyQomrKJ16eTS1RJhbaUCEQjDaLnL9+HQt0c= 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 F197B110B91; Tue, 20 Oct 2026 03:29:46 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.729 X-Spam-Status: No, score=-3.729 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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=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 on1Xauzxd3wP; Tue, 20 Oct 2026 03:29:39 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-348931-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 1FE78110B7A; Tue, 20 Oct 2026 03:29:28 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 3243C2643F; Tue, 20 Oct 2026 00:28:25 +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=1792456104; b=VfavUg/JrmzRbUBIf6r6Fx72M+AN0Km88XEspxOZEkW0XzY3VLA8PAtwEtltaGCSa1f5 zVW/JUjzFmrlZlwVzgxcoOKwrvv6lVsHJAPdkwtvVpoZPhPa6d8FdV+At4FSIAceMcOqZ Qbk542vSsO+4T90h+dPDS/h6vlCKevoIqV+TYlUvRQIcjTJ3xBmsvwYoC7LnfpjmreYC6 7uYbItcwQKLdRr0K6kh4lsvlHb0HBs9o7BV7AqDGTE+GfVxwqnp5yYQ9K4sDxLHVWFSUz vXVkBzx/683hibEp0MPOyentx2gZvU2dE0q2YCwpg952J1thdpAZLLPv7l1DpGXx02A== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792456104; h=X-Original-To:Received:Received:DKIM-Signature: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=ULtxg0Fk0whulWZSHTNN5DQiIhcB0QibJjb6BHCTOMs=; b=NzihivMsuTKn/gWNMD1DufPZya+W8j3WTP7sr1Gq0LFtw/KXhRfvA4cwV3fz5XAXtlhv 2Mbpow9TrrHXgMK4sdHIgSbDJtT+Q8ZCTRmqUqBw2E3s2LtTmb5Kd2LFFUCe0zSNwmaan qWM9JcUzDFSH/EBxTktPhnu54oFJHLuRF5HpBq1d/cMHPhMeZp572SNv03ZKqGH6I9FTc qj7ECzTnfxj7vZfr1lZZ046wCoAn38iSawwZFbmmTs/tITl12Rp8ZE56N/wO0k5SZ9l31 Inrw6Gm9ma6d4tlTwtil4D3QKVqwC/oUnrSNpZrGFPZ677asLb99AB7C3veGoc97UlA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DMyLsdqx; 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 1B67C606A328; Tue, 20 Oct 2026 00:28:24 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DMyLsdqx X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792456098; b=qR6i4Ps6vndR4XujD2So6zB2JNBqUYjDJtqtE+8WLn9v+PW9si+hR8WLveFn8c14+pjV Y2m8IAh9yEIGplCkzDUrsQdUdhZA83kp1yGqCyZJ6mugututCqY4nkx0eVWO2PyWBj+tB TU2d8esKHnFlkYIMYdwSaPFmcDQvaReeYFsq0h+eJb96Q1vfQlwHdCduBk0bfq3q0MRo9 LcWHT29N9Gp7yIdh1AKKaIAFahQHRLdI7or0LlUpSLiqBUXALDWi30JA+hEBs/CFnaU61 3w52iSAivqJPw8QMk6siY5QxgYbVOdvRe2HChUm97MGPcHX9UyY8zb8bs3MIfeHraIw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792456098; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=ULtxg0Fk0whulWZSHTNN5DQiIhcB0QibJjb6BHCTOMs=; b=nK3uFfC8eHuS30B4Z/BBe5O46YaE6qlS0nLphV39pGlJkG7l/TXI17J8KhNL3ZDOo6FF cTrprNt6u27yKp92TuIR4b9oQjPDQH1uN3fjAK+9bBY0zEaFc0Abg1dcYtWkLX89RYQAv 3GGgpuKP5jgh0nm/jtvJbdHJt9YUYjUoI99WcMOGu/YBO8J1qHq8E1U2afHa4r3F7VLgI rh6pcj26JmRykjqbrszcneL2luncE2O7qZNeTj8QaQ5hGIjxy8X6RGt7jEni8srZxchpm CG73ja7SvYsya4gx/Stmn2oX0+Hwpeq+T5WasRpEy3Gh98BZuMTtwQigr0f2WdSTNZw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DMyLsdqx; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2C51606A31B; Tue, 20 Oct 2026 00:28:17 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 746D51F000C8; Tue, 20 Oct 2026 00:28:17 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792456097; bh=ULtxg0Fk0whulWZSHTNN5DQiIhcB0QibJjb6BHCTOMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DMyLsdqxxxggacI8ZuSNLwCfUPMnLZFFNfybdB4lPYeBi6/UM0XwKQ8gTwJN1o4lU DH7ClSCrPo4V+R4pANvHEjYglQ/5L+tR3h9DUNPl3dTVKkAlf1NDH2KmoS/6ZDM6VT Ea6UVP4JLGIRhtWYpfMxgLMvBRgwAOGOv2Hr025/OG6Si97du3lCHKwvAVJ0c0WW5Q q/WWoeN4L8/KykiH30W4x6UMsbG1VoefqhnnIax6bUBn9XigY+yi2ubI2OdWCzM4Dg JDtSM/Z7lwQQ3q320yoVvzSx9iC8a/IS/J3VtwEJU+bgn4yGGvPz4u54mEymEC+EU4 SFTdivULfa6/g== X-Cc: achender@kernel.org X-Mailer: git-send-email 2.50.1 X-In-Reply-To: <20261020002816.3087414-1-achender@kernel.org> 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