The branch stable/13 has been updated by tuexen:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=eb91abb4ba3dbdafedfea125129b2f0115e81137

commit eb91abb4ba3dbdafedfea125129b2f0115e81137
Author:     Randall Stewart <[email protected]>
AuthorDate: 2021-05-27 14:50:32 +0000
Commit:     Michael Tuexen <[email protected]>
CommitDate: 2021-06-09 00:18:36 +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
    
    (cherry picked from commit 8c69d988a8d32e53310c7b73ec8721b04b7249e6)
---
 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 4ea0f7c5231c..b6a198b49eef 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -3184,7 +3184,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 78957bdfb27d..a10235f94c89 100644
--- a/sys/netinet/tcp_stacks/bbr.c
+++ b/sys/netinet/tcp_stacks/bbr.c
@@ -8321,7 +8321,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 5556e562c0eb..63574691112c 100644
--- a/sys/netinet/tcp_stacks/rack.c
+++ b/sys/netinet/tcp_stacks/rack.c
@@ -10236,7 +10236,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;
                        }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to