From nobody Fri Oct 02 02:54:09 2026 X-Original-To: dev-commits-src-all@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 4hwtfH0pTpz6v76V for ; Fri, 02 Oct 2026 02:54:15 +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 4hwtfG5XQsz3J95 for ; Fri, 02 Oct 2026 02:54:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790909654; 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=M2PH4pF0gb9xJkBEnnH969IvwjdHifeTWFxK+XSx3anHuj14HnXJeO4ZOQXZJgQez9Qj/v ekgen4rVss1d0Zo40aubUFQ6xU4uYNBqou9bbul8mW/FggGUsQ/9xPuv/4VQEuaC0lokdH q0uoX7BE2he+MceNuqRCWrJUzVIOpH/sqhZ9qNKZx2gLU1VUGwpGfT7eKF+AxGkJgEsp7J HpaKn/LNfRKonm29WZMGP6bordRvj4oAiC+q7QnUzZJtMArKHV6wi0WLsQrUyNIkMNfpEX 2lF5xkJKm/4ZsQTF5kUiKPSKHtNa0732buYUDACBwbHKO6wncTXyc3eo5Gx2Aw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1790909654; b=VvoWrlmtNE1zayMcvj8j60RAGKAlXzP5tsS2nLbZepqdw2hiDXv/83FbAgrYc8jATDethh SL9slNH8C+UbfdmAVAzci3Xca6FBJw4B4WKEUFr4wOdZE71Iw5fLk5Nd3EXSteTlHQGqTM +yXjr210ig3Pehg1ddelHNlEv+KKz7ey/9cjYTYAgLAeKSNTxWTHb+gZd7g9+gXK+DTufc nUnxXeJhm6OO1WoGMDbXPFuWbHZcstpkq0fgLyeYaZuvnXLqVKDJQzr+gPnquMsNHkSRJT jNQXmIwX4Ea/nAWkLR8/l9XSyfXTKwxI4krHAZF0MMBrMTE9LDM+0ZYmYyoZfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790909654; 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=jA1nYLeQ3XGxHYmuhj2nX9ogGL77WI6+KPA+Z+2kREfAXNMr18CrwKleI4QLvs9up+BR5U 85AEKwenvIduL3+JXWfGxZuf+3KBljT4dRHRUkXMKuxq4+a8L+v69sxeonJqO9Adhf6II/ YdJiJczTGP6UQ4odTNt8cE0299nblKM/6qDLMAqBCz5pHZSP1go418lVCn0zl/8jKLLMp8 fQvreFcrkiJvhV76NXMlsFtVGqFLRHJFBQSHaYGF3DW2zU6h9llccEAdl4eKdthaltzlbz 3qFcFJC0w2pf3lHmLSWKDdxp+V3OR+7C4zVpRM/ZtppSt1Ka5xpkajQZw1bamw== 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 4hwtfG4bh2z10vF for ; Fri, 02 Oct 2026 02:54:14 +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 all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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)