From 828c4325b64de516b3eb483dfba65ef4666625b1 Mon Sep 17 00:00:00 2001 From: jhb Date: Thu, 28 Feb 2013 21:24:19 +0000 Subject: [PATCH] MFC 245238: Add an option to not drop options from the third retransmitted SYN. If the SYNs (or SYN/ACK replies) are dropped due to network congestion, then the remote end of the connection may act as if options such as window scaling are enabled but the local end will think they are not. This can result in very slow data transfers in the case of window scaling disagreements. Note that the unlike HEAD the existing behavior is preserved by default, but it can be disabled by setting the net.inet.tcp.rexmit_drop_options sysctl to zero. git-svn-id: svn://svn.freebsd.org/base/stable/8@247499 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/netinet/tcp_timer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 683fbb9a9..8d1127348 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -117,6 +117,11 @@ int tcp_maxpersistidle; /* max idle time in persist */ int tcp_maxidle; +static int tcp_rexmit_drop_options = 1; +SYSCTL_INT(_net_inet_tcp, OID_AUTO, rexmit_drop_options, CTLFLAG_RW, + &tcp_rexmit_drop_options, 0, + "Drop TCP options from 3rd and later retransmitted SYN"); + /* * Tcp protocol timeout routine called every 500 ms. * Updates timestamps used for TCP @@ -552,7 +557,8 @@ tcp_timer_rexmt(void * xtp) * header compression code which trashes TCP segments containing * unknown-to-them TCP options. */ - if ((tp->t_state == TCPS_SYN_SENT) && (tp->t_rxtshift == 3)) + if (tcp_rexmit_drop_options && (tp->t_state == TCPS_SYN_SENT) && + (tp->t_rxtshift == 3)) tp->t_flags &= ~(TF_REQ_SCALE|TF_REQ_TSTMP); /* * If we backed off this far, our srtt estimate is probably bogus. -- 2.45.0