Date: Thu, 27 May 2021 14:51:35 GMT From: Randall Stewart <rrs@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 8c69d988a8d3 - main - tcp: When we have an out-of-order FIN we do want to strip off the FIN bit. Message-ID: <202105271451.14REpZjN015904@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=8c69d988a8d32e53310c7b73ec8721b04b7249e6 commit 8c69d988a8d32e53310c7b73ec8721b04b7249e6 Author: Randall Stewart <rrs@FreeBSD.org> AuthorDate: 2021-05-27 14:50:32 +0000 Commit: Randall Stewart <rrs@FreeBSD.org> CommitDate: 2021-05-27 14:50:32 +0000 tcp: When we have an out-of-order FIN we do want to strip off the FIN bit. The last set of commits fixed both a panic (in rack) and an ACK-war (in freebsd and bbr). However there was a missing case, i.e. where we get an out-of-order FIN by itself. In such a case we don't want to leave the FIN bit set, otherwise we will do the wrong thing and ack the FIN incorrectly. Instead we need to go through the tcp_reasm() code and that way the FIN will be stripped and all will be well. Reviewed by: mtuexen,rscheff Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30497 --- sys/netinet/tcp_input.c | 7 ++++++- sys/netinet/tcp_stacks/bbr.c | 7 ++++++- sys/netinet/tcp_stacks/rack.c | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index b9836a137608..1dab2e511d95 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -3191,7 +3191,12 @@ dodata: /* XXX */ * when trimming from the head. */ tcp_seq temp = save_start; - if (tlen) { + if (tlen || (th->th_seq != tp->rcv_nxt)) { + /* + * We add the th_seq != rcv_nxt to + * catch the case of a stand alone out + * of order FIN. + */ thflags = tcp_reass(tp, th, &temp, &tlen, m); tp->t_flags |= TF_ACKNOW; } diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index b2fc5c1f928e..5b97c3d7800f 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -8320,7 +8320,12 @@ bbr_process_data(struct mbuf *m, struct tcphdr *th, struct socket *so, * trimming from the head. */ tcp_seq temp = save_start; - if (tlen) { + if (tlen || (th->th_seq != tp->rcv_nxt)) { + /* + * We add the th_seq != rcv_nxt to + * catch the case of a stand alone out + * of order FIN. + */ thflags = tcp_reass(tp, th, &temp, &tlen, m); tp->t_flags |= TF_ACKNOW; } diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index b7e8c1578f2b..1db09e30d968 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -10235,7 +10235,12 @@ rack_process_data(struct mbuf *m, struct tcphdr *th, struct socket *so, * trimming from the head. */ tcp_seq temp = save_start; - if (tlen) { + if (tlen || (th->th_seq != tp->rcv_nxt)) { + /* + * We add the th_seq != rcv_nxt to + * catch the case of a stand alone out + * of order FIN. + */ thflags = tcp_reass(tp, th, &temp, &tlen, m); tp->t_flags |= TF_ACKNOW; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105271451.14REpZjN015904>