From owner-dev-commits-src-main@freebsd.org Thu Jan 14 13:51:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A6844E3350; Thu, 14 Jan 2021 13:51:33 +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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DGm1x3Zjkz3tG5; Thu, 14 Jan 2021 13:51:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6DF5B2B4B; Thu, 14 Jan 2021 13:51:33 +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 10EDpXEJ002403; Thu, 14 Jan 2021 13:51:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10EDpXSt002402; Thu, 14 Jan 2021 13:51:33 GMT (envelope-from git) Date: Thu, 14 Jan 2021 13:51:33 GMT Message-Id: <202101141351.10EDpXSt002402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: cc3c34859eab - main - tcp: fix handling of TCP RST segments missing timestamps MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cc3c34859eab1b317d0f38731355b53f7d978c97 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jan 2021 13:51:33 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=cc3c34859eab1b317d0f38731355b53f7d978c97 commit cc3c34859eab1b317d0f38731355b53f7d978c97 Author: Michael Tuexen AuthorDate: 2021-01-13 22:43:40 +0000 Commit: Michael Tuexen CommitDate: 2021-01-14 13:39:35 +0000 tcp: fix handling of TCP RST segments missing timestamps A TCP RST segment should be processed even it is missing TCP timestamps. Reported by: dmgk@, kevans@ Reviewed by: rscheff@, dmgk@ Sponsored by: Netflix, Inc. MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28143 --- sys/netinet/tcp_input.c | 21 +++++++++++++++------ sys/netinet/tcp_stacks/bbr.c | 5 +++-- sys/netinet/tcp_stacks/rack.c | 5 +++-- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 7746ccf24073..dda37d4795c9 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1692,16 +1692,25 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, /* * If timestamps were negotiated during SYN/ACK and a * segment without a timestamp is received, silently drop - * the segment. + * the segment, unless it is a RST segment. * See section 3.2 of RFC 7323. */ if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { - log(LOG_DEBUG, "%s; %s: Timestamp missing, " - "segment silently dropped\n", s, __func__); - free(s, M_TCPLOG); + if ((thflags & TH_RST) != 0) { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp missing, " + "segment processed normally\n", + s, __func__); + free(s, M_TCPLOG); + } + } else { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp missing, " + "segment silently dropped\n", s, __func__); + free(s, M_TCPLOG); + } + goto drop; } - goto drop; } /* * If timestamps were not negotiated during SYN/ACK and a diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index ccf138f70719..e59d9b9ff168 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -11463,10 +11463,11 @@ bbr_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, /* * If timestamps were negotiated during SYN/ACK and a * segment without a timestamp is received, silently drop - * the segment. + * the segment, unless it is a RST segment. * See section 3.2 of RFC 7323. */ - if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { + if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS) && + ((thflags & TH_RST) == 0)) { retval = 0; goto done_with_input; } diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index c225377807ba..7c81e8b3a2bc 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -10879,10 +10879,11 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, /* * If timestamps were negotiated during SYN/ACK and a * segment without a timestamp is received, silently drop - * the segment. + * the segment, unless it is a RST segment. * See section 3.2 of RFC 7323. */ - if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { + if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS) && + ((thflags & TH_RST) == 0)) { way_out = 5; retval = 0; goto done_with_input;