Thread (4 messages) 4 messages, 2 authors, 1d ago

[PATCH net-next v5 0/2] net/rds: scope-aware sendmsg connection cache

flat view
WARM1d

From: Allison Henderson <achender@kernel.org>
Date: 2026-10-17 03:23:59
Also in: linux-rdma

Revision v5 of 3 in this series.

Revisions (3)
  1. v3 [diff vs current]
  2. v4 [diff vs current]
  3. v5 current
Hi all,

This is v5 of the sendmsg connection-cache scope fix (v1 at [1], v2 at
[2], v3 at [3], v4 at [4]), now against net-next as Jakub suggested:
neither issue has been observed in the field, and both were found by
inspection while reworking this cache for the connection-lifetime
series.

  Patch 1 gives the connected peer's link-local scope its own field.
  rds_connect() used to store it in rs_bound_scope_id, the scope of
  the socket's own bound address, which a later bind() to a
  non-link-local address resets to 0 and which a later connect()
  pollutes for a globally bound socket.  A send without a destination
  and getpeername() take the connected peer's scope from that field;
  recvmsg() reports a link-local sender with the interface its
  connection came in on.

  Patch 2 compares c_dev_if with the request's scope in the cache-hit
  test, so the cache uses the same key as rds_conn_lookup().

Changes since v4 [4]:
 - Patch 1: recvmsg() takes a link-local sender's scope from the
   connection the message arrived on (c_dev_if) and reports 0 for any
   other sender, instead of the socket's connected or bound scope - a
   connected socket receives from any peer, so a per-socket scope was
   wrong for every sender but the connected one and could send a
   reply out the wrong link (review of v4).  getpeername() and
   recvmsg() now agree for the connected peer.
 - Retargeted at net-next.

Changes since v3 [3]:
 - Patch 1: a destination-less send falls back to the bound scope for a
   non-link-local peer, so send() and sendto() to the connected peer
   compute the same scope; getpeername() and recvmsg() report the
   connected peer's scope instead of the bound scope.

[1] https://lore.kernel.org/netdev/20260921215046.174745-1-achender@kernel.org/ (local)
[2] https://lore.kernel.org/netdev/20260927062312.169097-1-achender@kernel.org/ (local)
[3] https://lore.kernel.org/netdev/20261003163526.250805-1-achender@kernel.org/ (local)
[4] https://lore.kernel.org/netdev/20261008031426.1142344-1-achender@kernel.org/ (local)

Thank you,
Allison


Allison Henderson (2):
  net/rds: keep the connected peer's scope id apart from the bound one
  net/rds: include the scope id in the sendmsg connection cache check

 net/rds/af_rds.c | 15 +++++++++------
 net/rds/bind.c   |  4 ++--
 net/rds/rds.h    |  2 ++
 net/rds/recv.c   |  9 ++++++++-
 net/rds/send.c   |  9 +++++++--
 5 files changed, 28 insertions(+), 11 deletions(-)

-- 
2.50.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help