Re: [PATCH net] tcp: keep the route window metric when SO_RCVBUF is set before connect

From: Shashank Mohan Jain

Date: Mon Oct 12 2026 - 00:58:55 EST


On Sun, Oct 11, 2026, Eric Dumazet <edumazet@xxxxxxxxxx> wrote:
> Note that we ask to not top post on netdev@ mailing list.

Understood, replying inline from here on.

> 1) "TCP_WINDOW_CLAMP 4096" only holds until the first data segment.
> ... What the patch really restores is the SYN/SYN-ACK window and the
> window scale. Please say so.

Agreed, presenting the clamp as persistent was wrong. v2 says the patch
restores the window and window scale advertised in the SYN / SYN-ACK,
and notes that since a2cbb1603943 ("tcp: Update window clamping
condition") tcp_measure_rcv_mss() recomputes window_clamp from sk_rcvbuf
once the scaling ratio changes, independent of this change.

> 2) "no window scaling" is not accurate: we still send the option,
> with a shift of 0.

Right; changed to "wscale 0 (the window scale option is still sent,
with a shift of 0)".

> 3) This also fixes TCP_WINDOW_CLAMP being overwritten by a later
> SO_RCVBUF on a not yet connected socket or a listener. ... worth
> mentioning.

Done - v2 leads with the SO_RCVBUF-before-connect / listener case as the
common one, with the route metric as a second effect.

> A packetdrill test covering the SYN window and wscale would be nice.

I'll add a packetdrill test for the SYN window and wscale, with and
without SO_RCVBUF set before connect, in v2.

> It seems to be a net-next candidate ...

Will repost as [PATCH net-next].

Reposted as v2:
https://lore.kernel.org/all/20261011111606.14753-1-jain.sm@xxxxxxxxx/

Thanks for the review.
Shashank