Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 May 2020 21:26:22 +0000 (UTC)
From:      Richard Scheffenegger <rscheff@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r361346 - in head/sys/netinet: . tcp_stacks
Message-ID:  <202005212126.04LLQMw3091812@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rscheff
Date: Thu May 21 21:26:21 2020
New Revision: 361346
URL: https://svnweb.freebsd.org/changeset/base/361346

Log:
  Retain only mutually supported TCP options after simultaneous SYN
  
  When receiving a parallel SYN in SYN-SENT state, remove all the
  options only we supported locally before sending the SYN,ACK.
  
  This addresses a consistency issue on parallel opens.
  
  Also, on such a parallel open, the stack could be coaxed into
  running with timestamps enabled, even if administratively disabled.
  
  Reviewed by:	tuexen (mentor)
  Approved by:	tuexen (mentor)
  MFC after:	2 weeks
  Sponsored by:	NetApp, Inc.
  Differential Revision:	https://reviews.freebsd.org/D23371

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

Modified: head/sys/netinet/tcp_input.c
==============================================================================
--- head/sys/netinet/tcp_input.c	Thu May 21 21:15:25 2020	(r361345)
+++ head/sys/netinet/tcp_input.c	Thu May 21 21:26:21 2020	(r361346)
@@ -1623,17 +1623,20 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru
 		    (tp->t_flags & TF_REQ_SCALE)) {
 			tp->t_flags |= TF_RCVD_SCALE;
 			tp->snd_scale = to.to_wscale;
-		}
+		} else
+			tp->t_flags &= ~TF_REQ_SCALE;
 		/*
 		 * Initial send window.  It will be updated with
 		 * the next incoming segment to the scaled value.
 		 */
 		tp->snd_wnd = th->th_win;
-		if (to.to_flags & TOF_TS) {
+		if ((to.to_flags & TOF_TS) &&
+		    (tp->t_flags & TF_REQ_TSTMP)) {
 			tp->t_flags |= TF_RCVD_TSTMP;
 			tp->ts_recent = to.to_tsval;
 			tp->ts_recent_age = tcp_ts_getticks();
-		}
+		} else
+			tp->t_flags &= ~TF_REQ_TSTMP;
 		if (to.to_flags & TOF_MSS)
 			tcp_mss(tp, to.to_mss);
 		if ((tp->t_flags & TF_SACK_PERMIT) &&

Modified: head/sys/netinet/tcp_stacks/bbr.c
==============================================================================
--- head/sys/netinet/tcp_stacks/bbr.c	Thu May 21 21:15:25 2020	(r361345)
+++ head/sys/netinet/tcp_stacks/bbr.c	Thu May 21 21:26:21 2020	(r361346)
@@ -11595,17 +11595,20 @@ bbr_do_segment_nounlock(struct mbuf *m, struct tcphdr 
 			    (tp->t_flags & TF_REQ_SCALE)) {
 				tp->t_flags |= TF_RCVD_SCALE;
 				tp->snd_scale = to.to_wscale;
-			}
+			} else
+				tp->t_flags &= ~TF_REQ_SCALE;
 			/*
 			 * Initial send window.  It will be updated with the
 			 * next incoming segment to the scaled value.
 			 */
 			tp->snd_wnd = th->th_win;
-			if (to.to_flags & TOF_TS) {
+			if ((to.to_flags & TOF_TS) &&
+			    (tp->t_flags & TF_REQ_TSTMP)) {
 				tp->t_flags |= TF_RCVD_TSTMP;
 				tp->ts_recent = to.to_tsval;
 				tp->ts_recent_age = tcp_tv_to_mssectick(&bbr->rc_tv);
-			}
+			} else
+			    tp->t_flags &= ~TF_REQ_TSTMP;
 			if (to.to_flags & TOF_MSS)
 				tcp_mss(tp, to.to_mss);
 			if ((tp->t_flags & TF_SACK_PERMIT) &&

Modified: head/sys/netinet/tcp_stacks/rack.c
==============================================================================
--- head/sys/netinet/tcp_stacks/rack.c	Thu May 21 21:15:25 2020	(r361345)
+++ head/sys/netinet/tcp_stacks/rack.c	Thu May 21 21:26:21 2020	(r361346)
@@ -11082,17 +11082,20 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr
 			    (tp->t_flags & TF_REQ_SCALE)) {
 				tp->t_flags |= TF_RCVD_SCALE;
 				tp->snd_scale = to.to_wscale;
-			}
+			} else
+				tp->t_flags &= ~TF_REQ_SCALE;
 			/*
 			 * Initial send window.  It will be updated with the
 			 * next incoming segment to the scaled value.
 			 */
 			tp->snd_wnd = th->th_win;
-			if (to.to_flags & TOF_TS) {
+			if ((to.to_flags & TOF_TS) &&
+			    (tp->t_flags & TF_REQ_TSTMP)) {
 				tp->t_flags |= TF_RCVD_TSTMP;
 				tp->ts_recent = to.to_tsval;
 				tp->ts_recent_age = cts;
-			}
+			} else
+				tp->t_flags &= ~TF_REQ_TSTMP;
 			if (to.to_flags & TOF_MSS)
 				tcp_mss(tp, to.to_mss);
 			if ((tp->t_flags & TF_SACK_PERMIT) &&



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005212126.04LLQMw3091812>