Date: Sun, 24 Jan 2021 15:16:22 GMT From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: d05d908d6d3c - stable/12 - tcp: fix handling of TCP RST segments missing timestamps Message-ID: <202101241516.10OFGMKu065387@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=d05d908d6d3c85479c84c707f931148439ae826b commit d05d908d6d3c85479c84c707f931148439ae826b Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2021-01-13 22:43:40 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2021-01-24 14:41:03 +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. Differential Revision: https://reviews.freebsd.org/D28143 (cherry picked from commit cc3c34859eab1b317d0f38731355b53f7d978c97) --- sys/netinet/tcp_input.c | 21 +++++++++++++++------ sys/netinet/tcp_stacks/rack.c | 5 +++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 03b5cf389c1f..31f18c669640 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1708,16 +1708,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/rack.c b/sys/netinet/tcp_stacks/rack.c index 652b0269003f..e46781bb01df 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -6719,10 +6719,11 @@ rack_hpts_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 ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS) && + ((thflags & TH_RST) == 0)) { way_out = 5; retval = 0; goto done_with_input;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101241516.10OFGMKu065387>