From nobody Fri Jun 03 09:02:42 2022 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 E20BC1B4D92F; Fri, 3 Jun 2022 09:02:42 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LDxjZ5xNyz3GNM; Fri, 3 Jun 2022 09:02:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654246962; 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=hmyNLD3hnuBLNojcnkrhI6DPtJ2izUBOMi0PmfQHKZ4=; b=RwnnxDE+GO/5vp1IuVkLkFWDA3/h2Ew1vskIs5a3rk8qFy9zUz2de7vILXLVcdA1Ly09cO QVB7zmynOn2VLJ2ymQx2GU5d6WoggRXLPL3UH6/Fca7Qk5a6mGQ4Bp6EpqregNNvJGPJnt OSciTXNkMdieAqRr/RUEIbJ6qCAafqoiW7OhQP6Yqpr7wyEaxDBXx4e7Ctcm81M1reORUK +WuVD+PuFk9mtNC6RZg7yZ5Za+BPgRl+ENz14OXONbqSxxJA2LInj+OxqLMFzIu7PpcERS BMjMZ5bBHOvffUiCaLoHNGX4imTs26tGIdniwnD1tf0VFwV2h6q0UCE3omQJ5Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACA9F25F45; Fri, 3 Jun 2022 09:02:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25392g6r087146; Fri, 3 Jun 2022 09:02:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25392gqU087145; Fri, 3 Jun 2022 09:02:42 GMT (envelope-from git) Date: Fri, 3 Jun 2022 09:02:42 GMT Message-Id: <202206030902.25392gqU087145@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 28173d49dccb - main - tcp: Correctly compute the retransmit length for all 64-bit platforms. 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28173d49dccb91e50be9c401dbad1da908a5dc75 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654246962; 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=hmyNLD3hnuBLNojcnkrhI6DPtJ2izUBOMi0PmfQHKZ4=; b=MwZWLMto2as8mrR8rep8JenkBiqWaHOIIO9GhblX3dX2BZguZ9d84rkl/T+9rCfQWJNsH2 WVfikoY6XwLtl1hy5gKopl2dZEsR67AYeLMDcRskGGOdWVKucF99l/fTzIHleuwJnM2pSO kDusCUmqgOR6s8g6tQl3id3pgkwXSEhka3I8JzwCBxO080zfoeJqwE/6w5XPQIK5FaUJnb SvI1aTyYaNepsYndpOPjfj4P0Xeo0KwkbCAZn+fH97m1HSiDYZrHxEBwtSXUsspKP4VEbT Uuv15jHsW3RKh3HTMYl9M01EmGcO6pDDOcfYZfMJMQHgT0Stvyzmbn3QGyI3Bw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654246962; a=rsa-sha256; cv=none; b=hHEGS06xiXtoVW7h/CHNAJCgeeT6GMhzvS/0O+2pm7MtUIwrDP7LjVoUtl2ArSpdPOdMnJ ztBkAK5dmBkXeoFuo3XclgX3M1UU/GB/fdghieq4H6HwyxrWcnmtA7vaRpdG2d/WbQktR4 pa6c4zKdkZONwzTOg9fwdod9MPLq9WCVVSjOcuVpIOFHfbj5Gn4EOR1PfBiOw99GWyB1IU Lo6dUkzA/E1lNOuNlEu/op4B8huG7N3RQYh7HqiHS3h7nF+40KXv4C4fLKLgP8DK0yDyHc Dvu/Vvtj2bCS3WwVhIlv8w5Px7j9K3M6IbtVq0DxjoibuG3/Zn3dwCCfQKkgUA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=28173d49dccb91e50be9c401dbad1da908a5dc75 commit 28173d49dccb91e50be9c401dbad1da908a5dc75 Author: Hans Petter Selasky AuthorDate: 2022-06-02 18:33:21 +0000 Commit: Hans Petter Selasky CommitDate: 2022-06-03 08:49:17 +0000 tcp: Correctly compute the retransmit length for all 64-bit platforms. When the TCP sequence number subtracted is greater than 2**32 minus the window size, or 2**31 minus the window size, the use of unsigned long as an intermediate variable, may result in an incorrect retransmit length computation on all 64-bit platforms. While at it create a helper macro to facilitate the computation of the difference between two TCP sequence numbers. Differential Revision: https://reviews.freebsd.org/D35388 Reviewed by: rscheff MFC after: 3 days Sponsored by: NVIDIA Networking --- sys/netinet/tcp_output.c | 13 ++++++++----- sys/netinet/tcp_seq.h | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index b0dedb1a24d1..cd6238f10401 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -328,13 +328,16 @@ again: */ p = NULL; goto after_sack_rexmit; - } else + } else { /* Can rexmit part of the current hole */ len = ((int32_t)ulmin(cwin, - tp->snd_recover - p->rxmit)); - } else - len = ((int32_t)ulmin(cwin, p->end - p->rxmit)); - off = p->rxmit - tp->snd_una; + SEQ_SUB(tp->snd_recover, p->rxmit))); + } + } else { + len = ((int32_t)ulmin(cwin, + SEQ_SUB(p->end, p->rxmit))); + } + off = SEQ_SUB(p->rxmit, tp->snd_una); KASSERT(off >= 0,("%s: sack block to the left of una : %d", __func__, off)); if (len > 0) { diff --git a/sys/netinet/tcp_seq.h b/sys/netinet/tcp_seq.h index b6e682ec1fe4..c77fd0fa1f6f 100644 --- a/sys/netinet/tcp_seq.h +++ b/sys/netinet/tcp_seq.h @@ -43,6 +43,7 @@ #define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) #define SEQ_GT(a,b) ((int)((a)-(b)) > 0) #define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0) +#define SEQ_SUB(a,b) ((int)((a)-(b))) #define SEQ_MIN(a, b) ((SEQ_LT(a, b)) ? (a) : (b)) #define SEQ_MAX(a, b) ((SEQ_GT(a, b)) ? (a) : (b))