Author: rrs
Date: Mon May  4 23:02:58 2020
New Revision: 360644
URL: https://svnweb.freebsd.org/changeset/base/360644

Log:
  This fixes two issues found by ankitrahej...@gmail.com
  1) When BBR retransmits the syn it was messing up the snd_max
  2) When we need to send a RST we might not send it when we should
  
  Reported by:  ankitrahej...@gmail.com
  Sponsored by:  Netflix.com
  Differential Revision: https://reviews.freebsd.org/D24693

Modified:
  head/sys/netinet/tcp_stacks/bbr.c

Modified: head/sys/netinet/tcp_stacks/bbr.c
==============================================================================
--- head/sys/netinet/tcp_stacks/bbr.c   Mon May  4 22:59:39 2020        
(r360643)
+++ head/sys/netinet/tcp_stacks/bbr.c   Mon May  4 23:02:58 2020        
(r360644)
@@ -12159,6 +12159,7 @@ bbr_output_wtime(struct tcpcb *tp, const struct timeva
                        recwin = min(max(sbspace(&so->so_rcv), 0),
                            TCP_MAXWIN << tp->rcv_scale);
                        if ((bbr_window_update_needed(tp, so, recwin, maxseg) 
== 0) &&
+                           ((tcp_outflags[tp->t_state] & TH_RST) == 0) &&
                            ((sbavail(sb) + ((tcp_outflags[tp->t_state] & 
TH_FIN) ? 1 : 0)) <=
                            (tp->snd_max - tp->snd_una))) {
                                /*
@@ -12916,9 +12917,13 @@ recheck_resend:
        if (tp->t_flags & TF_ACKNOW) {
                goto send;
        }
-       if (((flags & TH_SYN) && (tp->t_flags & TF_NEEDSYN) == 0)) {
+       if (flags & TH_RST) {
+               /* Always send a RST if one is due */
                goto send;
        }
+       if ((flags & TH_SYN) && (tp->t_flags & TF_NEEDSYN) == 0) {
+               goto send;
+       }
        /*
         * If our state indicates that FIN should be sent and we have not
         * yet done so, then we need to send.
@@ -14029,7 +14034,11 @@ out:
                }
                if (flags & (TH_SYN | TH_FIN) && (rsm == NULL)) {
                        if (flags & TH_SYN) {
-                               tp->snd_max++;
+                               /*
+                                * Smack the snd_max to iss + 1
+                                * if its a FO we will add len below.
+                                */
+                               tp->snd_max = tp->iss + 1;
                        }
                        if ((flags & TH_FIN) && ((tp->t_flags & TF_SENTFIN) == 
0)) {
                                tp->snd_max++;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to