Date: Thu, 14 Jan 2021 13:51:33 GMT From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: cc3c34859eab - main - tcp: fix handling of TCP RST segments missing timestamps Message-ID: <202101141351.10EDpXSt002402@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=cc3c34859eab1b317d0f38731355b53f7d978c97 commit cc3c34859eab1b317d0f38731355b53f7d978c97 Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2021-01-13 22:43:40 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101141351.10EDpXSt002402>