net/rds: scope-aware sendmsg connection cache
Status from this message: This series was applied to netdev/net.git (main)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v6 Latest2 patches 0 repliesApplied 2/2
- v52 patches 0 repliesSuperseded
- v42 patches 2 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v3 | 2 patches | 0 replies | Superseded |
Patches in v6 All 2 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | net/rds: include the scope id in the sendmsg connection cache checknet/ | +2 | 0 replies | Applied |
| 2/2 | net/rds: keep the connected peer's scope id apart from the bound onenet/ net/ net/ +2 more | +28 | 0 replies | Applied |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.
Cover letter [PATCH net-next v6 0/2] net/rds: scope-aware sendmsg connection cache
Hi all,
This is v6 of the sendmsg connection-cache scope fix (v1 at [1], v2 at [2], v3 at [3], v4 at [4], v5 at [5]), 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 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().
Patch 2 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 recorded on its connection.
Changes since v5 [5]:
- Swapped the two patches. The scope-field patch lets a globally bound socket connect() to the same link-local peer through a second interface, and without the cache check in place first the next send() would reuse the first interface's connection, so the series is now bisectable (review of v5).
- recvmsg() comment and changelog no longer describe c_dev_if as the arrival interface: that holds for TCP, while the IB passive side resolves it from the local address (review of v5).
- No code change beyond the comment.
Changes since v4 [4]:
- 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]:
- 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/[email protected]/
[2] https://lore.kernel.org/netdev/[email protected]/
[3] https://lore.kernel.org/netdev/[email protected]/
[4] https://lore.kernel.org/netdev/[email protected]/
[5] https://lore.kernel.org/netdev/[email protected]/
Thank you,
Allison
Allison Henderson (2):
net/rds: include the scope id in the sendmsg connection cache check net/rds: keep the connected peer's scope id apart from the bound one
net/rds/af_rds.c | 15 +++++++++------ net/rds/bind.c | 4 ++-- net/rds/rds.h | 2 ++ net/rds/recv.c | 11 ++++++++++- net/rds/send.c | 9 +++++++-- 5 files changed, 30 insertions(+), 11 deletions(-)
Signature · 1 line
2.50.1