mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] tcp: keep the route window on the SYN when SO_RCVBUF is set before connect
@ 2026-10-11 11:16 Shashank Mohan Jain
  2026-10-11 11:16 ` [PATCH net-next 1/2] tcp: don't set window_clamp from SO_RCVBUF before the socket is connected Shashank Mohan Jain
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Shashank Mohan Jain @ 2026-10-11 11:16 UTC (permalink / raw)
  To: Eric Dumazet, Neal Cardwell, Jakub Kicinski, Paolo Abeni,
	David S. Miller
  Cc: Kuniyuki Iwashima, Simon Horman, netdev, linux-kernel

v1 was a single [PATCH net] with only the fix. Eric Dumazet pointed out
that the changelog overstated the effect (TCP_WINDOW_CLAMP does not
persist past the first data segments), that "no window scaling" was
inaccurate (the option is still sent, with a shift of 0), and asked for
a packetdrill test and for the series to target net-next. This v2
rewrites the changelog accordingly, leads with the common
SO_RCVBUF-before-connect / listener case, adds a packetdrill test, and
is based on net-next.

Patch 1 is the fix: setsockopt(SO_RCVBUF) must not write tp->window_clamp
while the socket is in TCP_CLOSE or TCP_LISTEN, so that
tcp_connect_init() and tcp_openreq_init_rwin() still apply the route
window metric (RTAX_WINDOW) and the defaults to the SYN / SYN-ACK window
and window scale.

Patch 2 adds a packetdrill test: with "window 4096" on the route to the
peer and SO_RCVBUF set before connect(), the SYN must advertise the
route-clamped window and window scale 0. On an unpatched net-next kernel
the SYN carries win 65535, wscale 5; with patch 1 it carries win 2920,
wscale 0.

Changes since v1 (single [PATCH net]):
 - changelog: say the patch restores the SYN/SYN-ACK window and window
   scale, not a persistent clamp; note that since a2cbb1603943
   tcp_measure_rcv_mss() recomputes window_clamp from sk_rcvbuf anyway.
 - changelog: "wscale 0 (option still sent, shift 0)" instead of "no
   window scaling"; lead with the SO_RCVBUF-before-connect / listener
   case.
 - add the packetdrill selftest (patch 2).
 - retarget from net to net-next.

Shashank Mohan Jain (2):
  tcp: don't set window_clamp from SO_RCVBUF before the socket is
    connected
  selftests/net/packetdrill: test SO_RCVBUF before connect keeps route
    window

 net/ipv4/tcp.c                                |  8 ++++++
 .../tcp_rcvbuf_before_connect_window.pkt      | 27 +++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 tools/testing/selftests/net/packetdrill/tcp_rcvbuf_before_connect_window.pkt


base-commit: d8674294aefef02266c4d47ad10131f1bffbe534
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-11 11:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-11 11:16 [PATCH net-next 0/2] tcp: keep the route window on the SYN when SO_RCVBUF is set before connect Shashank Mohan Jain
2026-10-11 11:16 ` [PATCH net-next 1/2] tcp: don't set window_clamp from SO_RCVBUF before the socket is connected Shashank Mohan Jain
2026-10-11 11:16 ` [PATCH net-next 2/2] selftests/net/packetdrill: test SO_RCVBUF before connect keeps route window Shashank Mohan Jain
2026-10-11 11:19 ` [PATCH net-next 0/2] tcp: keep the route window on the SYN when SO_RCVBUF is set before connect netdev-bot+sinfo
2026-10-11 11:23   ` shashank Jain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®