From nobody Fri Oct 02 02:54:09 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hwtf93vcWz6v6sw for ; Fri, 02 Oct 2026 02:54:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hwtf93QZQz3JDj for ; Fri, 02 Oct 2026 02:54:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790909649; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4uCeUiEY4YR7BK4iZlFrueda3QVlSZ1S6mM6BTJDzyI=; b=ZBbAuEnyzZoy8FHHbVwIt9UssWCBo8FM3IXxJNwC0RiTgDjT3JeL082oxv/zfC0UvbW2yy 6E0j2NgCsYddn4m6iUTnb8bBVnoV1wWKGEpzwoHfxphjRMmXUUi6pBwAweuD9nYfnRjHfa 1tRDo8bRTvk0hkv6r61kkNd0OorxYwPk4okVJYuOMFuCIzqdJBVJOaTOfQCRY3diUTqgQD ry3RHyvPOubmytO9wUu2b8XrSmVMRWOqLADUdmRm5xxn7ffmU9X70Z7sTY2mXi640xeNra yn7Z3GnRHQjb/g7nYxeoE+W/K/yhmUPafpf2CWb47SgQAYsnyRvxcl/45umw7w== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1790909649; b=X+ne5t21w7PtUIg/XAv/ie7ldRAd5OlU0dL5miBA/7q5o1Rd8RYGgBJDImdtExdmny52Ez 7GKhqqiBZkarK3x/XFZ7jHdWdhubA975y1v8gAn6f9ar4scchP98HcbzLK30//PsHLrGsx TlRMeyXXi0ijIlYp3Aa4+jmhtEX/kUI0JAc12iN7Iu+Rr0+ArVxCgz/w6AUcob2ZE6HJfF qUvfNC7pLhZg98DbvTffnv0kT6wW5MffWIbn/2YFnDyabjv9SRKLYu6/82YTp1ltGSuQfb TQcJsBzChAXSviTCc+MlGc/An+3MSEHsC5jDGjUPB05Gc4MO8d0oxbGpdbRs8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790909649; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4uCeUiEY4YR7BK4iZlFrueda3QVlSZ1S6mM6BTJDzyI=; b=PVKt3hiPka3PAQM+w70vX/yzDF7zpMl8p2R4HrduZv/3Kadbny1w1sGhH4E9f2vqTQspZ7 p8cC76OMjnVR7lFGjz5Pii7NPPvO3/gGbv9tUGC4D5cB6qfkA0n1mUA9egY5Fu/mBMzEs6 cWOJvSCfhOmO/E06ZojKUTsLzLVci4sJksRlMJlbJWsefS9IApbf0dN7kdGQANq4APB1p2 x679KIg7KWMEQut7DFlM4OWwNG1cl+3+0+Z2W/+EWLfuGLipdP06RuDFmarLVq50B0L71O IUZwXE0LGxFob8MMtzirCWOZIVx73FwZRJybYDxF/4UO4R8kXTbSBv/A8R+bdw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hwtf92SXTz10qJ for ; Fri, 02 Oct 2026 02:54:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36d2d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 02 Oct 2026 02:54:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: e65b7079db12 - main - tcp: use SB_AUTOSIZE flag to tell if socket buffer was set List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e65b7079db12afb1aa61be4f1c666b162984a95e Auto-Submitted: auto-generated Date: Fri, 02 Oct 2026 02:54:09 +0000 Message-Id: <6abf1cd1.36d2d.6ae23aec@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=e65b7079db12afb1aa61be4f1c666b162984a95e commit e65b7079db12afb1aa61be4f1c666b162984a95e Author: Gleb Smirnoff AuthorDate: 2026-10-02 02:53:31 +0000 Commit: Gleb Smirnoff CommitDate: 2026-10-02 02:53:31 +0000 tcp: use SB_AUTOSIZE flag to tell if socket buffer was set The check against V_tcp_sendspace is not a correct one, as a buffer may grow larger than the initial value. The conjunction was always false up until 587c6c121504, and only after it the bug surfaced. If we already grow our buffer past the value stored in the hostcache, prefer our value. Reviewed by: tuexen Differential Revision: https://reviews.freebsd.org/D60105 --- sys/netinet/tcp_input.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index e79f652bcb54..e74d533f7baa 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -3888,18 +3888,15 @@ tcp_mss(struct tcpcb *tp, int offer) mss = tp->t_maxseg; /* - * If there's a pipesize, change the socket buffer to that size, - * don't change if sb_hiwat is different than default (then it - * has been changed on purpose with setsockopt). + * If there's a pipesize, change the socket buffer to that size, unless + * it has been set by a setsockopt(2). * Make the socket buffers an integral number of mss units; * if the mss is larger than the socket buffer, decrease the mss. */ so = inp->inp_socket; SOCK_SENDBUF_LOCK(so); - if ((so->so_snd.sb_hiwat == V_tcp_sendspace) && metrics.hc_sendpipe) - bufsize = metrics.hc_sendpipe; - else - bufsize = so->so_snd.sb_hiwat; + bufsize = (so->so_snd.sb_flags & SB_AUTOSIZE) ? + max(metrics.hc_sendpipe, so->so_snd.sb_hiwat) : so->so_snd.sb_hiwat; if (bufsize < mss) mss = bufsize; else { @@ -3931,10 +3928,8 @@ tcp_mss(struct tcpcb *tp, int offer) } SOCK_RECVBUF_LOCK(so); - if ((so->so_rcv.sb_hiwat == V_tcp_recvspace) && metrics.hc_recvpipe) - bufsize = metrics.hc_recvpipe; - else - bufsize = so->so_rcv.sb_hiwat; + bufsize = (so->so_rcv.sb_flags & SB_AUTOSIZE) ? + max(metrics.hc_recvpipe, so->so_rcv.sb_hiwat) : so->so_rcv.sb_hiwat; if (bufsize > mss) { bufsize = roundup(bufsize, mss); if (bufsize > sb_max)